KEMBAR78
[Fix #14370] Fix comment duplication bug in `Style/AccessorGrouping` separated autocorrect by r7kamura · Pull Request #14371 · rubocop/rubocop · GitHub
Skip to content

Conversation

@r7kamura
Copy link
Contributor

As stated in the title, this addresses the following issue:

The logic to prevent comments from being removed during autocorrect was introduced in the following change, so the bug likely dates back to that point:

When a method call does not have parentheses, its trailing comment appears to be associated with the last argument rather than the method call itself. As a result, it is possible for the end of the comment associated with send_node.last_argument to appear later in the source than the end of send_node itself.


Before submitting the PR make sure the following are checked:

  • The PR relates to only one subject with a clear title and description in grammatically correct, complete sentences.
  • Wrote good commit messages.
  • Commit message starts with [Fix #issue-number] (if the related issue exists).
  • Feature branch is up-to-date with master (if not - rebase it).
  • Squashed related commits together.
  • Added tests.
  • Ran bundle exec rake default. It executes all tests and runs RuboCop on its own code.
  • Added an entry (file) to the changelog folder named {change_type}_{change_description}.md if the new code introduces user-observable changes. See changelog entry format for details.

@koic koic merged commit a7c359f into rubocop:master Jul 17, 2025
24 checks passed
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

Successfully merging this pull request may close these issues.

Comments are duplicated during autocorrection by Style/AccessorGrouping

2 participants