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

Enable pending cops – prepare for v3.0.0 release. #1245

Closed
wants to merge 1 commit into from
Closed
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)

* Enabled pending cops (`RSpec/BeEq`, `RSpec/BeNil`, `RSpec/ExcessiveDocstringSpacing`, `RSpec/IdenticalEqualityAssertion`, `RSpec/SubjectDeclaration`, `RSpec/FactoryBot/SyntaxMethods`, and `RSpec/Rails/AvoidSetupHook`). ([@bquorning][])

## 2.9.0 (2022-02-28)

* Add new `RSpec/BeNil` cop. ([@bquorning][])
Expand Down
14 changes: 7 additions & 7 deletions config/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ RSpec/Be:

RSpec/BeEq:
Description: Check for expectations where `be(...)` can replace `eq(...)`.
Enabled: pending
Enabled: true
VersionAdded: 2.9.0
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/BeEq

Expand All @@ -156,7 +156,7 @@ RSpec/BeEql:

RSpec/BeNil:
Description: Check that `be_nil` is used instead of `be(nil)`.
Enabled: pending
Enabled: true
VersionAdded: 2.9.0
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/BeNil

Expand Down Expand Up @@ -328,7 +328,7 @@ RSpec/ExampleWithoutDescription:

RSpec/ExcessiveDocstringSpacing:
Description: Checks for excessive whitespace in example descriptions.
Enabled: pending
Enabled: true
VersionAdded: '2.5'
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExcessiveDocstringSpacing

Expand Down Expand Up @@ -420,7 +420,7 @@ RSpec/HooksBeforeExamples:

RSpec/IdenticalEqualityAssertion:
Description: Checks for equality assertions with identical expressions on both sides.
Enabled: pending
Enabled: true
VersionAdded: '2.4'
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/IdenticalEqualityAssertion

Expand Down Expand Up @@ -721,7 +721,7 @@ RSpec/StubbedMock:

RSpec/SubjectDeclaration:
Description: Ensure that subject is defined using subject helper.
Enabled: pending
Enabled: true
VersionAdded: '2.5'
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SubjectDeclaration

Expand Down Expand Up @@ -856,7 +856,7 @@ RSpec/FactoryBot/FactoryClassName:

RSpec/FactoryBot/SyntaxMethods:
Description: Use shorthands from `FactoryBot::Syntax::Methods` in your specs.
Enabled: pending
Enabled: true
SafeAutoCorrect: false
VersionAdded: '2.7'
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/SyntaxMethods
Expand All @@ -868,7 +868,7 @@ RSpec/Rails:

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

Expand Down
10 changes: 5 additions & 5 deletions docs/modules/ROOT/pages/cops_rspec.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ expect(foo).to be(true)
|===
| Enabled by default | Safe | Supports autocorrection | Version Added | Version Changed

| Pending
| Enabled
| Yes
| Yes
| 2.9.0
Expand Down Expand Up @@ -279,7 +279,7 @@ expect(foo).to be(nil)
|===
| Enabled by default | Safe | Supports autocorrection | Version Added | Version Changed

| Pending
| Enabled
| Yes
| Yes
| 2.9.0
Expand Down Expand Up @@ -1359,7 +1359,7 @@ end
|===
| Enabled by default | Safe | Supports autocorrection | Version Added | Version Changed

| Pending
| Enabled
| Yes
| Yes
| 2.5
Expand Down Expand Up @@ -1852,7 +1852,7 @@ end
|===
| Enabled by default | Safe | Supports autocorrection | Version Added | Version Changed

| Pending
| Enabled
| Yes
| No
| 2.4
Expand Down Expand Up @@ -4025,7 +4025,7 @@ expect(foo).to receive(:bar).with(42)
|===
| Enabled by default | Safe | Supports autocorrection | Version Added | Version Changed

| Pending
| Enabled
| Yes
| No
| 2.5
Expand Down
2 changes: 1 addition & 1 deletion docs/modules/ROOT/pages/cops_rspec_factorybot.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ end
|===
| Enabled by default | Safe | Supports autocorrection | Version Added | Version Changed

| Pending
| Enabled
| Yes
| Yes (Unsafe)
| 2.7
Expand Down
2 changes: 1 addition & 1 deletion docs/modules/ROOT/pages/cops_rspec_rails.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
|===
| Enabled by default | Safe | Supports autocorrection | Version Added | Version Changed

| Pending
| Enabled
| Yes
| Yes
| 2.4
Expand Down
2 changes: 1 addition & 1 deletion spec/rubocop/cop/rspec/scattered_let_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

RSpec.describe RuboCop::Cop::RSpec::ScatteredLet do
it 'flags `let` after the first different node ' do
it 'flags `let` after the first different node' do
expect_offense(<<-RUBY)
RSpec.describe User do
let(:a) { a }
Expand Down
4 changes: 3 additions & 1 deletion spec/rubocop/rspec/example_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def example(source)
end

it 'returns nil for examples without doc strings' do
expect(example('it { foo }').doc_string).to be(nil)
expect(example('it { foo }').doc_string).to be_nil
end

it 'extracts keywords' do
Expand All @@ -58,12 +58,14 @@ def example(source)
end

describe 'value object semantics' do
# rubocop:disable RSpec/IdenticalEqualityAssertion
it 'compares by value' do
aggregate_failures 'equality semantics' do
expect(example('it("foo")')).to eq(example('it("foo")'))
expect(example('it("foo")')).not_to eq(example('it("bar")'))
end
end
# rubocop:enable RSpec/IdenticalEqualityAssertion

it 'can be used as a key in a hash' do
hash = {}
Expand Down