forked from zammad/zammad
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdefault.yml
472 lines (389 loc) · 13 KB
/
default.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
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
# Default enabled cops
# https://github.com/rubocop-hq/rubocop/blob/master/config/default.yml
require:
- rubocop-capybara
- rubocop-factory_bot
- rubocop-faker
- rubocop-graphql
- rubocop-inflector
- rubocop-performance
- rubocop-rails
- rubocop-rspec
- ../config/initializers/inflections.rb
- ./rubocop_zammad.rb
inherit_from:
- todo.yml
- todo.rspec.yml
inherit_mode:
merge:
- Include
AllCops:
NewCops: enable
DisplayCopNames: true
Include:
- '.gitlab/**/*.rb'
- '.github/**/*.rb'
- '.rubocop/**/*.rb'
Exclude:
- 'bin/*'
- 'db/schema.rb'
- 'vendor/**/*'
- 'node_modules/**/*'
- 'public/assets/**/*'
- 'public/packs/**/*'
RSpec:
Include:
- "**/*_spec.rb"
- "**/*_examples.rb"
Language:
Expectations:
- expect_no_offenses
- expect_offense
- adds_foreign_key
- sent
- not_sent
Rails:
Enabled: true
# Zammad StyleGuide
Style/FrozenStringLiteralComment:
Enabled: false
Layout/LineLength:
Description: 'Limit lines to 80 characters.'
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#80-character-limits'
Enabled: false
Style/NegatedIf:
Description: >-
Favor unless over if for negative conditions
(or control flow or).
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#unless-for-negatives'
Enabled: false
Style/IfUnlessModifier:
Description: >-
Favor modifier if/unless usage when you have a
single-line body.
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#if-as-a-modifier'
Enabled: false
Style/TrailingCommaInArrayLiteral:
Description: 'Checks for trailing comma in array literals.'
StyleGuide: '#no-trailing-array-commas'
Enabled: false
Style/TrailingCommaInHashLiteral:
Description: 'Checks for trailing comma in hash literals.'
Enabled: false
Style/TrailingCommaInArguments:
Description: 'Checks for trailing comma in argument lists.'
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
Enabled: false
Style/RescueStandardError:
Description: 'Avoid rescuing without specifying an error class.'
Enabled: true
EnforcedStyle: implicit
Style/FormatStringToken:
Description: Use a consistent style for named format string tokens.
EnforcedStyle: template
# Prefer %{...} over %<...>s to make it easier for translators.
Layout/SpaceInsideReferenceBrackets:
Description: 'Checks the spacing inside referential brackets.'
Enabled: false
Layout/SpaceInsideArrayLiteralBrackets:
Description: 'Checks the spacing inside array literal brackets.'
Enabled: false
Style/DefWithParentheses:
Description: 'Use def with parentheses when there are arguments.'
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#method-parens'
Enabled: false
Style/HashSyntax:
EnforcedShorthandSyntax: either
Layout/HashAlignment:
Description: >-
Align the elements of a hash literal if they span more than
one line.
Enabled: true
EnforcedHashRocketStyle: table
EnforcedColonStyle: table
EnforcedLastArgumentHashStyle: always_inspect
Layout/EmptyLinesAroundClassBody:
Description: "Keeps track of empty lines around class bodies."
Enabled: false
Layout/EmptyLinesAroundMethodBody:
Description: "Keeps track of empty lines around method bodies."
Enabled: false
Layout/EmptyLinesAroundBlockBody:
Description: "Keeps track of empty lines around block bodies."
Enabled: false
Layout/EmptyLinesAroundModuleBody:
Description: "Keeps track of empty lines around module bodies."
Enabled: false
Layout/ExtraSpacing:
Description: 'Do not use unnecessary spacing.'
Enabled: true
Exclude:
- 'config/routes/**/*'
- 'db/migrate/20120101000001_create_base.rb'
- 'db/migrate/20120101000010_create_ticket.rb'
Style/MultilineBlockChain:
Description: 'Avoid multi-line chains of blocks.'
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#single-line-blocks'
Enabled: false
Metrics/ClassLength:
Description: 'Avoid classes longer than 100 lines of code.'
Enabled: false
Metrics/MethodLength:
Description: 'Avoid methods longer than 10 lines of code.'
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#short-methods'
Enabled: false
Metrics/ParameterLists:
Description: 'Checks for methods with too many parameters.'
CountKeywordArgs: false
Style/BlockComments:
Description: 'Do not use block comments.'
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-block-comments'
Enabled: false
Style/PerlBackrefs:
Description: 'Avoid Perl-style regex back references.'
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-perl-regexp-last-matchers'
Enabled: false
Rails/ApplicationRecord:
Exclude:
- 'app/models/application_model.rb'
- 'app/models/active_job_lock.rb'
Rails/BulkChangeTable:
Description: 'Check whether alter queries are combinable.'
Enabled: false
Rails/FindEach:
Description: 'Prefer all.find_each over all.find.'
Enabled: false
Rails/HasAndBelongsToMany:
Description: 'Prefer has_many :through to has_and_belongs_to_many.'
# StyleGuide: 'https://github.com/bbatsov/rails-style-guide#has-many-through'
Enabled: false
Rails/I18nLocaleTexts:
Description: 'Enforces use of I18n and locale files instead of locale specific strings.'
Enabled: false
Rails/MatchRoute:
Description: >-
Don't use `match` to define any routes unless there is a need to map multiple request types
among [:get, :post, :patch, :put, :delete] to a single action using the `:via` option.
StyleGuide: 'https://rails.rubystyle.guide/#no-match-routes'
Enabled: false
Rails/SkipsModelValidations:
Description: >-
Use methods that skips model validations with caution.
See reference for more information.
Reference: 'http://guides.rubyonrails.org/active_record_validations.html#skipping-validations'
Enabled: true
Exclude:
- test/**/*
- "**/*_spec.rb"
- "**/*_examples.rb"
Rails/ReversibleMigration:
Description: This cop checks whether the change method of the migration file is reversible.
Enabled: false
Rails/EnvironmentVariableAccess:
Description: 'This cop looks for direct access to environment variables through the ENV variable within the application code.'
Enabled: true
AllowReads: true
Rails/Output:
Exclude:
- "lib/tasks/**/*"
Include:
- "**/*_spec.rb"
Style/ClassAndModuleChildren:
Description: 'Checks style of children classes and modules.'
Enabled: true
EnforcedStyle: compact
# Avoids nesting of classes and modules in sequencer code and improves readability by decreasing whitespace.
# This cop is excluded for the rest of the codebase, due to following problems:
# - undefined constants in path components which are not autoloaded
# - changes to the lexical scope which require reference to the complete namespace of external classes
# - difficult backporting due to extensive whitespace changes on all lines
Include:
- 'lib/sequencer/**/*.rb'
Naming/FileName:
Description: 'Use snake_case for source file names.'
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#snake-case-files'
Enabled: true
Exclude:
- 'script/websocket-server.rb'
Naming/VariableNumber:
Description: 'Use the configured style when numbering variables.'
Enabled: false
Naming/MethodParameterName:
Description: >-
Checks for method parameter names that contain capital letters,
end in numbers, or do not meet a minimal length.
Enabled: true
AllowedNames: e, id, _, ip, to
Lint/BooleanSymbol:
Description: 'Check for `:true` and `:false` symbols.'
Enabled: true
Exclude:
- "db/seeds/object_manager_attributes.rb"
- "spec/requests/integration/object_manager_attributes_spec.rb"
Lint/InterpolationCheck:
Description: 'Raise warning for interpolation in single q strs'
Enabled: true
Exclude:
- "test/unit/email_process_auto_response_test.rb"
- "test/unit/email_process_bounce_delivery_permanent_failed_test.rb"
- "test/unit/email_process_bounce_follow_test.rb"
- "test/unit/notification_factory_renderer_test.rb"
- "test/unit/notification_factory_template_test.rb"
- "test/unit/ticket_trigger_test.rb"
- "test/unit/ticket_trigger_recursive_disabled_test.rb"
Style/StringConcatenation:
Description: 'Checks for places where string concatenation can be replaced with string interpolation.'
StyleGuide: '#string-interpolation'
Enabled: true
Exclude:
- "config/routes/**/*"
Style/RegexpLiteral:
Description: 'This cop enforces using // or %r around regular expressions.'
EnforcedStyle: percent_r
Style/RedundantBegin:
Description: 'This cop checks for redundant `begin` blocks.'
Enabled: false
Style/FetchEnvVar:
Description: 'This cop suggests `ENV.fetch` for the replacement of `ENV[]`.'
Enabled: false
GraphQL/OrderedArguments:
Enabled: false
GraphQL/OrderedFields:
Enabled: false
# Our models can have many fields, and we should not enforce a different GraphQL structure just for the sake of it.
GraphQL/ExtractType:
Enabled: false
GraphQL/ExtractInputType:
MaxArguments: 3
# Run cop only for mutations: https://github.com/DmitryTsepelev/rubocop-graphql/issues/47
Include:
- 'app/graphql/gql/mutations/**/*.rb'
# Enforcing field descriptions for all model fields will be too verbose/redundant.
GraphQL/FieldDescription:
Exclude:
- "app/graphql/gql/types/**/*"
GraphQL/ObjectDescription:
Exclude:
- "app/graphql/gql/fields/**/*" # false positive?
- "app/graphql/gql/types/**/base_*"
# RSpec tests
Style/NumericPredicate:
Description: >-
Checks for the use of predicate- or comparison methods for
numeric comparisons.
StyleGuide: '#predicate-methods'
# This will change to a new method call which isn't guaranteed to be on the
# object. Switching these methods has to be done with knowledge of the types
# of the variables which rubocop doesn't have.
AutoCorrect: false
Enabled: true
Exclude:
- "**/*_spec.rb"
Lint/AmbiguousBlockAssociation:
Description: >-
Checks for ambiguous block association with method when param
passed without parentheses.
StyleGuide: '#syntax'
Enabled: true
Exclude:
- "spec/support/*.rb"
- "**/*_spec.rb"
- "**/*_examples.rb"
Layout/MultilineMethodCallIndentation:
Description: >-
Checks the indentation of the method name part in method calls
that span more than one line.
EnforcedStyle: indented
Include:
- "**/*_spec.rb"
Lint/UnusedMethodArgument:
AllowUnusedKeywordArguments: true
Naming/PredicateName:
Exclude:
- "app/graphql/gql/types/**/*"
RSpec/DescribeMethod:
# We want to be able to split tests into subfolders, where several cases are grouped together.
Description: 'Checks that the second argument to the top level describe is the tested method name.'
Enabled: false
RSpec/NestedGroups:
Max: 6
RSpec/Rails/AvoidSetupHook:
Exclude:
- "test/**/*"
RSpec/AlignLeftLetBrace:
Description: 'Checks that left braces for adjacent single line lets are aligned.'
Enabled: true
RSpec/AnyInstance:
Description: 'Prefer instance doubles over stubbing any instance of a class.'
Enabled: false
RSpec/SubjectStub:
Enabled: false
RSpec/Rails/InferredSpecType:
Description: 'Identifies redundant spec type.'
Enabled: false # We use types to add DSL to rspec.
RSpec/IndexedLet:
Description: 'Do not set up test data using indexes (e.g., `item_1`, `item_2`).'
Enabled: false
Capybara/SpecificFinders:
Description: 'Checks if there is a more specific finder offered by Capybara.'
Enabled: false
# False positives, autocorrection makes weird suggestions.
Capybara/SpecificActions:
Description: 'Checks for there is a more specific actions offered by Capybara.'
Enabled: false
Capybara/NegationMatcher:
Description: Enforces use of have_no_* or not_to for negated expectations.
EnforcedStyle: have_no
RSpec/ExampleLength:
CountAsOne:
- 'array'
- 'hash'
- 'heredoc'
Max: 25
Zammad/PreferNegatedIfOverUnless:
Exclude:
- 'bin/rspec'
Zammad/ExistsDateTimePrecision:
Include:
- "db/migrate/*.rb"
- "**/db/addon/**/*.rb"
Zammad/ExistsResetColumnInformation:
Include:
- "db/migrate/*.rb"
- "**/db/addon/**/*.rb"
Exclude:
- 'db/migrate/201*_*.rb'
- 'db/migrate/2020*_*.rb'
Zammad/MigrationSchedulerLastRun:
Include:
- "db/migrate/*.rb"
- "**/db/addon/**/*.rb"
Exclude:
- 'db/migrate/201*_*.rb'
- 'db/migrate/2020*_*.rb'
Zammad/DetectTranslatableString:
Enabled: true
Include:
- "app/**/*.rb"
- "db/**/*.rb"
- "lib/**/*.rb"
Exclude:
- "db/migrate/**/*.rb"
- "db/addon/**/*.rb"
- "lib/generators/**/*.rb"
- "lib/sequencer/**/*.rb"
- "lib/import/**/*.rb"
- "lib/tasks/**/*.rb"
- "lib/fill_db.rb"
Zammad/ForbidTranslatableMarker:
Enabled: true
Include:
- "db/migrate/*.rb"
Zammad/ExistsDbStrategy:
Include:
- "spec/**/*.rb"
Exclude:
- "spec/support/capybara/*.rb"
Zammad/TimezoneDefault:
Exclude:
- "spec/**/*.rb"