lib/rubocop/cop/style/numeric_literals.rb
# The parameter is called MinDigits (meaning the minimum number of
# digits for which an offense can be registered), but essentially it's
# a Max parameter (the maximum number of something that's allowed).
The parameter is called MinDigits (meaning the minimum number of
digits for which an offense can be registered), but essentially it's
a Max parameter (the maximum number of something that's allowed).
The parameter is called MinDigits ( meaning the minimum number of digits for which an offense can be registered ) but essentially it ' s a Max parameter ( the maximum number of something that ' s allowed ) .
def check(node)
          int = integer_part(node)
          return if int.start_with?('0')
          return unless int.size >= min_digits
          case int
          when /^\d+$/
            add_offense(node) { self.max = int.size + 1 }
          when /\d{4}/, short_group_regex
            add_offense(node) do
              self.config_to_allow_offenses = { 'Enabled' => false }
            end
          end
        end
def check ( node ) int = integer_part ( node ) return if int . start_with? ( '0' ) return unless int . size >= min_digits case int when / ^ \d +$ / add_offense ( node ) { self . max = int . size + 1 } when / \d {4} / , short_group_regex add_offense ( node ) do self . config_to_allow_offenses = { 'Enabled' => false } end end end
The parameter is called MinDigits (meaning the minimum number of
digits for which an offense can be registered), but essentially it's
a Max parameter (the maximum number of something that's allowed).
The parameter is called MinDigits ( meaning the minimum number of digits for which an offense can be registered ) but essentially it ' s a Max parameter ( the maximum number of something that ' s allowed ) .
# TODO: handle non-decimal literals as well
node
<not_specific>