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

Release 2.0 #1055

Merged
merged 37 commits into from Nov 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
5e8e32f
Require Rubocop >= 1.0
bquorning Oct 21, 2020
ccf11f7
Change department name of "nested" cops
pirj Aug 22, 2020
0f09adb
Merge pull request #1019 from rubocop-hq/uber-department
bquorning Oct 22, 2020
e4db5ec
Release v2.0.0-pre, compatible with RuboCop v1.0
bquorning Oct 22, 2020
28d7d9c
Merge pull request #1054 from rubocop-hq/release
bquorning Oct 22, 2020
ec9c8b9
Rename 2.0.0-pre to 2.0.0.pre
bquorning Oct 22, 2020
b08c95b
Retire TopLevelDescribe
pirj Jul 23, 2020
1af1ec2
Remove deprecated class ::RuboCop::Cop::RSpec::Cop
bquorning Jul 15, 2020
1b9b8a2
Merge pull request #968 from rubocop-hq/remove-old-cop-baseclass
bquorning Oct 22, 2020
15aa5d3
Merge pull request #978 from rubocop-hq/retire-top_level_describe
bquorning Oct 22, 2020
f2d59bb
Retire RSpec/InvalidPredicateMatcher
pirj Jun 18, 2020
21e4cb7
Merge pull request #940 from rubocop-hq/reture-invalid-predicate-cop
bquorning Oct 22, 2020
9f4d7fa
Add mixins folder
mockdeep Jun 19, 2020
45bd976
Use config context for all cop specs
sl4vr Aug 17, 2020
6a6a367
Fix find_all_in_scope method docs
sl4vr Aug 17, 2020
b42f401
Merge pull request #1060 from rubocop-hq/fix-documentation
pirj Oct 23, 2020
912ae66
Merge pull request #1056 from rubocop-hq/rf-mixins
pirj Oct 23, 2020
5e23ee2
Merge pull request #1059 from rubocop-hq/cop-specs-config-metadata
pirj Oct 23, 2020
9ea14b9
Refactor a spec
pirj Oct 27, 2020
abe73f0
Merge pull request #1064 from rubocop-hq/refactor-a-spec
pirj Oct 28, 2020
c758ebf
Stop using newly added cops
pirj Oct 28, 2020
d0588f2
Merge pull request #1065 from rubocop-hq/stop-using-edge-cops
bquorning Oct 28, 2020
4920879
Remove relevance detection code
pirj Oct 27, 2020
2cd7639
Merge pull request #1063 from rubocop-hq/remove-relevance-detection-code
bquorning Oct 29, 2020
e515d21
Implement dynamic matchers
sl4vr Aug 18, 2020
13cb62f
Merge pull request #956 from sl4vr/rspec-aliases_runtime-matchers
pirj Nov 3, 2020
2e3ed04
Remove customization from RSpec/EmptyExampleGroup
pirj Aug 19, 2020
a434245
Merge pull request #1007 from rubocop-hq/drop-empty-example-group-cus…
pirj Nov 3, 2020
06d6abd
Enable pending cop(s)
pirj Nov 3, 2020
9a5d604
Merge pull request #1071 from rubocop-hq/enable-pending-2.0-cops
pirj Nov 3, 2020
f3849e0
Add v2 update docs
pirj Aug 20, 2020
60afe4c
Clarify how to include several RuboCop extensions
pirj Aug 22, 2020
5a9714e
Fix shared example name
pirj Nov 3, 2020
c61929a
Use `case` instead of `if`
bquorning Nov 5, 2020
38be753
Merge pull request #1013 from rubocop-hq/add-v2-migration-docs
pirj Nov 5, 2020
cc09e7d
Merge pull request #1075 from rubocop-hq/refactor-top-level-group
Darhazer Nov 5, 2020
056ee5a
Bump version to 2.0.0
bquorning Nov 5, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .rubocop.yml
Expand Up @@ -8,7 +8,7 @@ require:
AllCops:
DisplayCopNames: true
TargetRubyVersion: 2.4
NewCops: enable
NewCops: disable
Exclude:
- 'vendor/**/*'
- 'spec/fixtures/**/*'
Expand Down
4 changes: 4 additions & 0 deletions .rubocop_todo.yml
Expand Up @@ -10,3 +10,7 @@
# Configuration parameters: CountComments, CountAsOne.
Metrics/ClassLength:
Max: 106

RSpec/ExampleLength:
Exclude:
- spec/rubocop/cop/rspec/factory_bot/attribute_defined_statically_spec.rb
17 changes: 16 additions & 1 deletion CHANGELOG.md
@@ -1,7 +1,21 @@
# Change log
# Changelog

## Master (Unreleased)

## 2.0.0 (2020-11-06)

* Remove deprecated class `::RuboCop::Cop::RSpec::Cop`. ([@bquorning][])
* Retire `RSpec/InvalidPredicateMatcher` cop. ([@pirj][])
* Remove the code responsible for filtering files to inspect. ([@pirj][])
* Make RSpec language elements configurable. ([@sl4vr][])
* Remove `CustomIncludeMethods` `RSpec/EmptyExampleGroup` option in favour of the new RSpec DSL configuration. ([@pirj][])
* Enabled pending cop (`RSpec/StubbedMock`). ([@pirj][])

## 2.0.0.pre (2020-10-22)

* Update RuboCop dependency to v1.0.0. ([@bquorning][])
* Change namespace of several cops (`Capybara/*` -> `RSpec/Capybara/*`, `FactoryBot/*` -> `RSpec/FactoryBot/*`, `Rails/*` -> `RSpec/Rails/*`). ([@pirj][], [@bquorning][])

## 1.44.1 (2020-10-20)

* Relax `rubocop-ast` version constraint. ([@PhilCoggins][])
Expand Down Expand Up @@ -571,3 +585,4 @@ Compatibility release so users can upgrade RuboCop to 0.51.0. No new features.
[@koic]: https://github.com/koic
[@Rafix02]: https://github.com/Rafix02
[@PhilCoggins]: https://github.com/PhilCoggins
[@sl4vr]: https://github.com/sl4vr
4 changes: 4 additions & 0 deletions README.md
Expand Up @@ -23,6 +23,10 @@ or if you use bundler put this in your `Gemfile`
gem 'rubocop-rspec', require: false
```

### Upgrading to RuboCop RSpec v2.x

Read all the details in our [Upgrade to Version 2.x](https://docs.rubocop.org/rubocop-rspec/2.0/upgrade_to_version_2.html) document.

## Usage

You need to tell RuboCop to load the RSpec extension. There are three
Expand Down
140 changes: 114 additions & 26 deletions config/default.yml
@@ -1,14 +1,85 @@
---
AllCops:
RSpec:
Patterns:
- _spec.rb
- "(?:^|/)spec/"
RSpec/FactoryBot:
Patterns:
- spec/factories.rb
- spec/factories/**/*.rb
- features/support/factories/**/*.rb
RSpec:
Include:
- "**/*_spec.rb"
- "**/spec/**/*"
Language:
ExampleGroups:
Regular:
- describe
- context
- feature
- example_group
Skipped:
- xdescribe
- xcontext
- xfeature
Focused:
- fdescribe
- fcontext
- ffeature
Examples:
Regular:
- it
- specify
- example
- scenario
- its
Focused:
- fit
- fspecify
- fexample
- fscenario
- focus
Skipped:
- xit
- xspecify
- xexample
- xscenario
- skip
Pending:
- pending
Expectations:
- expect
- is_expected
- expect_any_instance_of
Helpers:
- let
- let!
Hooks:
- prepend_before
- before
- append_before
- around
- prepend_after
- after
- append_after
HookScopes:
- each
- example
- context
- all
- suite
Includes:
Examples:
- it_behaves_like
- it_should_behave_like
- include_examples
Context:
- include_context
Runners:
- to
- to_not
- not_to
SharedGroups:
Examples:
- shared_examples
- shared_examples_for
Context:
- shared_context
Subjects:
- subject
- subject!

RSpec/AlignLeftLetBrace:
Description: Checks that left braces for adjacent single line lets are aligned.
Expand Down Expand Up @@ -136,8 +207,8 @@ RSpec/Dialect:
RSpec/EmptyExampleGroup:
Description: Checks if an example group does not include any tests.
Enabled: true
CustomIncludeMethods: []
VersionAdded: '1.7'
VersionChanged: '2.0'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyExampleGroup

RSpec/EmptyHook:
Expand Down Expand Up @@ -241,6 +312,9 @@ RSpec/ExpectOutput:
RSpec/FilePath:
Description: Checks that spec file paths are consistent and well-formed.
Enabled: true
Include:
- "**/*_spec*rb*"
- "**/spec/**/*"
CustomTransform:
RuboCop: rubocop
RSpec: rspec
Expand Down Expand Up @@ -315,12 +389,6 @@ RSpec/InstanceVariable:
VersionChanged: '1.7'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable

RSpec/InvalidPredicateMatcher:
Description: Checks invalid usage for predicate matcher.
Enabled: true
VersionAdded: '1.16'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InvalidPredicateMatcher

RSpec/ItBehavesLike:
Description: Checks that only one `it_behaves_like` style is used.
Enabled: true
Expand Down Expand Up @@ -561,7 +629,7 @@ RSpec/SingleArgumentMessageChain:

RSpec/StubbedMock:
Description: Checks that message expectations do not have a configured response.
Enabled: pending
Enabled: true
VersionAdded: '1.44'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/StubbedMock

Expand Down Expand Up @@ -620,54 +688,74 @@ RSpec/Yield:
VersionAdded: '1.32'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Yield

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

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

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

FactoryBot/AttributeDefinedStatically:
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.0'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/AttributeDefinedStatically

FactoryBot/CreateList:
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.0'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/CreateList

FactoryBot/FactoryClassName:
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.0'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/FactoryClassName

Rails/HttpStatus:
RSpec/Rails/HttpStatus:
Description: Enforces use of symbolic or numeric value to describe HTTP status.
Enabled: true
EnforcedStyle: symbolic
SupportedStyles:
- numeric
- symbolic
VersionAdded: '1.23'
VersionChanged: '2.0'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Rails/HttpStatus
2 changes: 1 addition & 1 deletion docs/antora.yml
@@ -1,5 +1,5 @@
name: rubocop-rspec
title: RuboCop RSpec
version: master
version: '2.0'
nav:
- modules/ROOT/nav.adoc
1 change: 1 addition & 0 deletions docs/modules/ROOT/nav.adoc
Expand Up @@ -2,6 +2,7 @@
* xref:installation.adoc[Installation]
* xref:usage.adoc[Usage]
* xref:cops.adoc[Cops]
* xref:upgrade_to_version_2.adoc[Upgrade to 2.x]
* Cops Documentation
** xref:cops_capybara.adoc[Capybara]
** xref:cops_factorybot.adoc[FactoryBot]
Expand Down
29 changes: 14 additions & 15 deletions docs/modules/ROOT/pages/cops.adoc
@@ -1,17 +1,5 @@
// START_COP_LIST

=== Department xref:cops_capybara.adoc[Capybara]

* xref:cops_capybara.adoc#capybaracurrentpathexpectation[Capybara/CurrentPathExpectation]
* xref:cops_capybara.adoc#capybarafeaturemethods[Capybara/FeatureMethods]
* xref:cops_capybara.adoc#capybaravisibilitymatcher[Capybara/VisibilityMatcher]

=== Department xref:cops_factorybot.adoc[FactoryBot]

* xref:cops_factorybot.adoc#factorybotattributedefinedstatically[FactoryBot/AttributeDefinedStatically]
* xref:cops_factorybot.adoc#factorybotcreatelist[FactoryBot/CreateList]
* xref:cops_factorybot.adoc#factorybotfactoryclassname[FactoryBot/FactoryClassName]

=== Department xref:cops_rspec.adoc[RSpec]

* xref:cops_rspec.adoc#rspecalignleftletbrace[RSpec/AlignLeftLetBrace]
Expand Down Expand Up @@ -52,7 +40,6 @@
* xref:cops_rspec.adoc#rspecimplicitsubject[RSpec/ImplicitSubject]
* xref:cops_rspec.adoc#rspecinstancespy[RSpec/InstanceSpy]
* xref:cops_rspec.adoc#rspecinstancevariable[RSpec/InstanceVariable]
* xref:cops_rspec.adoc#rspecinvalidpredicatematcher[RSpec/InvalidPredicateMatcher]
* xref:cops_rspec.adoc#rspecitbehaveslike[RSpec/ItBehavesLike]
* xref:cops_rspec.adoc#rspeciteratedexpectation[RSpec/IteratedExpectation]
* xref:cops_rspec.adoc#rspecleadingsubject[RSpec/LeadingSubject]
Expand Down Expand Up @@ -95,8 +82,20 @@
* xref:cops_rspec.adoc#rspecvoidexpect[RSpec/VoidExpect]
* xref:cops_rspec.adoc#rspecyield[RSpec/Yield]

=== Department xref:cops_rails.adoc[Rails]
=== 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/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/createlist[RSpec/FactoryBot/CreateList]
* xref:cops_rspec/factorybot.adoc#rspecfactorybot/factoryclassname[RSpec/FactoryBot/FactoryClassName]

=== Department xref:cops_rspec/rails.adoc[RSpec/Rails]

* xref:cops_rails.adoc#railshttpstatus[Rails/HttpStatus]
* xref:cops_rspec/rails.adoc#rspecrails/httpstatus[RSpec/Rails/HttpStatus]

// END_COP_LIST