Class: RuboCop::Cop::Semantics::VariableName
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::Semantics::VariableName
- Defined in:
- lib/rubocop/cop/semantics/variable_name.rb
Overview
Checks for meaningless variable names. A good variable name describes its contents with nouns and adjectives.
Constant Summary collapse
- MEANINGLESS_NAMES =
%i[ data info scope value ].freeze
Instance Method Summary collapse
Instance Method Details
#on_lvasgn(node) ⇒ Object
27 28 29 30 31 32 |
# File 'lib/rubocop/cop/semantics/variable_name.rb', line 27 def on_lvasgn(node) variable_name, = *node return unless MEANINGLESS_NAMES.include?(variable_name) add_offense(node.loc.name, message: "Use a more descriptive variable name.") end |