Sha256: dd310e0dc64a42c2adca4771cd38f7b9c94d8efeb31fac04ecdb8d2a63cf0663

Contents?: true

Size: 1002 Bytes

Versions: 112

Compression:

Stored size: 1002 Bytes

Contents

module CC
  module Analyzer
    module IssueValidations
      class OtherLocationsFormatValidation < Validation
        CHECKS = [
          LocationFormatValidation,
          PathExistenceValidation,
          PathPresenceValidation,
          RelativePathValidation,
        ].freeze

        def initialize(object)
          super
          @other_location_valid = {}
        end

        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)
          path = location && location["path"]
          @other_location_valid[path] ||= CHECKS.all? do |klass|
            klass.new("location" => location).valid?
          end
        end
      end
    end
  end
end

Version data entries

112 entries across 112 versions & 2 rubygems

Version Path
codeclimate-fede-0.85.38 lib/cc/analyzer/issue_validations/other_locations_format_validation.rb
codeclimate-fede-0.85.37 lib/cc/analyzer/issue_validations/other_locations_format_validation.rb
codeclimate-fede-0.85.36 lib/cc/analyzer/issue_validations/other_locations_format_validation.rb
codeclimate-fede-0.85.35 lib/cc/analyzer/issue_validations/other_locations_format_validation.rb
codeclimate-fede-0.85.33 lib/cc/analyzer/issue_validations/other_locations_format_validation.rb
codeclimate-fede-0.85.32 lib/cc/analyzer/issue_validations/other_locations_format_validation.rb
codeclimate-fede-0.85.31 lib/cc/analyzer/issue_validations/other_locations_format_validation.rb
codeclimate-fede-0.85.30 lib/cc/analyzer/issue_validations/other_locations_format_validation.rb
codeclimate-fede-0.85.21 lib/cc/analyzer/issue_validations/other_locations_format_validation.rb
codeclimate-fede-0.85.24 lib/cc/analyzer/issue_validations/other_locations_format_validation.rb
codeclimate-fede-0.85.23 lib/cc/analyzer/issue_validations/other_locations_format_validation.rb
codeclimate-0.85.23 lib/cc/analyzer/issue_validations/other_locations_format_validation.rb
codeclimate-0.85.22 lib/cc/analyzer/issue_validations/other_locations_format_validation.rb
codeclimate-0.85.21 lib/cc/analyzer/issue_validations/other_locations_format_validation.rb
codeclimate-0.85.19 lib/cc/analyzer/issue_validations/other_locations_format_validation.rb
codeclimate-0.85.18 lib/cc/analyzer/issue_validations/other_locations_format_validation.rb
codeclimate-0.85.17 lib/cc/analyzer/issue_validations/other_locations_format_validation.rb
codeclimate-0.85.15 lib/cc/analyzer/issue_validations/other_locations_format_validation.rb
codeclimate-0.85.14 lib/cc/analyzer/issue_validations/other_locations_format_validation.rb
codeclimate-0.85.13 lib/cc/analyzer/issue_validations/other_locations_format_validation.rb