For example, when running autocorrect with the following configuration:
Style/AccessorGrouping: EnforcedStyle: separated
# frozen_string_literal: true class Foo attr_reader :a, # a :b # b end
In this case, the expected change was as follows:
# frozen_string_literal: true class Foo # a attr_reader :a # b attr_reader :b endActual behavior
The trailing comment ends up duplicated as shown below:
# frozen_string_literal: true class Foo # a attr_reader :a # b attr_reader :b # b end
It seems that when the original code spans multiple lines without parentheses, the trailing comment gets duplicated.
Steps to reproduce the problemThe issue can be easily reproduced by running autocorrect with the code and configuration described above.
RuboCop version$ bundle exec rubocop -V
1.78.0 (using Parser 3.3.8.0, rubocop-ast 1.45.1, analyzing as Ruby 2.7, running on ruby 3.4.2) [x86_64-linux]
- rubocop-performance 1.25.0
- rubocop-rake 0.7.1
- rubocop-rspec 3.6.0
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4