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

Remove extracted cops in Capybara, FactoryBot and Rails departments. #1848

Merged
merged 1 commit into from
May 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Master (Unreleased)

- Remove extracted cops in `Capybara`, `FactoryBot` and `Rails` departments. ([@ydah])

## 2.29.2 (2024-05-02)

- Fix beginless and endless range bug for RepeatedIncludeExample cop. ([@hasghari])
Expand Down
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ task :build_config do
require 'rubocop/rspec/description_extractor'

glob = File.join('lib', 'rubocop', 'cop', 'rspec',
'{,capybara,factory_bot,rails}', '*.rb')
'{,capybara}', '*.rb')
# Due to YARD's sensitivity to file require order (as of 0.9.25),
# we have to prepend the list with our base cop, RuboCop::Cop::RSpec::Base.
# Otherwise, cop's parent class for cops loaded before our base cop class
Expand Down
200 changes: 0 additions & 200 deletions config/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1011,210 +1011,10 @@ RSpec/Capybara:
Include: *1
Language: *2

RSpec/Capybara/CurrentPathExpectation:
Description: Checks that no expectations are set on Capybara's `current_path`.
Enabled: true
VersionAdded: '1.18'
VersionChanged: '2.0'
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/CurrentPathExpectation

RSpec/Capybara/FeatureMethods:
Copy link
Member

Choose a reason for hiding this comment

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

Can we replace featuremethods with RSpec/Dialect configuration?
Would close a bunch of issues, too:
Uploading 01ADFB5F-F2D7-400B-AD48-8D4AEF039F11.jpeg…

Copy link
Collaborator

Choose a reason for hiding this comment

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

Good idea @pirj. I’ve added this as an issue in the 3.0 milestone.

Description: Checks for consistent method usage in feature specs.
Enabled: true
EnabledMethods: []
VersionAdded: '1.17'
VersionChanged: '2.0'
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/FeatureMethods

RSpec/Capybara/MatchStyle:
Description: Checks for usage of deprecated style methods.
Enabled: pending
VersionAdded: '2.17'
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/MatchStyle

RSpec/Capybara/NegationMatcher:
Description: Enforces use of `have_no_*` or `not_to` for negated expectations.
Enabled: pending
VersionAdded: '2.14'
EnforcedStyle: not_to
SupportedStyles:
- have_no
- not_to
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/NegationMatcher

RSpec/Capybara/SpecificActions:
Description: Checks for there is a more specific actions offered by Capybara.
Enabled: pending
VersionAdded: '2.14'
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/SpecificActions

RSpec/Capybara/SpecificFinders:
Description: Checks if there is a more specific finder offered by Capybara.
Enabled: pending
VersionAdded: '2.13'
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/SpecificFinders

RSpec/Capybara/SpecificMatcher:
Description: Checks for there is a more specific matcher offered by Capybara.
Enabled: pending
VersionAdded: '2.12'
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/SpecificMatcher

RSpec/Capybara/VisibilityMatcher:
Description: Checks for boolean visibility in Capybara finders.
Enabled: true
VersionAdded: '1.39'
VersionChanged: '2.0'
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/VisibilityMatcher

RSpec/FactoryBot:
Enabled: true
Include: *1
Language: *2

RSpec/FactoryBot/AttributeDefinedStatically:
Description: Always declare attribute values as blocks.
Enabled: true
Include:
- "**/spec/factories.rb"
- "**/spec/factories/**/*.rb"
- "**/features/support/factories/**/*.rb"
VersionAdded: '1.28'
VersionChanged: '2.23'
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/AttributeDefinedStatically

RSpec/FactoryBot/ConsistentParenthesesStyle:
Description: Use a consistent style for parentheses in factory bot calls.
Enabled: pending
EnforcedStyle: require_parentheses
SupportedStyles:
- require_parentheses
- omit_parentheses
VersionAdded: '2.14'
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/ConsistentParenthesesStyle

RSpec/FactoryBot/CreateList:
Description: Checks for create_list usage.
Enabled: true
Include:
- "**/*_spec.rb"
- "**/spec/**/*"
- "**/spec/factories.rb"
- "**/spec/factories/**/*.rb"
- "**/features/support/factories/**/*.rb"
EnforcedStyle: create_list
SupportedStyles:
- create_list
- n_times
VersionAdded: '1.25'
VersionChanged: '2.23'
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/CreateList

RSpec/FactoryBot/FactoryClassName:
Description: Use string value when setting the class attribute explicitly.
Enabled: true
Include:
- "**/spec/factories.rb"
- "**/spec/factories/**/*.rb"
- "**/features/support/factories/**/*.rb"
VersionAdded: '1.37'
VersionChanged: '2.23'
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/FactoryClassName

RSpec/FactoryBot/FactoryNameStyle:
Description: Checks for name style for argument of FactoryBot::Syntax::Methods.
Enabled: pending
VersionAdded: '2.16'
EnforcedStyle: symbol
SupportedStyles:
- symbol
- string
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/FactoryNameStyle

RSpec/FactoryBot/SyntaxMethods:
Description: Use shorthands from `FactoryBot::Syntax::Methods` in your specs.
Enabled: pending
SafeAutoCorrect: false
VersionAdded: '2.7'
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/SyntaxMethods

RSpec/Rails:
Enabled: true
Include: *1
Language: *2

RSpec/Rails/AvoidSetupHook:
Description: Checks that tests use RSpec `before` hook over Rails `setup` method.
Enabled: pending
VersionAdded: '2.4'
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Rails/AvoidSetupHook

RSpec/Rails/HaveHttpStatus:
Description: Checks that tests use `have_http_status` instead of equality matchers.
Enabled: pending
ResponseMethods:
- response
- last_response
SafeAutoCorrect: false
VersionAdded: '2.12'
VersionChanged: '2.27'
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Rails/HaveHttpStatus

RSpec/Rails/HttpStatus:
Description: Enforces use of symbolic or numeric value to describe HTTP status.
Enabled: true
EnforcedStyle: symbolic
SupportedStyles:
- numeric
- symbolic
- be_status
VersionAdded: '1.23'
VersionChanged: '2.20'
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Rails/HttpStatus

RSpec/Rails/InferredSpecType:
Description: Identifies redundant spec type.
Enabled: pending
Safe: false
VersionAdded: '2.14'
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Rails/InferredSpecType
Inferences:
channels: channel
controllers: controller
features: feature
generator: generator
helpers: helper
jobs: job
mailboxes: mailbox
mailers: mailer
models: model
requests: request
integration: request
api: request
routing: routing
system: system
views: view

RSpec/Rails/MinitestAssertions:
Description: Check if using Minitest-like matchers.
Enabled: pending
VersionAdded: '2.17'
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Rails/MinitestAssertions

RSpec/Rails/NegationBeValid:
Description: Enforces use of `be_invalid` or `not_to` for negated be_valid.
Safe: false
EnforcedStyle: not_to
SupportedStyles:
- not_to
- be_invalid
Enabled: pending
VersionAdded: '2.23'
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Rails/NegationBeValid

RSpec/Rails/TravelAround:
Description: Prefer to travel in `before` rather than `around`.
Enabled: pending
Safe: false
VersionAdded: '2.19'
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Rails/TravelAround
5 changes: 1 addition & 4 deletions docs/modules/ROOT/nav.adoc
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
* xref:index.adoc[Home]
* xref:installation.adoc[Installation]
* xref:usage.adoc[Usage]
* xref:departments.adoc[Departments]
* xref:cops.adoc[Cops]
* xref:upgrade_to_version_2.adoc[Upgrade to 2.x]
* xref:upgrade_to_version_3.adoc[Upgrade to 3.x]
* xref:third_party_rspec_syntax_extensions.adoc[RSpec syntax extensions in third-party gems]
* xref:development.adoc[Development]
* Cops Documentation
** xref:cops_rspec_capybara.adoc[Capybara]
** xref:cops_rspec_factorybot.adoc[FactoryBot]
** xref:cops_rspec_rails.adoc[Rails]
** xref:cops_rspec.adoc[RSpec]
26 changes: 0 additions & 26 deletions docs/modules/ROOT/pages/cops.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -114,32 +114,6 @@

=== Department xref:cops_rspec_capybara.adoc[RSpec/Capybara]

* xref:cops_rspec_capybara.adoc#rspeccapybara/currentpathexpectation[RSpec/Capybara/CurrentPathExpectation]
* xref:cops_rspec_capybara.adoc#rspeccapybara/featuremethods[RSpec/Capybara/FeatureMethods]
* xref:cops_rspec_capybara.adoc#rspeccapybara/matchstyle[RSpec/Capybara/MatchStyle]
* xref:cops_rspec_capybara.adoc#rspeccapybara/negationmatcher[RSpec/Capybara/NegationMatcher]
* xref:cops_rspec_capybara.adoc#rspeccapybara/specificactions[RSpec/Capybara/SpecificActions]
* xref:cops_rspec_capybara.adoc#rspeccapybara/specificfinders[RSpec/Capybara/SpecificFinders]
* xref:cops_rspec_capybara.adoc#rspeccapybara/specificmatcher[RSpec/Capybara/SpecificMatcher]
* xref:cops_rspec_capybara.adoc#rspeccapybara/visibilitymatcher[RSpec/Capybara/VisibilityMatcher]

=== Department xref:cops_rspec_factorybot.adoc[RSpec/FactoryBot]

* xref:cops_rspec_factorybot.adoc#rspecfactorybot/attributedefinedstatically[RSpec/FactoryBot/AttributeDefinedStatically]
* xref:cops_rspec_factorybot.adoc#rspecfactorybot/consistentparenthesesstyle[RSpec/FactoryBot/ConsistentParenthesesStyle]
* xref:cops_rspec_factorybot.adoc#rspecfactorybot/createlist[RSpec/FactoryBot/CreateList]
* xref:cops_rspec_factorybot.adoc#rspecfactorybot/factoryclassname[RSpec/FactoryBot/FactoryClassName]
* xref:cops_rspec_factorybot.adoc#rspecfactorybot/factorynamestyle[RSpec/FactoryBot/FactoryNameStyle]
* xref:cops_rspec_factorybot.adoc#rspecfactorybot/syntaxmethods[RSpec/FactoryBot/SyntaxMethods]

=== Department xref:cops_rspec_rails.adoc[RSpec/Rails]

* xref:cops_rspec_rails.adoc#rspecrails/avoidsetuphook[RSpec/Rails/AvoidSetupHook]
* xref:cops_rspec_rails.adoc#rspecrails/havehttpstatus[RSpec/Rails/HaveHttpStatus]
* xref:cops_rspec_rails.adoc#rspecrails/httpstatus[RSpec/Rails/HttpStatus]
* xref:cops_rspec_rails.adoc#rspecrails/inferredspectype[RSpec/Rails/InferredSpecType]
* xref:cops_rspec_rails.adoc#rspecrails/minitestassertions[RSpec/Rails/MinitestAssertions]
* xref:cops_rspec_rails.adoc#rspecrails/negationbevalid[RSpec/Rails/NegationBeValid]
* xref:cops_rspec_rails.adoc#rspecrails/travelaround[RSpec/Rails/TravelAround]

// END_COP_LIST
Loading