Module: RuboCop::Cop::AllowedIdentifiers

Included in:
Naming::VariableName, Naming::VariableNumber
Defined in:
lib/rubocop/cop/mixin/allowed_identifiers.rb

Overview

This module encapsulates the ability to allow certain identifiers in a cop.

Constant Summary collapse

SIGILS =

if a variable starts with a sigil it will be removed

'@$'

Instance Method Summary collapse

Instance Method Details

#allowed_identifier?(name) ⇒ Boolean

Returns:

  • (Boolean)

9
10
11
# File 'lib/rubocop/cop/mixin/allowed_identifiers.rb', line 9

def allowed_identifier?(name)
  allowed_identifiers.include?(name.to_s.delete(SIGILS))
end

#allowed_identifiersObject


13
14
15
# File 'lib/rubocop/cop/mixin/allowed_identifiers.rb', line 13

def allowed_identifiers
  cop_config.fetch('AllowedIdentifiers', [])
end