lib/paraxial/cli.rb in paraxial-1.0.0 vs lib/paraxial/cli.rb in paraxial-1.0.1

- old
+ new

@@ -14,13 +14,14 @@ option :install_id, type: :numeric, desc: 'GitHub App installation ID' option :repo_owner, type: :string, desc: 'Repository owner' option :repo_name, type: :string, desc: 'Repository name' option :pr_number, type: :numeric, desc: 'Pull request number' option :exit_code, type: :boolean, default: false, desc: 'Non-zero exit code if findings > 0' + option :debug_rubocop, type: :boolean, default: false, desc: "Run rubocop in debug mode" def scan - puts '[Paraxial] Scan starting...' + puts "[Paraxial] v#{Paraxial::VERSION} Scan starting..." if check_rubocop_configuration puts '[Paraxial] .rubocop.yml is valid.' else puts '[Paraxial] .rubocop.yml is missing rubocop-erb. To scan embedded Ruby files for security problems, add:' puts '.rubocop.yml' @@ -37,10 +38,17 @@ repo_name = options[:repo_name] pr_number = options[:pr_number] exit_code = options[:exit_code] cops = 'Paraxial,Security/Eval,Security/IoMethods,Security/JSONLoad,Security/MarshalLoad,Security/Open,Security/YAMLLoad' - rubocop = `rubocop --require paraxial --only #{cops} --disable-pending-cops --format json` + if options[:debug_rubocop] + puts '[Paraxial] rubocop debug enabled' + rubocop = `rubocop --require paraxial --only #{cops} --disable-pending-cops --format json 2>/dev/null` + debug_rubocop = `rubocop -d --require paraxial --only #{cops} --disable-pending-cops 2>&1` + puts debug_rubocop + else + rubocop = `rubocop --require paraxial --only #{cops} --disable-pending-cops --format json` + end lockfile = File.read('./Gemfile.lock') api_key = ENV['PARAXIAL_API_KEY'] uri = URI.parse(Paraxial::Helpers.get_paraxial_url + '/api/ruby_scan') headers = { 'Content-Type': 'application/json' }