Skip to content

Commit

Permalink
Add more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sbernhard committed Apr 8, 2024
1 parent c841fd7 commit 286c623
Show file tree
Hide file tree
Showing 5 changed files with 4,776 additions and 7 deletions.
6 changes: 6 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ Metrics/ClassLength:
Metrics/MethodLength:
Max: 20

Metrics/CyclomaticComplexity:
Max: 10

Metrics/PerceivedComplexity:
Max: 10

Rails:
Enabled: true

Expand Down
5 changes: 3 additions & 2 deletions app/services/foreman_cve_scanner/cve_report_scanner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,9 @@ def generate_trivy_entry(entry)

# rubocop:disable Metrics/AbcSize
def generate_unified_vuls
j = @raw_data['scan']
raise ::Foreman::Exception, _('Invalid CVE scanner report') unless @raw_data.key?('scan')

j = @raw_data['scan']
vuls = {}
if j.key?('matches') # Grype
j['matches'].each do |vul|
Expand All @@ -119,7 +120,7 @@ def generate_unified_vuls
end
else
Rails.logger.error 'Unsupported cve scanner report format'
raise ::Foreman::Exception, _('Invalid report')
raise ::Foreman::Exception, _('Unsupported cve scanner report format')
end

vuls
Expand Down
Loading

0 comments on commit 286c623

Please sign in to comment.