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 #12296] Support Redundant*Names options for Style/ArgumentsForwarding #12397

Conversation

koic
Copy link
Member

@koic koic commented Nov 17, 2023

Fixes #12296.

This PR supports RedundantRestArgumentNames, RedundantKeywordRestArgumentNames, and RedundantBlockArgumentNames options for Style/ArgumentsForwarding.

Meaningless names that are commonly used can be anonymized by default as part of the new Redundant*Names defaults. e.g., *args, **options, &block, and some argument names.

Names not on this list are likely to be meaningful and are allowed by default.

This approach is designed to only detect generally meaningless names without the need for users to edit the configuration for each meaningful name, with the expectation that the default settings will work well for most cases.


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.

@nevans
Copy link
Contributor

nevans commented Nov 17, 2023

@koic this is great, thanks. 😀

@@ -3089,7 +3089,19 @@ Style/ArgumentsForwarding:
Enabled: pending
AllowOnlyRestArgument: true
UseAnonymousForwarding: true
ForbiddenRestArgumentNames:
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 "Redundant" is probably a better word than "Forbidden" for the purpose of this cop.

@koic koic changed the title [Fix #12296] Support Forbidden*Names options for Style/ArgumentsForwarding [Fix #12296] Support Redundant*Names options for Style/ArgumentsForwarding Nov 20, 2023
@koic koic force-pushed the support_fobidden_options_for_style_arguments_forwarding branch 6 times, most recently from 5b0a7c8 to 231ce09 Compare November 20, 2023 09:38
…mentsForwarding`

Fixes rubocop#12296.

This PR supports `RedundantRestArgumentNames`, `RedundantKeywordRestArgumentNames`,
and `RedundantBlockArgumentNames` options for `Style/ArgumentsForwarding`.

Meaningless names that are commonly used can be anonymized by default as part of the new `Redundant*Names` defaults.
e.g., `*args`, `**options`, `&block`, and some argument names.

Names not on this list are likely to be meaningful and are allowed by default.

This approach is designed to only detect generally meaningless names without the need for users to edit the configuration
for each meaningful name, with the expectation that the default settings will work well for most cases.
@koic koic force-pushed the support_fobidden_options_for_style_arguments_forwarding branch from 231ce09 to 9b108a4 Compare November 20, 2023 09:39
@bbatsov bbatsov merged commit 10c8d32 into rubocop:master Nov 20, 2023
29 checks passed
@koic koic deleted the support_fobidden_options_for_style_arguments_forwarding branch November 20, 2023 18:08
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.

Style/ArgumentsForwarding` should allow or forbid specific argument names
3 participants