summaryrefslogtreecommitdiff
path: root/lib/gitlab/ci/reports/security/vulnerability_reports_comparer.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/ci/reports/security/vulnerability_reports_comparer.rb')
-rw-r--r--lib/gitlab/ci/reports/security/vulnerability_reports_comparer.rb29
1 files changed, 19 insertions, 10 deletions
diff --git a/lib/gitlab/ci/reports/security/vulnerability_reports_comparer.rb b/lib/gitlab/ci/reports/security/vulnerability_reports_comparer.rb
index 4be4cf62e7b..adc666d9987 100644
--- a/lib/gitlab/ci/reports/security/vulnerability_reports_comparer.rb
+++ b/lib/gitlab/ci/reports/security/vulnerability_reports_comparer.rb
@@ -10,6 +10,7 @@ module Gitlab
attr_reader :base_report, :head_report
ACCEPTABLE_REPORT_AGE = 1.week
+ MAX_FINDINGS_COUNT = 25
def initialize(project, base_report, head_report)
@base_report = base_report
@@ -40,21 +41,13 @@ module Gitlab
def added
strong_memoize(:added) do
- if @signatures_enabled
- @added_findings
- else
- head_report.findings - base_report.findings
- end
+ all_added_findings.take(MAX_FINDINGS_COUNT) # rubocop:disable CodeReuse/ActiveRecord (This is Array#take)
end
end
def fixed
strong_memoize(:fixed) do
- if @signatures_enabled
- @fixed_findings
- else
- base_report.findings - head_report.findings
- end
+ all_fixed_findings.take(MAX_FINDINGS_COUNT) # rubocop:disable CodeReuse/ActiveRecord (This is Array#take)
end
end
@@ -89,6 +82,22 @@ module Gitlab
@added_findings = matcher.unmatched_head_findings.values
end
+
+ def all_added_findings
+ if @signatures_enabled
+ @added_findings
+ else
+ head_report.findings - base_report.findings
+ end
+ end
+
+ def all_fixed_findings
+ if @signatures_enabled
+ @fixed_findings
+ else
+ base_report.findings - head_report.findings
+ end
+ end
end
class FindingMatcher