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

Consider only the comments relevant for the node being checked #10491

Merged
merged 1 commit into from Apr 1, 2022

Conversation

Darhazer
Copy link
Contributor

@Darhazer Darhazer commented Mar 30, 2022

This fixes the remaining issue in #7999 and also the same issue appearing in 2 other cops: Lint/EmptyConditionalBody and Lint/EmptyInPattern


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.

@Darhazer Darhazer force-pushed the improve-comment-handling branch from 9f22036 to aa5ec17 Compare Mar 30, 2022
CHANGELOG.md Outdated
@@ -2,6 +2,8 @@

## master (unreleased)

* [#10491](https://github.com/rubocop/rubocop/pull/10491): Improve the handling of comments in `Lint/EmptyConditionalBody`, `Lint/EmptyInPattern` and `Lint/EmptyWhen` when `AllowComments` is set to `true`. ([@Darhazer][])
Copy link
Member

@koic koic Mar 30, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you use the following way instead?

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.

Copy link
Contributor Author

@Darhazer Darhazer Mar 30, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. Sorry I was away from rubocop for way too long 👋

@Darhazer Darhazer force-pushed the improve-comment-handling branch from a7ab618 to c1788be Compare Mar 30, 2022
@koic koic merged commit fc9018f into master Apr 1, 2022
34 checks passed
@koic koic deleted the improve-comment-handling branch Apr 1, 2022
@koic
Copy link
Member

koic commented Apr 1, 2022

Thanks!

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.

None yet

2 participants