lib/paraxial/cli.rb in paraxial-0.3.0 vs lib/paraxial/cli.rb in paraxial-0.4.0

- old
+ new

@@ -40,21 +40,32 @@ 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' } - body = { rubocop:, lockfile:, api_key:, timestamp: Paraxial.get_timestamp } + body = { rubocop: rubocop, lockfile: lockfile, api_key: api_key, timestamp: Paraxial.get_timestamp } response = Net::HTTP.post(uri, body.to_json, headers) - puts "[Paraxial] scan result: #{response.body}" + m = JSON.parse(response.body) + findings = m['ok']['findings'] + puts + puts "[Paraxial] Scan count #{findings.length}" + puts + findings.each do |finding| + puts finding + puts + end + puts "[Paraxial] Scan UUID #{m['ok']['scan_uuid']}" + puts "[Paraxial] Scan URL #{m['ok']['scan_url']}" github_valid = (!!github_app and !!install_id and !!repo_owner and !!repo_name and !!pr_number) if github_app and github_valid == false puts '[Paraxial] --github_app missing arguments' puts '[Paraxial] Required: --github_app, --install_id, --repo_owner, --repo_name, --pr_number' elsif github_app and github_valid - uuid_regex = /UUID\s+(\S+)/ - match = response.body.match(uuid_regex) - uuid = match[1] if match + # uuid_regex = /UUID\s+(\S+)/ + # match = response.body.match(uuid_regex) + # uuid = match[1] if match + uuid = m['ok']['scan_uuid'] if uuid final_uuid = uuid.chomp('.') censored_backend_map = { 'installation_id' => install_id, 'repository_owner' => repo_owner,