module RuboCop::Cop::Lint::UnusedArgument
Common functionality for cops handling unused arguments.
Public Instance Methods
after_leaving_scope(scope, _variable_table)
click to toggle source
# File lib/rubocop/cop/mixin/unused_argument.rb, line 14 def after_leaving_scope(scope, _variable_table) scope.variables.each_value do |variable| check_argument(variable) end end
join_force?(force_class)
click to toggle source
# File lib/rubocop/cop/mixin/unused_argument.rb, line 10 def join_force?(force_class) force_class == VariableForce end
Private Instance Methods
check_argument(variable)
click to toggle source
# File lib/rubocop/cop/mixin/unused_argument.rb, line 22 def check_argument(variable) return if variable.should_be_unused? return if variable.referenced? message = message(variable) add_offense(variable.declaration_node, location: :name, message: message) end