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/reports_comparer.rb')
-rw-r--r--lib/gitlab/ci/reports/reports_comparer.rb53
1 files changed, 53 insertions, 0 deletions
diff --git a/lib/gitlab/ci/reports/reports_comparer.rb b/lib/gitlab/ci/reports/reports_comparer.rb
new file mode 100644
index 00000000000..d413d3a74f6
--- /dev/null
+++ b/lib/gitlab/ci/reports/reports_comparer.rb
@@ -0,0 +1,53 @@
+# frozen_string_literal: true
+
+module Gitlab
+ module Ci
+ module Reports
+ class ReportsComparer
+ include Gitlab::Utils::StrongMemoize
+
+ STATUS_SUCCESS = 'success'
+ STATUS_FAILED = 'failed'
+
+ attr_reader :base_report, :head_report
+
+ def initialize(base_report, head_report)
+ @base_report = base_report
+ @head_report = head_report
+ end
+
+ def status
+ success? ? STATUS_SUCCESS : STATUS_FAILED
+ end
+
+ def success?
+ raise NotImplementedError
+ end
+
+ def existing_errors
+ raise NotImplementedError
+ end
+
+ def new_errors
+ raise NotImplementedError
+ end
+
+ def resolved_errors
+ raise NotImplementedError
+ end
+
+ def errors_count
+ raise NotImplementedError
+ end
+
+ def resolved_count
+ resolved_errors.size
+ end
+
+ def total_count
+ existing_errors.size + new_errors.size
+ end
+ end
+ end
+ end
+end