New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lint/UnusedMethodArgument does not correct or mark keyword args as "todo" #7971
Comments
I've been away from RuboCop development for too long. I didn't know Taking a quick look at this issue, I have come across a couple of things. First off, I'm not sure why This directly plays into why the comment disable isn't working though. Here is the logic for auto-correction def correct(node)
reason = reason_to_not_correct(node)
return reason if reason
@corrected_nodes[node] = true
if support_autocorrect?
correction = autocorrect(node)
return :uncorrected unless correction
@corrections << Correction.new(correction, node, self)
:corrected
elsif disable_uncorrectable?
disable_uncorrectable(node)
:corrected_with_todo
end
end With how this has been implemented, a cop can either auto-correct or it can disable, it cannot do both. Since I think the basic fix is to modify the code inside the |
Actually knowing if a Cop has done corrections will be automatic once #7868 merges, hopefully in the next few days. |
Thank you so much for taking this on, delighted to see the fix merged! |
When using the
--safe-auto-correct --disable-uncorrectable
flags,Lint/UnusedMethodArgument
has some inconsistent behaviour. It auto-corrects methods with standard arguments, but not keyword arguments. It doesn't addrubocop:todo
comments to methods with keyword arguments either.Expected behavior
Auto-correct and disabling uncorrectable offenses works for methods with keyword arguments
Steps to reproduce the problem
example.rb
RuboCop version
The text was updated successfully, but these errors were encountered: