Module: RuboCop::Cop::ForbiddenIdentifiers
- Included in:
- Naming::MethodName, Naming::VariableName
- Defined in:
- lib/rubocop/cop/mixin/forbidden_identifiers.rb
Overview
This module encapsulates the ability to forbid 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
#forbidden_identifier?(name) ⇒ Boolean
9 10 11 12 13 |
# File 'lib/rubocop/cop/mixin/forbidden_identifiers.rb', line 9 def forbidden_identifier?(name) name = name.to_s.delete(SIGILS) forbidden_identifiers.any? && forbidden_identifiers.include?(name) end |
#forbidden_identifiers ⇒ Object
15 16 17 |
# File 'lib/rubocop/cop/mixin/forbidden_identifiers.rb', line 15 def forbidden_identifiers cop_config.fetch('ForbiddenIdentifiers', []) end |