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
#check_argument(variable) (private)
[ GitHub ]# File 'lib/rubocop/cop/mixin/unused_argument.rb', line 18
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
#on_new_investigation
[ GitHub ]# File 'lib/rubocop/cop/mixin/unused_argument.rb', line 10
def on_new_investigation processed_source.variable_analysis.scopes.each do |scope| scope.variables.each_value { |variable| check_argument(variable) } end end