File tree Expand file tree Collapse file tree 6 files changed +40
-15
lines changed Expand file tree Collapse file tree 6 files changed +40
-15
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ If you have created a new cop:
15
15
16
16
* [ ] Added the new cop to ` config/default.yml ` .
17
17
* [ ] The cop is configured as ` Enabled: pending ` in ` config/default.yml ` .
18
+ * [ ] The cop is configured as ` Enabled: true ` in ` .rubocop.yml ` .
18
19
* [ ] The cop documents examples of good and bad code.
19
20
* [ ] The tests assert both that bad code is reported and that good code is not reported.
20
21
* [ ] Set ` VersionAdded ` in ` default/config.yml ` to the next minor version.
Original file line number Diff line number Diff line change @@ -14,9 +14,13 @@ AllCops:
14
14
- ' tmp/**/*'
15
15
- ' spec/smoke_tests/**/*.rb'
16
16
17
- # See https://github.com/rubocop/rubocop/issues/6410
18
17
Layout/HashAlignment :
19
- Enabled : false
18
+ EnforcedHashRocketStyle :
19
+ - key
20
+ - table
21
+ EnforcedColonStyle :
22
+ - key
23
+ - table
20
24
21
25
Layout/LineLength :
22
26
Max : 80 # default: 120
@@ -29,11 +33,6 @@ Layout/MultilineMethodCallIndentation:
29
33
Layout/MultilineOperationIndentation :
30
34
EnforcedStyle : indented
31
35
32
- Lint/BooleanSymbol :
33
- Exclude :
34
- - lib/rubocop/cop/rspec/expect_actual.rb
35
- - lib/rubocop/cop/rspec/focus.rb
36
-
37
36
Lint/InterpolationCheck :
38
37
Exclude :
39
38
- spec/**/*.rb
@@ -85,3 +84,26 @@ RSpec/DescribeClass:
85
84
Style/FormatStringToken :
86
85
Exclude :
87
86
- 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
Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ def on_block(node)
35
35
occurrences . each do |occurrence |
36
36
lines_except_current = lines - [ occurrence . first_line ]
37
37
message = format ( MSG , hook_name : occurrences . first . method_name ,
38
- lines : lines_msg ( lines_except_current ) )
38
+ lines : lines_msg ( lines_except_current ) )
39
39
add_offense ( occurrence , message : message )
40
40
end
41
41
end
Original file line number Diff line number Diff line change 1
1
# frozen_string_literal: true
2
2
3
3
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
5
5
expect_offense ( <<-RUBY )
6
6
RSpec.describe User do
7
7
let(:a) { a }
Original file line number Diff line number Diff line change 9
9
'Setting' => 'forty two'
10
10
} ,
11
11
'RSpec/Foo' => {
12
- 'Config' => 2 ,
13
- 'Enabled' => true
12
+ 'Config' => 2 ,
13
+ 'Enabled' => true
14
14
} ,
15
15
'RSpec/Bar' => {
16
- 'Enabled' => true
16
+ 'Enabled' => true
17
17
} ,
18
18
'RSpec/Baz' => {
19
- 'Enabled' => true ,
20
- 'StyleGuide' => '#buzz'
19
+ 'Enabled' => true ,
20
+ 'StyleGuide' => '#buzz'
21
21
}
22
22
}
23
23
end
Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ def example(source)
39
39
end
40
40
41
41
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
43
43
end
44
44
45
45
it 'extracts keywords' do
@@ -58,12 +58,14 @@ def example(source)
58
58
end
59
59
60
60
describe 'value object semantics' do
61
+ # rubocop:disable RSpec/IdenticalEqualityAssertion
61
62
it 'compares by value' do
62
63
aggregate_failures 'equality semantics' do
63
64
expect ( example ( 'it("foo")' ) ) . to eq ( example ( 'it("foo")' ) )
64
65
expect ( example ( 'it("foo")' ) ) . not_to eq ( example ( 'it("bar")' ) )
65
66
end
66
67
end
68
+ # rubocop:enable RSpec/IdenticalEqualityAssertion
67
69
68
70
it 'can be used as a key in a hash' do
69
71
hash = { }
You can’t perform that action at this time.
0 commit comments