Sha256: 198f410773df59555b4aa24f1ca3a0960797da761dc8f88e1938f1762010cd76

Contents?: true

Size: 545 Bytes

Versions: 69

Compression:

Stored size: 545 Bytes

Contents

module CC
  module Analyzer
    module IssueValidations
      class RemediationPointsValidation < Validation
        def valid?
          remediation_points.nil? || positive_integer?(remediation_points)
        end

        def message
          "Remediation points must be a non-negative integer"
        end

        private

        def remediation_points
          @remediation_points ||= object["remediation_points"]
        end

        def positive_integer?(x)
          x.is_a?(Integer) && x >= 0
        end
      end
    end
  end
end

Version data entries

69 entries across 69 versions & 2 rubygems

Version Path
codeclimate-0.75.0 lib/cc/analyzer/issue_validations/remediation_points_validation.rb
codeclimate-0.74.0 lib/cc/analyzer/issue_validations/remediation_points_validation.rb
codeclimate-0.73.0 lib/cc/analyzer/issue_validations/remediation_points_validation.rb
codeclimate-0.72.0 lib/cc/analyzer/issue_validations/remediation_points_validation.rb
codeclimate-0.71.2 lib/cc/analyzer/issue_validations/remediation_points_validation.rb
codeclimate-0.71.1 lib/cc/analyzer/issue_validations/remediation_points_validation.rb
codeclimate-0.71.0 lib/cc/analyzer/issue_validations/remediation_points_validation.rb
codeclimate-0.70.6 lib/cc/analyzer/issue_validations/remediation_points_validation.rb
codeclimate-0.70.5 lib/cc/analyzer/issue_validations/remediation_points_validation.rb