Class: Gitlab::Ci::Reports::AccessibilityReportsComparer

Inherits:
ReportsComparer show all
Defined in:
lib/gitlab/ci/reports/accessibility_reports_comparer.rb

Constant Summary

Constants inherited from ReportsComparer

ReportsComparer::STATUS_FAILED, ReportsComparer::STATUS_NOT_FOUND, ReportsComparer::STATUS_SUCCESS

Instance Attribute Summary

Attributes inherited from ReportsComparer

#base_report, #head_report

Instance Method Summary collapse

Methods inherited from ReportsComparer

#not_found?, #status

Constructor Details

#initialize(base_report, head_report) ⇒ AccessibilityReportsComparer

Returns a new instance of AccessibilityReportsComparer.



7
8
9
10
# File 'lib/gitlab/ci/reports/accessibility_reports_comparer.rb', line 7

def initialize(base_report, head_report)
  @base_report = base_report || AccessibilityReports.new
  @head_report = head_report
end

Instance Method Details

#existing_errorsObject



16
17
18
19
20
# File 'lib/gitlab/ci/reports/accessibility_reports_comparer.rb', line 16

def existing_errors
  strong_memoize(:existing_errors) do
    base_report.all_errors & head_report.all_errors
  end
end

#new_errorsObject



22
23
24
25
26
# File 'lib/gitlab/ci/reports/accessibility_reports_comparer.rb', line 22

def new_errors
  strong_memoize(:new_errors) do
    head_report.all_errors - base_report.all_errors
  end
end

#resolved_countObject



34
35
36
# File 'lib/gitlab/ci/reports/accessibility_reports_comparer.rb', line 34

def resolved_count
  resolved_errors.size
end

#resolved_errorsObject



28
29
30
31
32
# File 'lib/gitlab/ci/reports/accessibility_reports_comparer.rb', line 28

def resolved_errors
  strong_memoize(:resolved_errors) do
    base_report.all_errors - head_report.all_errors
  end
end

#success?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/gitlab/ci/reports/accessibility_reports_comparer.rb', line 12

def success?
  head_report.errors_count == 0
end

#total_countObject Also known as: errors_count



38
39
40
# File 'lib/gitlab/ci/reports/accessibility_reports_comparer.rb', line 38

def total_count
  head_report.errors_count
end