Sha256: c4609f34682619f358df83b22dee49d20288fd01d91c8e44e539b289023336fc

Contents?: true

Size: 466 Bytes

Versions: 24

Compression:

Stored size: 466 Bytes

Contents

module CC
  module Analyzer
    module MeasurementValidations
      class NameValidation < Validation
        REGEX = /^[A-Za-z0-9_\.\-]+$/

        def valid?
          name && name.is_a?(String) && REGEX.match?(name)
        end

        def message
          "Name must be present and contain only letters, numbers, periods, hyphens, and underscores"
        end

        private

        def name
          object["name"]
        end
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
codeclimate-0.84.0 lib/cc/analyzer/measurement_validations/name_validation.rb
codeclimate-0.83.0 lib/cc/analyzer/measurement_validations/name_validation.rb
codeclimate-0.82.0 lib/cc/analyzer/measurement_validations/name_validation.rb
codeclimate-0.81.0 lib/cc/analyzer/measurement_validations/name_validation.rb
codeclimate-0.80.0 lib/cc/analyzer/measurement_validations/name_validation.rb
codeclimate-0.79.0 lib/cc/analyzer/measurement_validations/name_validation.rb
codeclimate-0.78.1 lib/cc/analyzer/measurement_validations/name_validation.rb
codeclimate-0.78.0 lib/cc/analyzer/measurement_validations/name_validation.rb
codeclimate-0.77.0 lib/cc/analyzer/measurement_validations/name_validation.rb
codeclimate-0.76.0 lib/cc/analyzer/measurement_validations/name_validation.rb
codeclimate-0.75.0 lib/cc/analyzer/measurement_validations/name_validation.rb
codeclimate-0.74.0 lib/cc/analyzer/measurement_validations/name_validation.rb
codeclimate-0.73.0 lib/cc/analyzer/measurement_validations/name_validation.rb
codeclimate-0.72.0 lib/cc/analyzer/measurement_validations/name_validation.rb
codeclimate-0.71.2 lib/cc/analyzer/measurement_validations/name_validation.rb
codeclimate-0.71.1 lib/cc/analyzer/measurement_validations/name_validation.rb
codeclimate-0.71.0 lib/cc/analyzer/measurement_validations/name_validation.rb
codeclimate-0.70.6 lib/cc/analyzer/measurement_validations/name_validation.rb
codeclimate-0.70.5 lib/cc/analyzer/measurement_validations/name_validation.rb
codeclimate-0.70.4 lib/cc/analyzer/measurement_validations/name_validation.rb