forked from simplecov-ruby/simplecov
-
Notifications
You must be signed in to change notification settings - Fork 1
/
.rubocop.yml
359 lines (267 loc) · 8.11 KB
/
.rubocop.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
AllCops:
Exclude:
- "spec/fixtures/iso-8859.rb"
- "spec/fixtures/utf-8.rb"
- "spec/fixtures/utf-8-magic.rb"
- "spec/fixtures/euc-jp.rb"
- "spec/fixtures/empty_euc-jp.rb"
- "spec/fixtures/euc-jp-shebang.rb"
- "test_projects/**/*"
- "tmp/**/*"
- "vendor/bundle/**/*"
- "vendor/bundle/**/.*"
TargetRubyVersion: 2.5
NewCops: enable
# we might wanna adopt rspec and rake but it's a bit annoying for now
SuggestExtensions: false
Bundler/OrderedGems:
Description: Gems should be alphabetically sorted within groups.
Enabled: false
Layout/AccessModifierIndentation:
Description: Modifiers should be indented as deep as method definitions,
or as deep as the class/module keyword, depending on configuration.
EnforcedStyle: outdent
Layout/EmptyLinesAroundAttributeAccessor:
Description: Keep blank lines around attribute accessors.
Enabled: true
# Open for revision would like table style but the impact
# would probably be huge
Layout/HashAlignment:
Enabled: false
Layout/HeredocIndentation:
Description: Checks the indentation of the here document bodies.
Enabled: false
Layout/LineLength:
Description: Checks the length of lines in the source code.
AllowURI: true
Enabled: false
Layout/SpaceAroundMethodCallOperator:
Description: Checks method call operators to not have spaces around them.
Enabled: true
Layout/SpaceBeforeBrackets:
Enabled: true
Layout/SpaceInsideHashLiteralBraces:
Description: Use spaces inside hash literal braces - or don't.
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#spaces-operators
EnforcedStyle: no_space
Lint/AmbiguousAssignment:
Enabled: true
Lint/AmbiguousRegexpLiteral:
Description: Checks for ambiguous regexp literals in the first argument of a method invocation without parentheses.
Exclude:
- "features/**/*_steps.rb"
- "spec/**/*_steps.rb"
- "tmp/**/*_steps.rb"
Lint/BinaryOperatorWithIdenticalOperands:
Enabled: true
Lint/ConstantDefinitionInBlock:
Exclude:
- "spec/**/*_spec.rb"
Lint/DeprecatedConstants:
Enabled: true
Lint/DeprecatedOpenSSLConstant:
Description: Don't use algorithm constants for `OpenSSL::Cipher` and `OpenSSL::Digest`.
Enabled: true
Lint/DuplicateBranch:
Enabled: true
Lint/DuplicateElsifCondition:
Enabled: true
Lint/DuplicateRegexpCharacterClassElement:
Enabled: true
Lint/DuplicateRescueException:
Enabled: true
Lint/EmptyBlock:
Enabled: true
Lint/EmptyClass:
Enabled: true
Lint/EmptyConditionalBody:
Enabled: true
Lint/FloatComparison:
Enabled: true
Lint/LambdaWithoutLiteralBlock:
Enabled: true
Lint/MissingSuper:
Enabled: true
Lint/MixedRegexpCaptureTypes:
Description: Do not mix named captures and numbered captures in a Regexp literal.
Enabled: true
Lint/NoReturnInBeginEndBlocks:
Enabled: true
Lint/NumberedParameterAssignment:
Enabled: true
Lint/OrAssignmentToConstant:
Enabled: true
Lint/OutOfRangeRegexpRef:
Enabled: true
Lint/RaiseException:
Description: Checks for `raise` or `fail` statements which are raising `Exception` class.
Enabled: true
Lint/RedundantDirGlobSort:
Enabled: true
Lint/SelfAssignment:
Enabled: true
Lint/StructNewOverride:
Description: Disallow overriding the `Struct` built-in methods via `Struct.new`.
Enabled: true
Lint/SymbolConversion:
Enabled: true
Lint/ToEnumArguments:
Enabled: true
Lint/TopLevelReturnWithArgument:
Enabled: true
Lint/TripleQuotes:
Enabled: true
Lint/UnexpectedBlockArity:
Enabled: true
Lint/UnmodifiedReduceAccumulator:
Enabled: true
Lint/UnreachableLoop:
Enabled: true
Metrics/AbcSize:
Description: Checks that the ABC size of methods is not higher than the configured maximum.
Max: 25 # TODO: Lower to 15
Metrics/BlockLength:
Description: Checks if the length of a block exceeds some maximum value.
Exclude:
- "spec/**/*.rb"
Metrics/BlockNesting:
Description: Avoid excessive block nesting.
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#three-is-the-number-thou-shalt-count
Max: 2
Metrics/ClassLength:
Max: 300
Metrics/MethodLength:
Description: Checks if the length of a method exceeds some maximum value.
CountComments: false
Max: 12 # TODO: Lower to 10
Metrics/ModuleLength:
Description: Avoid modules longer than 100 lines of code.
Max: 300
Exclude:
- "lib/simplecov.rb"
Metrics/ParameterLists:
Description: Avoid parameter lists longer than three or four parameters.
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#too-many-params
Max: 4
CountKeywordArgs: true
Naming/FileName:
Description: makes sure that Ruby source files have snake_case names.
Exclude:
- "spec/fixtures/utf-8.rb"
Style/AccessorGrouping:
Enabled: true
Style/ArgumentsForwarding:
Enabled: true
Style/ArrayCoercion:
Enabled: true
Style/BisectedAttrAccessor:
Enabled: true
Style/CaseLikeIf:
Enabled: true
Style/CollectionCompact:
Enabled: true
Style/CollectionMethods:
Description: Enforces the use of consistent method names from the Enumerable module.
PreferredMethods:
map: "collect"
reduce: "inject"
find: "detect"
find_all: "select"
Style/Documentation:
Description: Checks for missing top-level documentation of classes and modules.
Enabled: false
Style/DoubleNegation:
Description: Checks for uses of double negation (!!).
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#no-bang-bang
Enabled: false
Style/DocumentDynamicEvalDefinition:
Enabled: true
Style/EndlessMethod:
Enabled: true
Style/EnvHome:
Enabled: false
Style/ExplicitBlockArgument:
# capturing as a proc has a performance hit, so is a case by case choice
Enabled: false
Style/ExponentialNotation:
Description: When using exponential notation, favor a mantissa between 1 (inclusive) and 10 (exclusive).
Enabled: true
Style/FrozenStringLiteralComment:
Description:
Add the frozen_string_literal comment to the top of files to help transition
from Ruby 2.3.0 to Ruby 3.0.
Enabled: true
EnforcedStyle: always
Exclude:
- "spec/fixtures/**/*"
Style/GlobalStdStream:
Enabled: true
Style/GuardClause:
Description: Use a guard clause instead of wrapping the code inside a conditional expression.
Enabled: false
Style/HashAsLastArrayItem:
Enabled: true
Style/HashEachMethods:
Description: Use Hash#each_key and Hash#each_value.
Enabled: true
Style/HashExcept:
Enabled: true
Style/HashLikeCase:
Enabled: true
Style/HashTransformKeys:
Description: Prefer `transform_keys` over `each_with_object` and `map`.
Enabled: true
Style/HashTransformValues:
Description: Prefer `transform_values` over `each_with_object` and `map`.
Enabled: true
Style/HashSyntax:
Description: Checks hash literal syntax.
EnforcedStyle: ruby19
Style/IfWithBooleanLiteralBranches:
Enabled: true
Style/NegatedIfElseCondition:
Enabled: true
Style/NilLambda:
Enabled: true
Style/OptionalBooleanParameter:
Enabled: true
Style/RedundantArgument:
Enabled: true
Style/RedundantAssignment:
Enabled: true
Style/RedundantFetchBlock:
Enabled: true
Style/RedundantFileExtensionInRequire:
Enabled: true
Style/RedundantRegexpCharacterClass:
Description: Checks for unnecessary single-element Regexp character classes.
Enabled: true
Style/RedundantRegexpEscape:
Description: Checks for redundant escapes in Regexps.
Enabled: true
Style/RegexpLiteral:
Description: Use / or %r around regular expressions.
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#percent-r
Enabled: false
Style/SingleArgumentDig:
Enabled: true
Style/SlicingWithRange:
Description: Checks array slicing is done with endless ranges when suitable.
Enabled: true
Style/SpecialGlobalVars:
Description: Looks for uses of Perl-style global variables.
Exclude:
- "spec/deleted_source_spec.rb"
- "spec/return_codes_spec.rb"
- "lib/simplecov/defaults.rb"
Style/StringConcatenation:
Enabled: true
Style/StringLiterals:
Description: Allow double-quoted strings without interpolation.
EnforcedStyle: double_quotes
Style/SwapValues:
Enabled: true
Style/TrailingCommaInArrayLiteral:
EnforcedStyleForMultiline: no_comma
Style/TrailingCommaInHashLiteral:
EnforcedStyleForMultiline: no_comma