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

Add InternalAffairs/NodeFirstOrLastArgument cop #12305

Merged
merged 1 commit into from Nov 5, 2023

Conversation

sambostock
Copy link
Contributor

@sambostock sambostock commented Oct 24, 2023

This cop checks for node.arguments.first and node.arguments.last, and corrects them to node.first_argument and node.last_argument, respectively.

Motivation for rubocop/rubocop-ast#270.


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.

@sambostock sambostock force-pushed the node-first-or-last-argument branch 2 times, most recently from 4566d69 to fd65d98 Compare October 24, 2023 03:14
rubocop.gemspec Outdated Show resolved Hide resolved
@sambostock sambostock force-pushed the node-first-or-last-argument branch 2 times, most recently from bd17210 to 81eef26 Compare October 29, 2023 23:10
@koic
Copy link
Member

koic commented Oct 30, 2023

Can you squash your commits into one?

@@ -0,0 +1 @@
* [#12305](https://github.com/rubocop/rubocop/pull/12305): Require `rubocop-ast` version 1.30 or greater. ([@sambostock][])
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 rename changelog/new_add_internal_affairs_node_first_or_last_argument.md to changelog/change_require_rubocop_ast_version_1_30_or_greater.md?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done!

This cop checks for `node.arguments.first` and `node.arguments.last`,
and corrects them to `node.first_argument` and `node.last_argument`,
respectively.

Version 1.30 of `rubocop-ast` adds support for `first_argument` on block
nodes, and is therefore required for this cop not to produce false
positives for those node types.
@sambostock sambostock requested a review from koic October 30, 2023 14:31
@bbatsov bbatsov merged commit d3fb79b into rubocop:master Nov 5, 2023
28 checks passed
@bbatsov
Copy link
Collaborator

bbatsov commented Nov 5, 2023

Seems we were quite consistent even before this change, but I don't mind it. Thanks!

koic added a commit to koic/rubocop-rails that referenced this pull request Nov 5, 2023
koic added a commit to koic/rubocop-performance that referenced this pull request Nov 5, 2023
koic added a commit to koic/rubocop-minitest that referenced this pull request Nov 5, 2023
koic added a commit to koic/rubocop-minitest that referenced this pull request Nov 27, 2023
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

3 participants