Skip to content
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

Layout/SpaceAroundEqualsInParameterDefault only registered once in a line #8801

Closed
rdunlop opened this issue Sep 27, 2020 · 1 comment
Closed

Comments

@rdunlop
Copy link
Contributor

rdunlop commented Sep 27, 2020

If a single line of code has multiple offenses for the SpaceAroundEqualsInParameterDefault cop, only the first one is detected (in certain situations).

This appears to have been first reported by @jsmestad in #8514 (comment)

Reproduction scenario:

class Test

  def log_msg(msg, level =:info, olevel=:error); end

end

Expected output:

Offenses:

spec/models/test.rb:3:25: C: Layout/SpaceAroundEqualsInParameterDefault: Surrounding space missing in default value assignment.
  def log_msg(msg, level =:info, olevel=:error); end
                        ^^
spec/models/test.rb:3:39: C: Layout/SpaceAroundEqualsInParameterDefault: Surrounding space missing in default value assignment.
  def log_msg(msg, level=:info, olevel=:error); end
                                      ^

1 file inspected, 2 offenses detected, 2 offenses auto-correctable

Actual output:

Offenses:

spec/models/test.rb:3:25: C: Layout/SpaceAroundEqualsInParameterDefault: Surrounding space missing in default value assignment.
  def log_msg(msg, level =:info, olevel=:error); end
                        ^^

1 file inspected, 1 offense detected, 1 offense auto-correctable
$ [bundle exec] rubocop -V
0.92.0 (using Parser 2.7.1.5, rubocop-ast 0.6.0, running on ruby 2.5.0 x86_64-linux)
@jsmestad
Copy link

@rdunlop thanks! 👏

@koic koic closed this as completed in 990732c Sep 30, 2020
koic added a commit that referenced this issue Sep 30, 2020
…e_around_equals_in_parameter_default

[Fix #8801] Fix Layouts/SpaceAroundEqualsInParameterDefault
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants