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

Fix false negatives when public method is defined after a private one #10774

Merged
merged 1 commit into from Jun 30, 2022

Conversation

Darhazer
Copy link
Member

Similar to Rails/Delegate this cop was just checking the previous lines for a private declaration. This fails when there is a private method in a nested class, or as the added spec illustrates - when private methods are declared before the public ones


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 fix-documentation-comment-false-negatives branch from 6dec6be to 231fa5d Compare June 29, 2022 16:28
@@ -5,8 +5,7 @@ module Cop
# Common functionality for checking def nodes.
module DefNode
extend NodePattern::Macros

NON_PUBLIC_MODIFIERS = %w[private protected].freeze
include ::RuboCop::Cop::VisibilityHelp
Copy link
Member

Choose a reason for hiding this comment

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

Can you update it?

Suggested change
include ::RuboCop::Cop::VisibilityHelp
include VisibilityHelp

@Darhazer Darhazer force-pushed the fix-documentation-comment-false-negatives branch from 231fa5d to 8d02cda Compare June 29, 2022 17:21
@koic koic merged commit 5e82448 into master Jun 30, 2022
@koic koic deleted the fix-documentation-comment-false-negatives branch June 30, 2022 16:17
@koic
Copy link
Member

koic commented Jun 30, 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