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
Example code:
class Foo def bar(*args, &block) hello(*args, &block) world(*args) end end
Output code should be working code after autofix.
$ bundle exec rubocop -a test.rb` ... test.rb:3:13: C: [Corrected] Style/ArgumentsForwarding: Use shorthand syntax ... for arguments forwarding. def bar(*args, &block) ^^^^^^^^^^^^^ test.rb:4:12: C: [Corrected] Style/ArgumentsForwarding: Use shorthand syntax ... for arguments forwarding. puts(*args, &block) ^^^^^^^^^^^^^
Result
class Foo class << self def bar(...) puts(...) puts(*args) end end end
This is broken since args is not defined anymore.
args
Please note it happens when running on 3.2.0 with TargetRubyVersion: 2.7.
TargetRubyVersion: 2.7
If I run it on 3.2.0 with TargetRubyVersion: 3.2, output is:
TargetRubyVersion: 3.2
class Foo class << self def bar(*, &block) puts(*, &block) puts(*) end end end
And this is not working on ruby 2.7
Gemfile
source 'https://rubygems.org' gem 'rubocop', '1.56.0'
Gemfile.lock
GEM remote: https://rubygems.org/ specs: ast (2.4.2) base64 (0.1.1) json (2.6.3) language_server-protocol (3.17.0.3) parallel (1.23.0) parser (3.2.2.3) ast (~> 2.4.1) racc racc (1.7.1) rainbow (3.1.1) regexp_parser (2.8.1) rexml (3.2.6) rubocop (1.56.0) base64 (~> 0.1.1) json (~> 2.3) language_server-protocol (>= 3.17.0) parallel (~> 1.10) parser (>= 3.2.2.3) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 1.8, < 3.0) rexml (>= 3.2.5, < 4.0) rubocop-ast (>= 1.28.1, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 3.0) rubocop-ast (1.29.0) parser (>= 3.2.1.0) ruby-progressbar (1.13.0) unicode-display_width (2.4.2) PLATFORMS arm64-darwin-22 DEPENDENCIES rubocop (= 1.56.0) BUNDLED WITH 2.4.12
.rubocop.yml
AllCops: TargetRubyVersion: 2.7 Style/ArgumentsForwarding: Enabled: true
$ ruby --version ruby 2.7.8p225 (2023-03-30 revision 1f4d455848) [arm64-darwin22] $ bundle exec rubocop -V 1.56.0 (using Parser 3.2.2.3, rubocop-ast 1.29.0, running on ruby 2.7.8) [arm64-darwin22] $ cat .tool-versions ruby 2.7.8
The text was updated successfully, but these errors were encountered:
62a7cb9
Merge pull request #12118 from owst/fix_arguments_forwarding_splat_wi…
5ca04a2
…thout_block [Fix #12117] Fix `Style/ArgumentsForwarding` when not always forwarding a block
No branches or pull requests
Example code:
Expected behavior
Output code should be working code after autofix.
Actual behavior
Result
This is broken since
args
is not defined anymore.Please note it happens when running on 3.2.0 with
TargetRubyVersion: 2.7
.If I run it on 3.2.0 with
TargetRubyVersion: 3.2
, output is:And this is not working on ruby 2.7
Steps to reproduce the problem
Gemfile
Gemfile.lock
.rubocop.yml
The text was updated successfully, but these errors were encountered: