Skip to content

Fix Rubocop DynamicFindBy excludes#5648

Merged
aduth merged 1 commit intomainfrom
aduth-fix-rubocop-dynamic-find-by-exclude
Nov 30, 2021
Merged

Fix Rubocop DynamicFindBy excludes#5648
aduth merged 1 commit intomainfrom
aduth-fix-rubocop-dynamic-find-by-exclude

Conversation

@aduth
Copy link
Contributor

@aduth aduth commented Nov 30, 2021

Why: The configuration was intended to allow the Capybara "page.find_by_id" method within feature specs. However, this wasn't working correctly for several reasons:

  • "Include" should have been "Exclude", to exempt feature specs while still enforcing elsewhere.
  • "AllowedMethods" is still called "Whitelist" in the version of Rubocop we use, so it was emitting a warning about invalid configuration.
  • The "Include" path was wrong, since we have our tests in "spec", not "tests"

The result of these is that the rule was not being applied anywhere, since it was only including files that don't actually exist in the project.

**Why**: The configuration was intended to allow the Capybara "page.find_by_id" method within feature specs. However, this wasn't working correctly for several reasons:

- "Include" should have been "Exclude", to exempt feature specs while still enforcing elsewhere.
- "AllowedMethods" is still called "Whitelist" in the version of Rubocop we use, so it was emitting a warning about invalid configuration.
- The "Include" path was wrong, since we have our tests in "spec", not "tests"

The result of these is that the rule was not being applied _anywhere_, since it was only including files that don't actually exist in the project.
Copy link
Contributor

@zachmargolis zachmargolis left a comment

Choose a reason for hiding this comment

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

LGTM

@aduth aduth merged commit 888ae62 into main Nov 30, 2021
@aduth aduth deleted the aduth-fix-rubocop-dynamic-find-by-exclude branch November 30, 2021 17:04
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.

3 participants