You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Per #11020 (comment) the autocorrect for Lint/UnusedMethodArgument should update the Sorbet type signature, e.g.
sig{params(x: Integer).void}deffoo(x);end
should autocorrect to:
sig{params(_x: Integer).void}deffoo(_x);end
(Alternatively, the cop could be marked SafeAutoCorrect: false, which was attempted in #11020 )
Actual behavior
The parameter is renamed under autocorrection, but not the type signature:
sig { params(x: Integer).void }
def foo(_x); end
This code will fail to typecheck, as well as resulting in a RuntimeError on method invocation.
Steps to reproduce the problem
run rubocop -a on this snippet:
sig{params(x: Integer).void}deffoo(x);end
RuboCop version
Include the output of rubocop -V or bundle exec rubocop -V if using Bundler.
If you see extension cop versions (e.g. rubocop-performance, rubocop-rspec, and others)
output by rubocop -V, include them as well. Here's an example:
On further consideration, the autocorrect would still break rbi/rbs files, and I'm not sure rubocop supports the necessary correction across files (and file tops). I think the cop still needs to be marked SafeAutoCorrect: false. What do you think, @koic ?
Expected behavior
Per #11020 (comment) the autocorrect for Lint/UnusedMethodArgument should update the Sorbet type signature, e.g.
should autocorrect to:
(Alternatively, the cop could be marked
SafeAutoCorrect: false
, which was attempted in #11020 )Actual behavior
The parameter is renamed under autocorrection, but not the type signature:
This code will fail to typecheck, as well as resulting in a
RuntimeError
on method invocation.Steps to reproduce the problem
run
rubocop -a
on this snippet:RuboCop version
Include the output of
rubocop -V
orbundle exec rubocop -V
if using Bundler.If you see extension cop versions (e.g.
rubocop-performance
,rubocop-rspec
, and others)output by
rubocop -V
, include them as well. Here's an example:The text was updated successfully, but these errors were encountered: