Skip to content

Commit b95ce9a

Browse files
committed
Enable and fix new cops
1 parent 9cdc07b commit b95ce9a

File tree

3 files changed

+56
-1
lines changed

3 files changed

+56
-1
lines changed

.rubocop.yml

+54
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,17 @@ Layout/SpaceAroundMethodCallOperator:
4343
Description: Checks method call operators to not have spaces around them.
4444
Enabled: true
4545

46+
Layout/SpaceBeforeBrackets:
47+
Enabled: true
48+
4649
Layout/SpaceInsideHashLiteralBraces:
4750
Description: Use spaces inside hash literal braces - or don't.
4851
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#spaces-operators
4952
EnforcedStyle: no_space
5053

54+
Lint/AmbiguousAssignment:
55+
Enabled: true
56+
5157
Lint/AmbiguousRegexpLiteral:
5258
Description: Checks for ambiguous regexp literals in the first argument of a method invocation without parentheses.
5359
Exclude:
@@ -66,12 +72,24 @@ Lint/DeprecatedOpenSSLConstant:
6672
Description: Don't use algorithm constants for `OpenSSL::Cipher` and `OpenSSL::Digest`.
6773
Enabled: true
6874

75+
Lint/DuplicateBranch:
76+
Enabled: true
77+
6978
Lint/DuplicateElsifCondition:
7079
Enabled: true
7180

81+
Lint/DuplicateRegexpCharacterClassElement:
82+
Enabled: true
83+
7284
Lint/DuplicateRescueException:
7385
Enabled: true
7486

87+
Lint/EmptyBlock:
88+
Enabled: true
89+
90+
Lint/EmptyClass:
91+
Enabled: true
92+
7593
Lint/EmptyConditionalBody:
7694
Enabled: true
7795

@@ -85,6 +103,9 @@ Lint/MixedRegexpCaptureTypes:
85103
Description: Do not mix named captures and numbered captures in a Regexp literal.
86104
Enabled: true
87105

106+
Lint/NoReturnInBeginEndBlocks:
107+
Enabled: true
108+
88109
Lint/OutOfRangeRegexpRef:
89110
Enabled: true
90111

@@ -99,9 +120,18 @@ Lint/StructNewOverride:
99120
Description: Disallow overriding the `Struct` built-in methods via `Struct.new`.
100121
Enabled: true
101122

123+
Lint/ToEnumArguments:
124+
Enabled: true
125+
102126
Lint/TopLevelReturnWithArgument:
103127
Enabled: true
104128

129+
Lint/UnexpectedBlockArity:
130+
Enabled: true
131+
132+
Lint/UnmodifiedReduceAccumulator:
133+
Enabled: true
134+
105135
Lint/UnreachableLoop:
106136
Enabled: true
107137

@@ -147,6 +177,9 @@ Naming/FileName:
147177
Style/AccessorGrouping:
148178
Enabled: true
149179

180+
Style/ArgumentsForwarding:
181+
Enabled: true
182+
150183
Style/ArrayCoercion:
151184
Enabled: true
152185

@@ -156,6 +189,9 @@ Style/BisectedAttrAccessor:
156189
Style/CaseLikeIf:
157190
Enabled: true
158191

192+
Style/CollectionCompact:
193+
Enabled: true
194+
159195
Style/CollectionMethods:
160196
Description: Enforces the use of consistent method names from the Enumerable module.
161197
PreferredMethods:
@@ -173,6 +209,9 @@ Style/DoubleNegation:
173209
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#no-bang-bang
174210
Enabled: false
175211

212+
Style/DocumentDynamicEvalDefinition:
213+
Enabled: true
214+
176215
Style/ExplicitBlockArgument:
177216
# capturing as a proc has a performance hit, so is a case by case choice
178217
Enabled: false
@@ -204,6 +243,9 @@ Style/HashEachMethods:
204243
Description: Use Hash#each_key and Hash#each_value.
205244
Enabled: true
206245

246+
Style/HashExcept:
247+
Enabled: true
248+
207249
Style/HashLikeCase:
208250
Enabled: true
209251

@@ -219,9 +261,18 @@ Style/HashSyntax:
219261
Description: Checks hash literal syntax.
220262
EnforcedStyle: ruby19
221263

264+
Style/NegatedIfElseCondition:
265+
Enabled: true
266+
267+
Style/NilLambda:
268+
Enabled: true
269+
222270
Style/OptionalBooleanParameter:
223271
Enabled: true
224272

273+
Style/RedundantArgument:
274+
Enabled: true
275+
225276
Style/RedundantAssignment:
226277
Enabled: true
227278

@@ -265,6 +316,9 @@ Style/StringLiterals:
265316
Description: Allow double-quoted strings without interpolation.
266317
EnforcedStyle: double_quotes
267318

319+
Style/SwapValues:
320+
Enabled: true
321+
268322
Style/TrailingCommaInArrayLiteral:
269323
EnforcedStyleForMultiline: no_comma
270324

lib/simplecov/configuration.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ def configure(&block)
191191
# end
192192
#
193193
def at_exit(&block)
194-
return proc {} unless running || block_given?
194+
return Proc.new unless running || block_given?
195195

196196
@at_exit = block if block_given?
197197
@at_exit ||= proc { SimpleCov.result.format! }

spec/result_merger_spec.rb

+1
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@
233233
Timeout.timeout(1) do
234234
SimpleCov::ResultMerger.synchronize_resultset do
235235
SimpleCov::ResultMerger.synchronize_resultset do
236+
# nothing
236237
end
237238
end
238239
end

0 commit comments

Comments
 (0)