Sha256: ecd62d6a823fcf7aa2995505039833a8090a4bea38efe069dc0f300ab6105cbb

Contents?: true

Size: 827 Bytes

Versions: 41

Compression:

Stored size: 827 Bytes

Contents

module CC
  module Analyzer
    module IssueValidations
      class OtherLocationsFormatValidation < Validation
        CHECKS = [
          LocationFormatValidation,
          PathExistenceValidation,
          PathPresenceValidation,
          RelativePathValidation,
        ].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
end

Version data entries

41 entries across 41 versions & 1 rubygems

Version Path
codeclimate-0.35.0 lib/cc/analyzer/issue_validations/other_locations_format_validation.rb