Skip to content

Commit 08cc387

Browse files
committed
Enable our own pending RSpec cops
How I used Ruby to find the cop names: require "yaml" puts YAML.load_file("config/default.yml").select { |_name, config| config["Enabled"] == "pending" }.keys
1 parent 276ad6b commit 08cc387

File tree

4 files changed

+28
-2
lines changed

4 files changed

+28
-2
lines changed

.github/PULL_REQUEST_TEMPLATE.md

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ If you have created a new cop:
1515

1616
* [ ] Added the new cop to `config/default.yml`.
1717
* [ ] The cop is configured as `Enabled: pending` in `config/default.yml`.
18+
* [ ] The cop is configured as `Enabled: true` in `.rubocop.yml`.
1819
* [ ] The cop documents examples of good and bad code.
1920
* [ ] The tests assert both that bad code is reported and that good code is not reported.
2021
* [ ] Set `VersionAdded` in `default/config.yml` to the next minor version.

.rubocop.yml

+23
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,26 @@ RSpec/DescribeClass:
8484
Style/FormatStringToken:
8585
Exclude:
8686
- spec/rubocop/**/*.rb
87+
88+
# Enable our own pending cops.
89+
90+
RSpec/BeEq:
91+
Enabled: true
92+
RSpec/BeNil:
93+
Enabled: true
94+
RSpec/ChangeByZero:
95+
Enabled: true
96+
RSpec/ExcessiveDocstringSpacing:
97+
Enabled: true
98+
RSpec/IdenticalEqualityAssertion:
99+
Enabled: true
100+
RSpec/SubjectDeclaration:
101+
Enabled: true
102+
RSpec/VerifiedDoubleReference:
103+
Enabled: true
104+
RSpec/Capybara/SpecificMatcher:
105+
Enabled: true
106+
RSpec/FactoryBot/SyntaxMethods:
107+
Enabled: true
108+
RSpec/Rails/AvoidSetupHook:
109+
Enabled: true

spec/rubocop/cop/rspec/scattered_let_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# frozen_string_literal: true
22

33
RSpec.describe RuboCop::Cop::RSpec::ScatteredLet do
4-
it 'flags `let` after the first different node ' do
4+
it 'flags `let` after the first different node' do
55
expect_offense(<<-RUBY)
66
RSpec.describe User do
77
let(:a) { a }

spec/rubocop/rspec/example_spec.rb

+3-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def example(source)
3939
end
4040

4141
it 'returns nil for examples without doc strings' do
42-
expect(example('it { foo }').doc_string).to be(nil)
42+
expect(example('it { foo }').doc_string).to be_nil
4343
end
4444

4545
it 'extracts keywords' do
@@ -58,12 +58,14 @@ def example(source)
5858
end
5959

6060
describe 'value object semantics' do
61+
# rubocop:disable RSpec/IdenticalEqualityAssertion
6162
it 'compares by value' do
6263
aggregate_failures 'equality semantics' do
6364
expect(example('it("foo")')).to eq(example('it("foo")'))
6465
expect(example('it("foo")')).not_to eq(example('it("bar")'))
6566
end
6667
end
68+
# rubocop:enable RSpec/IdenticalEqualityAssertion
6769

6870
it 'can be used as a key in a hash' do
6971
hash = {}

0 commit comments

Comments
 (0)