Sha256: 2b8172ff04eb2e3e7e6a02cec7341c4e4ed1b439513ee4b2c08bd7ab8e147b14
Contents?: true
Size: 775 Bytes
Versions: 45
Compression:
Stored size: 775 Bytes
Contents
# frozen_string_literal: true module RuboCop module Cop module Lint # This cop checks for `:true` and `:false` symbols. # In most cases it would be a typo. # # @example # # # bad # :true # # # good # true # # @example # # # bad # :false # # # good # false class BooleanSymbol < Cop MSG = 'Symbol with a boolean name - ' \ 'you probably meant to use `%<boolean>s`.' def_node_matcher :boolean_symbol?, '(sym {:true :false})' def on_sym(node) return unless boolean_symbol?(node) add_offense(node, message: format(MSG, boolean: node.value)) end end end end end
Version data entries
45 entries across 26 versions & 3 rubygems