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

Enable cop for pending rubocop-performance #103

Merged
merged 1 commit into from
Feb 8, 2024
Merged

Enable cop for pending rubocop-performance #103

merged 1 commit into from
Feb 8, 2024

Conversation

ydah
Copy link
Member

@ydah ydah commented Feb 8, 2024

This PR enable cop for pending rubocop-performance and correct some offense.

❯ bundle exec rubocop
Inspecting 44 files
...................C.....................C..

Offenses:

lib/rubocop/cop/capybara/specific_finders.rb:109:22: C: [Correctable] Performance/MapCompact: Use filter_map instead.
          attrs.each.map do |key, value| ...
                     ^^^^^^^^^^^^^^^^^^^
spec/spec_helper.rb:17:9: C: Performance/MethodObjectAsBlock: Use block explicitly instead of block-passing a method object.
  .each(&method(:require))
        ^^^^^^^^^^^^^^^^^

44 files inspected, 2 offenses detected, 1 offense autocorrectable

Before submitting the PR make sure the following are checked:

  • Feature branch is up-to-date with main (if not - rebase it).
  • Squashed related commits together.
  • [-] Added tests.
  • [-] Updated documentation.
  • [-] Added an entry to the CHANGELOG.md if the new code introduces user-observable changes.
  • The build (bundle exec rake) passes (be sure to run this locally, since it may produce updated documentation that you will need to commit).

This PR enable cop for pending rubocop-performance and correct some offense.

```
❯ bundle exec rubocop
Inspecting 44 files
...................C.....................C..

Offenses:

lib/rubocop/cop/capybara/specific_finders.rb:109:22: C: [Correctable] Performance/MapCompact: Use filter_map instead.
          attrs.each.map do |key, value| ...
                     ^^^^^^^^^^^^^^^^^^^
spec/spec_helper.rb:17:9: C: Performance/MethodObjectAsBlock: Use block explicitly instead of block-passing a method object.
  .each(&method(:require))
        ^^^^^^^^^^^^^^^^^

44 files inspected, 2 offenses detected, 1 offense autocorrectable
```
@ydah ydah marked this pull request as ready for review February 8, 2024 11:40
@ydah ydah requested a review from a team as a code owner February 8, 2024 11:40
Copy link
Member

@pirj pirj left a comment

Choose a reason for hiding this comment

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

Thanks!

What it would take to enable all of the perf cops? We could pin the gem version in the gemfile like we do for rubocop?

@pirj pirj merged commit 9e4cfa7 into main Feb 8, 2024
25 checks passed
@pirj pirj deleted the performance branch February 8, 2024 13:30
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