diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-03-03 18:10:53 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-03-03 18:10:53 +0300 |
commit | 7fcda12793acc54ba8de037f50cc3696dbd0f002 (patch) | |
tree | 044fbc2b142e6c82ee6b2a5df4b37d000c0e2d1f /lib/gitlab/ci/reports | |
parent | b5820a6bcd083c878a085aa288757e8dc2d35fec (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/ci/reports')
-rw-r--r-- | lib/gitlab/ci/reports/codequality_reports_comparer.rb | 8 | ||||
-rw-r--r-- | lib/gitlab/ci/reports/reports_comparer.rb | 10 |
2 files changed, 14 insertions, 4 deletions
diff --git a/lib/gitlab/ci/reports/codequality_reports_comparer.rb b/lib/gitlab/ci/reports/codequality_reports_comparer.rb index 88e02cd9004..10748b8ca02 100644 --- a/lib/gitlab/ci/reports/codequality_reports_comparer.rb +++ b/lib/gitlab/ci/reports/codequality_reports_comparer.rb @@ -5,7 +5,7 @@ module Gitlab module Reports class CodequalityReportsComparer < ReportsComparer def initialize(base_report, head_report) - @base_report = base_report || CodequalityReports.new + @base_report = base_report @head_report = head_report end @@ -15,12 +15,16 @@ module Gitlab def existing_errors strong_memoize(:existing_errors) do + next [] if not_found? + base_report.all_degradations & head_report.all_degradations end end def new_errors strong_memoize(:new_errors) do + next [] if not_found? + fingerprints = head_report.degradations.keys - base_report.degradations.keys head_report.degradations.fetch_values(*fingerprints) end @@ -28,6 +32,8 @@ module Gitlab def resolved_errors strong_memoize(:resolved_errors) do + next [] if not_found? + fingerprints = base_report.degradations.keys - head_report.degradations.keys base_report.degradations.fetch_values(*fingerprints) end diff --git a/lib/gitlab/ci/reports/reports_comparer.rb b/lib/gitlab/ci/reports/reports_comparer.rb index 5667998e535..16a7f6478b7 100644 --- a/lib/gitlab/ci/reports/reports_comparer.rb +++ b/lib/gitlab/ci/reports/reports_comparer.rb @@ -18,10 +18,10 @@ module Gitlab end def status - if success? - STATUS_SUCCESS - elsif base_report.nil? || head_report.nil? + if base_report.nil? || head_report.nil? STATUS_NOT_FOUND + elsif success? + STATUS_SUCCESS else STATUS_FAILED end @@ -54,6 +54,10 @@ module Gitlab def total_count existing_errors.size + new_errors.size end + + def not_found? + status == STATUS_NOT_FOUND + end end end end |