forked from opf/openproject
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.rubocop.yml
423 lines (310 loc) · 7.62 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
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
require:
- rubocop-rails
- rubocop-rspec
- ./lib_static/rubocop/cop/open_project/no_do_end_block_with_rspec_capybara_matcher_in_expect.rb
- ./lib_static/rubocop/cop/open_project/use_service_result_factory_methods.rb
inherit_mode:
merge:
# adding files to Exclude should merge with inherited instead of replacing
- Exclude
AllCops:
TargetRubyVersion: 3.2
# Enable any new cops in new versions by default
NewCops: enable
Exclude:
- '**/node_modules/**/*'
Gemspec/RequiredRubyVersion:
Exclude:
- modules/**/*.gemspec
Layout/ConditionPosition:
Enabled: false
Layout/DotPosition:
EnforcedStyle: leading
Layout/LineLength:
Max: 130
Layout/MultilineMethodCallIndentation:
Enabled: false
# Rubymine doesn't support the same indentation style
# and will auto-format against it with our editorconfig
Layout/MultilineOperationIndentation:
Enabled: false
Lint/AmbiguousOperator:
Enabled: false
Lint/AmbiguousRegexpLiteral:
Enabled: false
Lint/AssignmentInCondition:
Enabled: false
Lint/DeprecatedClassMethods:
Enabled: false
Lint/ElseLayout:
Enabled: false
Lint/FlipFlop:
Enabled: false
Lint/LiteralInInterpolation:
Enabled: false
Lint/Loop:
Enabled: false
Lint/ParenthesesAsGroupedExpression:
Enabled: false
Lint/RequireParentheses:
Enabled: false
Lint/SuppressedException:
Enabled: false
Lint/UnderscorePrefixedVariableName:
Enabled: false
Lint/Void:
Enabled: false
Lint/AmbiguousBlockAssociation:
AllowedMethods: [change]
Metrics/ClassLength:
Enabled: false
Metrics/CyclomaticComplexity:
Enabled: false
Metrics/BlockLength:
Enabled: false
Metrics/BlockNesting:
Enabled: false
Metrics/MethodLength:
Enabled: false
Metrics/ModuleLength:
Enabled: false
Metrics/ParameterLists:
Enabled: false
Metrics/AbcSize:
Enabled: true
Exclude:
- 'spec/**/*.rb'
- 'modules/*/spec/**/*.rb'
Naming/AccessorMethodName:
Enabled: false
Naming/AsciiIdentifiers:
Enabled: false
Naming/ClassAndModuleCamelCase:
AllowedNames:
- V2_1
Naming/FileName:
Enabled: false
Naming/PredicateName:
ForbiddenPrefixes:
- is_
Naming/VariableNumber:
AllowedPatterns:
- '\w_20\d\d' # allow dates like christmas_2022 or date_2034_04_12
- '\w\d++(_\d++)+' # allow hierarchical data like child1_2_5 (second + in regex is possessive qualifier)
# There are valid cases in which to use methods like:
# * update_all
# * touch_all
Rails/SkipsModelValidations:
Enabled: false
# Don't force us to use tag instead of content_tag
# as this breaks angular elements
Rails/ContentTag:
Enabled: false
# Disable I18n.locale = in specs, where it is reset
# by us explicitly
Rails/I18nLocaleAssignment:
Enabled: true
Exclude:
- 'spec/**/*.rb'
# The http verbs in Rack::Test do not accept named parameters (params: params)
Rails/HttpPositionalArguments:
Exclude:
- 'spec/requests/api/v3/**/*.rb'
# require_dependency is an obsolete method for Rails applications running in Zeitwerk mode.
Rails/RequireDependency:
Enabled: true
# For feature specs, we tend to have longer specs that cover a larger part of the functionality.
# This is done for multiple reasons:
# * performance, as setting up integration tests is costly
# * following a scenario that is closer to how a user interacts
RSpec/ExampleLength:
Max: 25
Enabled: true
Exclude:
- 'spec/features/**/*.rb'
- 'modules/*/spec/features/**/*.rb'
# We have specs that have no expect(..) syntax,
# but only helper classes that expect themselves
RSpec/NoExpectationExample:
Enabled: false
RSpec/DescribeClass:
Enabled: true
Exclude:
- 'spec/features/**/*.rb'
- 'modules/*/spec/features/**/*.rb'
# dynamic finders cop clashes with capybara ID cop
Rails/DynamicFindBy:
Enabled: true
Exclude:
- 'spec/features/**/*.rb'
- 'spec/support/**/*.rb'
- 'modules/*/spec/features/**/*.rb'
# See RSpec/ExampleLength for why feature specs are excluded
RSpec/MultipleExpectations:
Max: 15
Enabled: true
Exclude:
- 'spec/features/**/*.rb'
- 'modules/*/spec/features/**/*.rb'
RSpec/MultipleMemoizedHelpers:
Enabled: false
RSpec/NestedGroups:
Enabled: false
# Don't force the second argument of describe
# to be .class_method or #instance_method
RSpec/DescribeMethod:
Enabled: false
# Don't force the second argument of describe
# to match the exact file name
RSpec/FilePath:
SpecSuffixOnly: true
# We use let!() to ensure dependencies are created
# instead of let() and referencing them explicitly
RSpec/LetSetup:
Enabled: false
RSpec/LeadingSubject:
Enabled: false
RSpec/NamedSubject:
Enabled: false
RSpec/ContextWording:
Prefixes:
- as
- for
- if
- 'on'
- to
- unless
- when
- with
- without
RSpec/FactoryBot/SyntaxMethods:
Enabled: true
Style/Alias:
Enabled: false
Style/AndOr:
Enabled: false
Style/ArrayJoin:
Enabled: false
Style/AsciiComments:
Enabled: false
Style/Attr:
Enabled: false
Style/CaseEquality:
Enabled: false
Style/CharacterLiteral:
Enabled: false
Style/ClassAndModuleChildren:
Enabled: false
Style/ClassVars:
Enabled: false
Style/CollectionMethods:
PreferredMethods:
find: detect
reduce: inject
collect: map
find_all: select
Style/ColonMethodCall:
Enabled: false
Style/CommentAnnotation:
Enabled: false
Style/PreferredHashMethods:
Enabled: false
Style/Documentation:
Enabled: false
Style/DoubleNegation:
Enabled: false
Style/EachWithObject:
Enabled: false
Style/EmptyLiteral:
Enabled: false
Style/EvenOdd:
Enabled: false
Style/FormatString:
Enabled: false
Style/FormatStringToken:
AllowedMethods: [redirect]
Style/GlobalVars:
Enabled: false
Style/GuardClause:
Enabled: false
Style/IfUnlessModifier:
Enabled: false
Style/IfWithSemicolon:
Enabled: false
Style/InlineComment:
Enabled: false
Style/Lambda:
Enabled: false
Style/LambdaCall:
Enabled: false
Style/LineEndConcatenation:
Enabled: false
Style/ModuleFunction:
Enabled: false
Style/NegatedIf:
Enabled: false
Style/NegatedWhile:
Enabled: false
Style/Next:
Enabled: false
Style/NilComparison:
Enabled: false
Style/Not:
Enabled: false
Style/OneLineConditional:
Enabled: false
Style/PercentLiteralDelimiters:
Enabled: false
Style/PerlBackrefs:
Enabled: false
Style/Proc:
Enabled: false
Style/RaiseArgs:
Enabled: false
Style/RegexpLiteral:
Enabled: false
Style/SelfAssignment:
Enabled: false
Style/SingleLineBlockParams:
Enabled: false
Style/SingleLineMethods:
Enabled: false
Style/SignalException:
Enabled: false
Style/SpecialGlobalVars:
Enabled: false
# Forcing single quotes doesn't give any reasonable advantages. To the contrary:
# it forces you to change the quotes every time you want to add interpolation,
# newlines or other escape sequences (\n), or quotes (') to a string. Rubbish.
# Don't even think about performance. That never was a valid argument to begin with.
#
# For the record: using single quotes does NOT have any performance advantages.
# Even if it did, this would be a silly argument.
#
# Ideally we would just use double quotes everywhere but since that would result
# in innumerable rubocop offenses we will just disable this. Quote away.
Style/StringLiterals:
Enabled: false
Style/TrivialAccessors:
Enabled: false
Style/VariableInterpolation:
Enabled: false
Style/WhenThen:
Enabled: false
Style/WhileUntilModifier:
Enabled: false
Style/WordArray:
Enabled: false
Style/FrozenStringLiteralComment:
Enabled: false
Style/NumericLiterals:
Enabled: false
# Avoid enforcing "positive?"
Style/NumericPredicate:
Enabled: false
Style/HashEachMethods:
Enabled: true
Style/HashTransformKeys:
Enabled: true
Style/HashTransformValues:
Enabled: true