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 rubocop#10969] Allow Lint/AmbiguousBlockAssociation `AllowedPa… #10970

Merged
merged 1 commit into from Aug 29, 2022

Conversation

jcalvert
Copy link
Contributor

[Fix #10969] Allow Lint/AmbiguousBlockAssociation AllowedPattern to match on

send_node.source instead of method_name


  • 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.

@@ -81,7 +81,7 @@ def ambiguous_block_association?(send_node)
def allowed_method_pattern?(node)
node.assignment? || node.operator_method? || node.method?(:[]) ||
allowed_method?(node.last_argument.method_name) ||
Copy link
Member

Choose a reason for hiding this comment

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

How about the same problem with AllowedMethods?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think there it's fine to match on the name. Generally, it's a bit unclear which patterns would need to match on the entire send node's source.

Copy link
Member

@koic koic Aug 27, 2022

Choose a reason for hiding this comment

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

AllowedMethods and AllowedPatterns have different uses, so AllowedMethods seems fine.

@bbatsov
Copy link
Collaborator

bbatsov commented Aug 29, 2022

I'm planning to cut a new release very soon, so it'd be nice to update this changelog entry and wrap up this bugfix in time for the next release.

@jcalvert jcalvert force-pushed the fix/10969 branch 2 times, most recently from fa047b5 to 525cff1 Compare August 29, 2022 14:29
@jcalvert
Copy link
Contributor Author

Please let me know if I should make any further changes. Thank you. 🙇

…ttern` to match on

`send_node.source` instead of `method_name`.
@koic koic merged commit a63fd6d into rubocop:master Aug 29, 2022
@koic
Copy link
Member

koic commented Aug 29, 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.

Lint/AmbiguousBlockAssociation Pattern Matching Regression
4 participants