Module: RuboCop::Cop::Lint::UnusedArgument
Relationships & Source Files | |
Extension / Inclusion / Inheritance Descendants | |
Included In:
| |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
self,
Macros
|
|
Defined in: | lib/rubocop/cop/mixin/unused_argument.rb |
Overview
Common functionality for cops handling unused arguments.
Instance Method Summary
Instance Method Details
#after_leaving_scope(scope, _variable_table)
[ GitHub ]# File 'lib/rubocop/cop/mixin/unused_argument.rb', line 10
def after_leaving_scope(scope, _variable_table) scope.variables.each_value { |variable| check_argument(variable) } end
#check_argument(variable) (private)
[ GitHub ]# File 'lib/rubocop/cop/mixin/unused_argument.rb', line 16
def check_argument(variable) return if variable.should_be_unused? return if variable.referenced? = (variable) add_offense(variable.declaration_node.loc.name, message: ) do |corrector| autocorrect(corrector, variable.declaration_node) end end