Skip to content

Commit

Permalink
log octocatalog warning, and further improve ruby parser loads
Browse files Browse the repository at this point in the history
  • Loading branch information
mschuchard committed Mar 21, 2024
1 parent 6a5322c commit 55afc00
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
9 changes: 2 additions & 7 deletions lib/puppet-check/ruby_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ def self.ruby(files, style, rc_args)
if style
require 'json'
require 'rubocop'
require 'reek'
require 'reek/cli/application'

rubocop_cli = RuboCop::CLI.new
end
Expand All @@ -27,9 +29,6 @@ def self.ruby(files, style, rc_args)
rubocop_offenses = JSON.parse(rubocop_warnings)['files'][0]['offenses'].map { |warning| "#{warning['location']['line']}:#{warning['location']['column']} #{warning['message']}" }

# check Reek and parse warnings' JSON output
require 'reek'
require 'reek/cli/application'

reek_warnings = Utils.capture_stdout { Reek::CLI::Application.new(['-f', 'json', file]).execute }
reek_offenses = JSON.parse(reek_warnings).map { |warning| "#{warning['lines'].join(',')}: #{warning['context']} #{warning['message']}" }

Expand Down Expand Up @@ -88,10 +87,6 @@ def self.librarian(files, style, rc_args)
# check librarian puppet style
else
if style
# check Rubocop
require 'json'
require 'rubocop'

warnings = Utils.capture_stdout { rubocop_cli.run(rc_args + ['--enable-pending-cops', '--require', 'rubocop-performance', '--format', 'json', file]) }
offenses = JSON.parse(warnings)['files'][0]['offenses'].map { |warning| "#{warning['location']['line']}:#{warning['location']['column']} #{warning['message']}" }

Expand Down
1 change: 1 addition & 0 deletions lib/puppet_check.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ def run(settings = {}, paths = [])
require_relative 'puppet-check/regression_check'
# if octocatalog-diff is not installed then return immediately
rescue LoadError
warn 'octocatalog-diff is not installed, and therefore the regressions check will be skipped'
return 0
end

Expand Down

0 comments on commit 55afc00

Please sign in to comment.