rubocop / rubocop-capybara

Code style checking for Capybara files.
https://docs.rubocop.org/rubocop-capybara
MIT License
41 stars 8 forks source link

Fix a rubocop offense #133

Closed ydah closed 3 weeks ago

ydah commented 3 weeks ago

This PR fixes a rubocop offense for InternalAffairs/UndefinedConfig

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

Offenses:

lib/rubocop/cop/capybara/rspec/have_selector.rb:81:30: C: InternalAffairs/UndefinedConfig: DefaultSelector is not defined in the configuration for Capybara/RSpec/HaveSelector in config/default.yml.
            cop_config.fetch('DefaultSelector', 'css')
                             ^^^^^^^^^^^^^^^^^

50 files inspected, 1 offense detected

Before submitting the PR make sure the following are checked:

pirj commented 3 weeks ago

So we have to eat our own dogfood? Does this make sense? We have no capybara code here. I imagine the same will hit rubocop-minitest and rubocop-md, and rubocop-factory_bot, and other. It’s for rubocop itself and rubocop-rspec where this makes sense.

It’s an internal cop, shouldn’t it be looking in config/default.yml for this? Is it possible to fix the cop instead?

Earlopain commented 3 weeks ago

Sounds reasonable, I openend https://github.com/rubocop/rubocop/pull/13141 which would make this PR unnessesary. Let me know if something in that PR looks strange. It does indeed affect rubocop-factory_bot as well.