Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/ci/reports/accessibility_reports_comparer.rb')
-rw-r--r--lib/gitlab/ci/reports/accessibility_reports_comparer.rb33
1 files changed, 12 insertions, 21 deletions
diff --git a/lib/gitlab/ci/reports/accessibility_reports_comparer.rb b/lib/gitlab/ci/reports/accessibility_reports_comparer.rb
index 210eb17f2d3..ab048672b22 100644
--- a/lib/gitlab/ci/reports/accessibility_reports_comparer.rb
+++ b/lib/gitlab/ci/reports/accessibility_reports_comparer.rb
@@ -3,52 +3,43 @@
module Gitlab
module Ci
module Reports
- class AccessibilityReportsComparer
- include Gitlab::Utils::StrongMemoize
-
- STATUS_SUCCESS = 'success'
- STATUS_FAILED = 'failed'
-
- attr_reader :base_reports, :head_reports
-
- def initialize(base_reports, head_reports)
- @base_reports = base_reports || AccessibilityReports.new
- @head_reports = head_reports
+ class AccessibilityReportsComparer < ReportsComparer
+ def initialize(base_report, head_report)
+ @base_report = base_report || AccessibilityReports.new
+ @head_report = head_report
end
- def status
- head_reports.errors_count > 0 ? STATUS_FAILED : STATUS_SUCCESS
+ def success?
+ head_report.errors_count == 0
end
def existing_errors
strong_memoize(:existing_errors) do
- base_reports.all_errors
+ base_report.all_errors & head_report.all_errors
end
end
def new_errors
strong_memoize(:new_errors) do
- head_reports.all_errors - base_reports.all_errors
+ head_report.all_errors - base_report.all_errors
end
end
def resolved_errors
strong_memoize(:resolved_errors) do
- base_reports.all_errors - head_reports.all_errors
+ base_report.all_errors - head_report.all_errors
end
end
- def errors_count
- head_reports.errors_count
- end
-
def resolved_count
resolved_errors.size
end
def total_count
- existing_errors.size + new_errors.size
+ head_report.errors_count
end
+
+ alias_method :errors_count, :total_count
end
end
end