lib/cc/analyzer/issue_validator.rb in codeclimate-0.69.0 vs lib/cc/analyzer/issue_validator.rb in codeclimate-0.70.0
- old
+ new
@@ -1,40 +1,11 @@
module CC
module Analyzer
class IssueValidator
- CHECKS = IssueValidations.validations.freeze
+ include Validator
- attr_reader :error
-
- def initialize(issue)
- @issue = issue
- validate
- end
-
- def validate
- return @valid unless @valid.nil?
-
- if issue && invalid_messages.any?
- @error = {
- message: "#{invalid_messages.join("; ")}: `#{issue}`.",
- issue: issue,
- }
- @valid = false
- else
- @valid = true
- end
- end
- alias valid? validate
-
- private
-
- attr_reader :issue
-
- def invalid_messages
- @invalid_messages ||= CHECKS.each_with_object([]) do |check, result|
- validator = check.new(issue)
- result << validator.message unless validator.valid?
- end
+ def self.validations
+ IssueValidations.validations
end
end
end
end