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.85.24 lib/cc/analyzer/issue_validations/remediation_points_validation.rb
codeclimate-fede-0.85.54 lib/cc/analyzer/issue_validations/remediation_points_validation.rb
codeclimate-fede-0.85.53 lib/cc/analyzer/issue_validations/remediation_points_validation.rb
codeclimate-fede-0.85.52 lib/cc/analyzer/issue_validations/remediation_points_validation.rb
codeclimate-fede-0.85.51 lib/cc/analyzer/issue_validations/remediation_points_validation.rb
codeclimate-fede-0.85.50 lib/cc/analyzer/issue_validations/remediation_points_validation.rb
codeclimate-fede-0.85.49 lib/cc/analyzer/issue_validations/remediation_points_validation.rb
codeclimate-fede-0.85.48 lib/cc/analyzer/issue_validations/remediation_points_validation.rb
codeclimate-fede-0.85.47 lib/cc/analyzer/issue_validations/remediation_points_validation.rb
codeclimate-fede-0.85.46 lib/cc/analyzer/issue_validations/remediation_points_validation.rb
codeclimate-fede-0.85.45 lib/cc/analyzer/issue_validations/remediation_points_validation.rb
codeclimate-fede-0.85.44 lib/cc/analyzer/issue_validations/remediation_points_validation.rb
codeclimate-fede-0.85.43 lib/cc/analyzer/issue_validations/remediation_points_validation.rb
codeclimate-fede-0.85.42 lib/cc/analyzer/issue_validations/remediation_points_validation.rb
codeclimate-fede-0.85.41 lib/cc/analyzer/issue_validations/remediation_points_validation.rb
codeclimate-fede-0.85.40 lib/cc/analyzer/issue_validations/remediation_points_validation.rb
codeclimate-fede-0.85.39 lib/cc/analyzer/issue_validations/remediation_points_validation.rb
codeclimate-fede-0.85.38 lib/cc/analyzer/issue_validations/remediation_points_validation.rb
codeclimate-fede-0.85.37 lib/cc/analyzer/issue_validations/remediation_points_validation.rb
codeclimate-fede-0.85.36 lib/cc/analyzer/issue_validations/remediation_points_validation.rb