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
Style/HashEachMethods: Detect use of .each
+ _
variables
#12370
Labels
Comments
8 tasks
koic
added a commit
to koic/rubocop
that referenced
this issue
Nov 21, 2023
…k value Fixes rubocop#12370. This PR makes `Style/HashEachMethods` aware of unused block value. And this PR suppresses the following new offense in this repository: ```console $ bundle exec rubocop --only Style/HashEachMethods -A (snip) Offenses: lib/rubocop/cop/style/bisected_attr_accessor.rb:36:11: C: [Corrected] Style/HashEachMethods: Use each_value instead of each, and remove the unused _visibility block argument. find_macros(class_node.body).each do |_visibility, macros| ... ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1519 files inspected, 1 offense detected, 1 offense corrected ```
bbatsov
pushed a commit
that referenced
this issue
Nov 21, 2023
Fixes #12370. This PR makes `Style/HashEachMethods` aware of unused block value. And this PR suppresses the following new offense in this repository: ```console $ bundle exec rubocop --only Style/HashEachMethods -A (snip) Offenses: lib/rubocop/cop/style/bisected_attr_accessor.rb:36:11: C: [Corrected] Style/HashEachMethods: Use each_value instead of each, and remove the unused _visibility block argument. find_macros(class_node.body).each do |_visibility, macros| ... ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1519 files inspected, 1 offense detected, 1 offense corrected ```
kachick
added a commit
to kachick/ruby-ulid
that referenced
this issue
Dec 4, 2023
Personally I will not be happy with this cop, I intentionally specified _ variables But no motivation to change it for now... rubocop/rubocop#12370
kachick
added a commit
to kachick/ruby-ulid
that referenced
this issue
Dec 4, 2023
This reverts commit c321e03. It is not a Hash, false positive detection by rubocop rubocop/rubocop#12370
kachick
added a commit
to kachick/ruby-ulid
that referenced
this issue
Dec 4, 2023
* Bump the rubocop-dependencies group with 1 update Updates the requirements on [rubocop](https://github.com/rubocop/rubocop) to permit the latest version. - [Release notes](https://github.com/rubocop/rubocop/releases) - [Changelog](https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md) - [Commits](rubocop/rubocop@v1.57.2...v1.58.0) --- updated-dependencies: - dependency-name: rubocop dependency-type: direct:development dependency-group: rubocop-dependencies ... Signed-off-by: dependabot[bot] <support@github.com> * `bundle exec rubocop -A` Personally I will not be happy with this cop, I intentionally specified _ variables But no motivation to change it for now... rubocop/rubocop#12370 * Revert "`bundle exec rubocop -A`" This reverts commit c321e03. It is not a Hash, false positive detection by rubocop rubocop/rubocop#12370 * Suppress wrong rubocop warnings with parentheses --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Kenichi Kamiya <kachick1@gmail.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is your feature request related to a problem? Please describe.
Let
Style/HashEachMethods
flag code like:Describe the solution you'd like
The cop should suggest faster alternatives to
each
when used with underscore variables.Describe alternatives you've considered
Alternatively, we could create a new cop rule but I feel it be a nice extension to
Style/HashEachMethods
.Additional context
Potential impact on projects done via
rg "each do \|(_(\w+)?, \w+|\w+, _(\w+)?)\|"
.RuboCop
GitLab
The text was updated successfully, but these errors were encountered: