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
bash-5.1# rubocop -A --debug app/models/test.rb
For /app: configuration from /app/.rubocop.yml
configuration from /usr/local/bundle/gems/rubocop-performance-1.15.1/config/default.yml
configuration from /usr/local/bundle/gems/rubocop-performance-1.15.1/config/default.yml
Default configuration from /usr/local/bundle/gems/rubocop-1.40.0/config/default.yml
configuration from /usr/local/bundle/gems/rubocop-rails-2.17.3/config/default.yml
configuration from /usr/local/bundle/gems/rubocop-rails-2.17.3/config/default.yml
configuration from /usr/local/bundle/gems/rubocop-rspec-2.15.0/config/default.yml
configuration from /usr/local/bundle/gems/rubocop-rspec-2.15.0/config/default.yml
Inheriting configuration from /app/.rubocop_todo.yml
Use parallel by default.
Skipping parallel inspection: only a single file needs inspection
Inspecting 1 file
Scanning /app/app/models/test.rb
Loading cache from /root/.cache/rubocop_cache/0c5bb8b1e524101b67f11c14875a6c46c56250ba/cbff93e1a61a47763ca86fb62223c4e70a6840b1/22eea71e854462166381415295cdcfcc99be1b20
E
Offenses:
app/models/test.rb:6:11: C: [Corrected] Style/HashSyntax: Omit the hash value.
buzz foo: foo, bar: bar
^^^
app/models/test.rb:6:17: E: Lint/Syntax: unexpected token tRPAREN
(Using Ruby 3.1 parser; configure using TargetRubyVersion parameter, under AllCops)
buzz(foo:, bar:))
^
app/models/test.rb:6:21: C: [Corrected] Style/HashSyntax: Omit the hash value.
buzz foo: foo, bar: bar
^^^
1 file inspected, 3 offenses detected, 2 offenses corrected
Finished in 0.9874286688864231 seconds
Steps to reproduce the problem
As the code above shows,
Passing more than two keyword arguments to a method without omitting its values
execute rubocop autocorrection
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:
Fixesrubocop#11256.
This PR fixes an incorrect autocorrect for `Style/HashSyntax`
when without parentheses call expr follows after multiple keyword arguments method call.
Expected behavior
Say, we have a code below
Autocorrection fixes the code like this
Actual behavior
Autocorrection adds the same number of parens as the number of keyword arguments of the method.
and, this is the debug log
Steps to reproduce the problem
As the code above shows,
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:# bundle exec rubocop -V 1.40.0 (using Parser 3.1.3.0, rubocop-ast 1.24.0, running on ruby 3.1.3) [x86_64-linux-musl] - rubocop-performance 1.15.1 - rubocop-rails 2.17.3 - rubocop-rspec 2.15.0
The text was updated successfully, but these errors were encountered: