Sha256: cbc264c6b4b98a18f549f3763a9460c6d7293580651158916243f9ece24f52e5

Contents?: true

Size: 766 Bytes

Versions: 17

Compression:

Stored size: 766 Bytes

Contents

module CC
  module Analyzer
    class IssueOtherLocationsFormatValidation < Validation
      CHECKS = [
        IssueLocationFormatValidation,
        IssuePathExistenceValidation,
        IssuePathPresenceValidation,
        IssueRelativePathValidation,
      ].freeze

      def valid?
        if object["other_locations"]
          object["other_locations"].is_a?(Array) &&
            object["other_locations"].all?(&method(:other_location_valid?))
        else
          true
        end
      end

      def message
        "Other locations are not formatted correctly"
      end

      private

      def other_location_valid?(location)
        CHECKS.all? do |klass|
          klass.new("location" => location).valid?
        end
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
codeclimate-0.34.1 lib/cc/analyzer/issue_other_locations_format_validation.rb
codeclimate-0.34.0 lib/cc/analyzer/issue_other_locations_format_validation.rb
codeclimate-0.33.0 lib/cc/analyzer/issue_other_locations_format_validation.rb
codeclimate-0.32.1 lib/cc/analyzer/issue_other_locations_format_validation.rb
codeclimate-0.32.0 lib/cc/analyzer/issue_other_locations_format_validation.rb
codeclimate-0.32.0.rc1 lib/cc/analyzer/issue_other_locations_format_validation.rb
codeclimate-0.31.1 lib/cc/analyzer/issue_other_locations_format_validation.rb
codeclimate-0.31.0 lib/cc/analyzer/issue_other_locations_format_validation.rb
codeclimate-0.30.1 lib/cc/analyzer/issue_other_locations_format_validation.rb
codeclimate-0.30.0 lib/cc/analyzer/issue_other_locations_format_validation.rb
codeclimate-0.29.0 lib/cc/analyzer/issue_other_locations_format_validation.rb
codeclimate-0.28.0 lib/cc/analyzer/issue_other_locations_format_validation.rb
codeclimate-0.27.2 lib/cc/analyzer/issue_other_locations_format_validation.rb
codeclimate-0.27.1 lib/cc/analyzer/issue_other_locations_format_validation.rb
codeclimate-0.27.0 lib/cc/analyzer/issue_other_locations_format_validation.rb
codeclimate-0.27.0.rc1 lib/cc/analyzer/issue_other_locations_format_validation.rb
codeclimate-0.26.0 lib/cc/analyzer/issue_other_locations_format_validation.rb