We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Auto correct Style/ArgumentsForwarding makes invalid code in class_eval.
Style/ArgumentsForwarding
class_eval
It does not change or keep valid.
It becomes invalid code.
% docker run --rm -it ruby:3.1 /bin/bash root@987347fd5d79:/# gem i rubocop Fetching rubocop-ast-1.30.0.gem Fetching ruby-progressbar-1.13.0.gem Fetching ast-2.4.2.gem Fetching parser-3.3.0.4.gem Fetching unicode-display_width-2.5.0.gem Fetching rainbow-3.1.1.gem Fetching parallel-1.24.0.gem Fetching rubocop-1.60.1.gem Fetching regexp_parser-2.9.0.gem Fetching language_server-protocol-3.17.0.3.gem Successfully installed unicode-display_width-2.5.0 Successfully installed ruby-progressbar-1.13.0 Successfully installed ast-2.4.2 Successfully installed parser-3.3.0.4 Successfully installed rubocop-ast-1.30.0 Successfully installed regexp_parser-2.9.0 Successfully installed rainbow-3.1.1 Successfully installed parallel-1.24.0 Successfully installed language_server-protocol-3.17.0.3 Successfully installed rubocop-1.60.1 10 gems installed root@987347fd5d79:/# cat > .rubocop.yml AllCops: TargetRubyVersion: '3.1' NewCops: enable root@987347fd5d79:/# cat > b.rb C.class_eval do def foo(a=false, &block) bar(a, 1, &block) end end root@987347fd5d79:/# rubocop --only Style/ArgumentsForwarding -a b.rb Inspecting 1 file C Offenses: .rb:2:11: C: [Corrected] Style/ArgumentsForwarding: Use shorthand syntax ... for arguments forwarding. def foo(a=false, &block) ^^^^^^^^^^^^^^^ .rb:3:12: C: [Corrected] Style/ArgumentsForwarding: Use shorthand syntax ... for arguments forwarding. bar(a, 1, &block) ^^^^^^^^^ 1 file inspected, 2 offenses detected, 2 offenses corrected root@987347fd5d79:/# cat b.rb C.class_eval do def foo(...) bar(a, ...) end end
root@987347fd5d79:/# rubocop -V 1.60.1 (using Parser 3.3.0.4, rubocop-ast 1.30.0, running on ruby 3.1.4) [aarch64-linux]
The text was updated successfully, but these errors were encountered:
This issue is a dup with #12618 (comment) and will be resolved in #12628. Thank you.
Sorry, something went wrong.
No branches or pull requests
Auto correct
Style/ArgumentsForwarding
makes invalid code inclass_eval
.Expected behavior
It does not change or keep valid.
Actual behavior
It becomes invalid code.
Steps to reproduce the problem
RuboCop version
The text was updated successfully, but these errors were encountered: