Method: RuboCop::Cop::Lint::UnderscorePrefixedVariableName#check_variable
- Defined in:
- lib/rubocop/cop/lint/underscore_prefixed_variable_name.rb
#check_variable(variable) ⇒ Object
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/rubocop/cop/lint/underscore_prefixed_variable_name.rb', line 54 def check_variable(variable) return unless variable.should_be_unused? return if variable.references.none?(&:explicit?) return if allowed_keyword_block_argument?(variable) node = variable.declaration_node location = if node.match_with_lvasgn_type? node.children.first.source_range else node.loc.name end add_offense(location) end |