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 new Capybara/RedundantWithinFind cop #77

Merged
merged 2 commits into from
Dec 11, 2023
Merged

Add new Capybara/RedundantWithinFind cop #77

merged 2 commits into from
Dec 11, 2023

Conversation

ydah
Copy link
Member

@ydah ydah commented Oct 2, 2023

Resolve: #75


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

If you have created a new cop:

  • Added the new cop to config/default.yml.
  • The cop is configured as Enabled: pending in config/default.yml.
  • The cop documents examples of good and bad code.
  • The tests assert both that bad code is reported and that good code is not reported.
  • Set VersionAdded: "<<next>>" in default/config.yml.

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.

Looks flawless. Thank you!
I’m away from my computer. Can you please run this against real-world-rspec?

@bquorning
Copy link
Contributor

Can you please run this against real-world-rspec?

Why don’t we make a GitHub Action that tests the branch against real-world-rspec, e.g. when a certain label is added to the PR?

@pirj
Copy link
Member

pirj commented Nov 22, 2023

It breaks quite frequently. Primary branch naming changes, removed repos, renamed repos, etc. With submodules, it’s a pita to keep it up to date. I just have something checked out on my local. Checking out each time as a GHA would do would most certainly break often.
Apart from that, rubocop configs should be removed. And —only <cop> sometimes failed, e.g. for rubocop-factory_girl and rubocop-capybara, where new cops don’t make their way to .rubocop.yml, only to config/defaults.yml

@ydah
Copy link
Member Author

ydah commented Dec 10, 2023

I ran it through RSpec on a large Rails app and it seemed to work fine:

❯ bundle exec rubocop --only Capybara/RedundantWithinFind -A
Inspecting 11985 files
(snip)
11985 files inspected, 347 offenses detected, 347 offenses corrected

@ydah ydah merged commit 816fa4b into main Dec 11, 2023
23 checks passed
@ydah ydah deleted the feature/75 branch December 11, 2023 01:56
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.

Cop idea: Redundant within find('foo')
3 participants