Sha256: 948d28fb8eb23e2e90677026e5ca2a78c3a495f34f82411ec68b1d019ab2a2f0
Contents?: true
Size: 788 Bytes
Versions: 11
Compression:
Stored size: 788 Bytes
Contents
# frozen_string_literal: true module RuboCop module Cop module Lint # This cop identifies Float literals which are, like, really really really # really really really really really big. Too big. No-one needs Floats # that big. If you need a float that big, something is wrong with you. # # @example # # bad # float = 3.0e400 # # # good # float = 42.9 class FloatOutOfRange < Cop MSG = 'Float out of range.'.freeze def on_float(node) value, = *node if value.infinite? add_offense(node, :expression, MSG) elsif value.zero? && node.source =~ /[1-9]/ add_offense(node, :expression, MSG) end end end end end end
Version data entries
11 entries across 11 versions & 2 rubygems