makandra-rubocop 3.2.1 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,485 @@
1
+ require:
2
+ - rubocop-rails
3
+
4
+ AllCops:
5
+ Exclude:
6
+ - 'node_modules/**/*'
7
+ - 'vendor/**/*'
8
+ - '.git/**/*'
9
+ - 'bin/**/*'
10
+ - 'tmp/**/*'
11
+ - 'public/system/**/*'
12
+ - 'db/schema.rb'
13
+ # What version of Rails is the inspected code using? If a value is specified
14
+ # for TargetRailsVersion then it is used. Acceptable values are specificed
15
+ # as a float (i.e. 5.1); the patch version of Rails should not be included.
16
+ # If TargetRailsVersion is not set, RuboCop will parse the Gemfile.lock or
17
+ # gems.locked file to find the version of Rails that has been bound to the
18
+ # application. If neither of those files exist, RuboCop will use Rails 5.0
19
+ # as the default.
20
+ TargetRailsVersion: ~
21
+
22
+ Rails/ActionFilter:
23
+ Description: 'Enforces consistent use of action filter methods.'
24
+ Enabled: true
25
+ VersionAdded: '0.19'
26
+ EnforcedStyle: action
27
+ SupportedStyles:
28
+ - action
29
+ - filter
30
+ Include:
31
+ - app/controllers/**/*.rb
32
+
33
+ Rails/ActiveRecordAliases:
34
+ Description: >-
35
+ Avoid Active Record aliases:
36
+ Use `update` instead of `update_attributes`.
37
+ Use `update!` instead of `update_attributes!`.
38
+ Enabled: true
39
+ VersionAdded: '0.53'
40
+ SafeAutoCorrect: false
41
+
42
+ Rails/ActiveRecordOverride:
43
+ Description: >-
44
+ Check for overriding Active Record methods instead of using
45
+ callbacks.
46
+ Enabled: true
47
+ VersionAdded: '0.67'
48
+ Include:
49
+ - app/models/**/*.rb
50
+
51
+ Rails/ActiveSupportAliases:
52
+ Description: >-
53
+ Avoid ActiveSupport aliases of standard ruby methods:
54
+ `String#starts_with?`, `String#ends_with?`,
55
+ `Array#append`, `Array#prepend`.
56
+ Enabled: false
57
+ VersionAdded: '0.48'
58
+
59
+ Rails/ApplicationJob:
60
+ Description: 'Check that jobs subclass ApplicationJob.'
61
+ Enabled: true
62
+ VersionAdded: '0.49'
63
+
64
+ Rails/ApplicationRecord:
65
+ Description: 'Check that models subclass ApplicationRecord.'
66
+ Enabled: false # Because not all models are necessarily domain models (e.g. migration models for legacy databases)
67
+ VersionAdded: '0.49'
68
+
69
+ Rails/AssertNot:
70
+ Description: 'Use `assert_not` instead of `assert !`.'
71
+ Enabled: true
72
+ VersionAdded: '0.56'
73
+ Include:
74
+ - '**/test/**/*'
75
+
76
+ Rails/BelongsTo:
77
+ Description: >-
78
+ Use `optional: true` instead of `required: false` for
79
+ `belongs_to` relations'
80
+ Enabled: true
81
+ VersionAdded: '0.62'
82
+
83
+ Rails/Blank:
84
+ Description: 'Enforces use of `blank?`.'
85
+ Enabled: true
86
+ VersionAdded: '0.48'
87
+ VersionChanged: '0.67'
88
+ # Convert usages of `nil? || empty?` to `blank?`
89
+ NilOrEmpty: true
90
+ # Convert usages of `!present?` to `blank?`
91
+ NotPresent: true
92
+ # Convert usages of `unless present?` to `if blank?`
93
+ UnlessPresent: true
94
+
95
+ Rails/BulkChangeTable:
96
+ Description: 'Check whether alter queries are combinable.'
97
+ Enabled: false # We'll maybe enable this later.
98
+ VersionAdded: '0.57'
99
+ Database: null
100
+ SupportedDatabases:
101
+ - mysql
102
+ - postgresql
103
+ Include:
104
+ - db/migrate/*.rb
105
+
106
+ Rails/CreateTableWithTimestamps:
107
+ Description: >-
108
+ Checks the migration for which timestamps are not included
109
+ when creating a new table.
110
+ Enabled: true
111
+ VersionAdded: '0.52'
112
+ Include:
113
+ - db/migrate/*.rb
114
+
115
+ Rails/Date:
116
+ Description: >-
117
+ Checks the correct usage of date aware methods,
118
+ such as Date.today, Date.current etc.
119
+ Enabled: false # It's not that simple. Really.
120
+ VersionAdded: '0.30'
121
+ VersionChanged: '0.33'
122
+ # The value `strict` disallows usage of `Date.today`, `Date.current`,
123
+ # `Date#to_time` etc.
124
+ # The value `flexible` allows usage of `Date.current`, `Date.yesterday`, etc
125
+ # (but not `Date.today`) which are overridden by ActiveSupport to handle current
126
+ # time zone.
127
+ EnforcedStyle: flexible
128
+ SupportedStyles:
129
+ - strict
130
+ - flexible
131
+
132
+ Rails/Delegate:
133
+ Description: 'Prefer delegate method for delegations.'
134
+ Enabled: false
135
+ VersionAdded: '0.21'
136
+ VersionChanged: '0.50'
137
+ # When set to true, using the target object as a prefix of the
138
+ # method name without using the `delegate` method will be a
139
+ # violation. When set to false, this case is legal.
140
+ EnforceForPrefixed: true
141
+
142
+ Rails/DelegateAllowBlank:
143
+ Description: 'Do not use allow_blank as an option to delegate.'
144
+ Enabled: true
145
+ VersionAdded: '0.44'
146
+
147
+ Rails/DynamicFindBy:
148
+ Description: 'Use `find_by` instead of dynamic `find_by_*`.'
149
+ StyleGuide: 'https://rails.rubystyle.guide#find_by'
150
+ Enabled: false # We occasionally define custom find_by_* methods (e.g. `find_by_anything`) which don't work like ActiveRecord's methods.
151
+ VersionAdded: '0.44'
152
+ Whitelist:
153
+ - find_by_sql
154
+
155
+ Rails/EnumHash:
156
+ Description: 'Prefer hash syntax over array syntax when defining enums.'
157
+ StyleGuide: 'https://rails.rubystyle.guide#enums'
158
+ Enabled: true
159
+ VersionAdded: '2.3'
160
+ Include:
161
+ - app/models/**/*.rb
162
+
163
+ Rails/EnumUniqueness:
164
+ Description: 'Avoid duplicate integers in hash-syntax `enum` declaration.'
165
+ Enabled: true
166
+ VersionAdded: '0.46'
167
+ Include:
168
+ - app/models/**/*.rb
169
+
170
+ Rails/EnvironmentComparison:
171
+ Description: "Favor `Rails.env.production?` over `Rails.env == 'production'`"
172
+ Enabled: true
173
+ VersionAdded: '0.52'
174
+
175
+ Rails/Exit:
176
+ Description: >-
177
+ Favor `fail`, `break`, `return`, etc. over `exit` in
178
+ application or library code outside of Rake files to avoid
179
+ exits during unit testing or running in production.
180
+ Enabled: true
181
+ VersionAdded: '0.41'
182
+ Include:
183
+ - app/**/*.rb
184
+ - config/**/*.rb
185
+ - lib/**/*.rb
186
+ Exclude:
187
+ - lib/**/*.rake
188
+
189
+ Rails/FilePath:
190
+ Description: 'Use `Rails.root.join` for file path joining.'
191
+ Enabled: false
192
+ VersionAdded: '0.47'
193
+ VersionChanged: '0.57'
194
+ EnforcedStyle: arguments
195
+ SupportedStyles:
196
+ - slashes
197
+ - arguments
198
+
199
+ Rails/FindBy:
200
+ Description: 'Prefer find_by over where.first.'
201
+ StyleGuide: 'https://rails.rubystyle.guide#find_by'
202
+ Enabled: false
203
+ VersionAdded: '0.30'
204
+ Include:
205
+ - app/models/**/*.rb
206
+
207
+ Rails/FindEach:
208
+ Description: 'Prefer all.find_each over all.find.'
209
+ StyleGuide: 'https://rails.rubystyle.guide#find-each'
210
+ Enabled: true
211
+ VersionAdded: '0.30'
212
+ Include:
213
+ - app/models/**/*.rb
214
+
215
+ Rails/HasAndBelongsToMany:
216
+ Description: 'Prefer has_many :through to has_and_belongs_to_many.'
217
+ StyleGuide: 'https://rails.rubystyle.guide#has-many-through'
218
+ Enabled: true
219
+ VersionAdded: '0.12'
220
+ Include:
221
+ - app/models/**/*.rb
222
+
223
+ Rails/HasManyOrHasOneDependent:
224
+ Description: 'Define the dependent option to the has_many and has_one associations.'
225
+ StyleGuide: 'https://rails.rubystyle.guide#has_many-has_one-dependent-option'
226
+ Enabled: true
227
+ VersionAdded: '0.50'
228
+ Include:
229
+ - app/models/**/*.rb
230
+
231
+ Rails/HelperInstanceVariable:
232
+ Description: 'Do not use instance variables in helpers'
233
+ Enabled: true
234
+ VersionAdded: '2.0'
235
+ Include:
236
+ - app/helpers/**/*.rb
237
+
238
+ Rails/HttpPositionalArguments:
239
+ Description: 'Use keyword arguments instead of positional arguments in http method calls.'
240
+ Enabled: true
241
+ VersionAdded: '0.44'
242
+ Include:
243
+ - 'spec/**/*'
244
+ - 'test/**/*'
245
+
246
+ Rails/HttpStatus:
247
+ Description: 'Enforces use of symbolic or numeric value to define HTTP status.'
248
+ Enabled: false
249
+ VersionAdded: '0.54'
250
+ EnforcedStyle: symbolic
251
+ SupportedStyles:
252
+ - numeric
253
+ - symbolic
254
+
255
+ Rails/IgnoredSkipActionFilterOption:
256
+ Description: 'Checks that `if` and `only` (or `except`) are not used together as options of `skip_*` action filter.'
257
+ Reference: 'https://api.rubyonrails.org/classes/AbstractController/Callbacks/ClassMethods.html#method-i-_normalize_callback_options'
258
+ Enabled: true
259
+ VersionAdded: '0.63'
260
+ Include:
261
+ - app/controllers/**/*.rb
262
+
263
+ Rails/InverseOf:
264
+ Description: 'Checks for associations where the inverse cannot be determined automatically.'
265
+ Enabled: true
266
+ VersionAdded: '0.52'
267
+ Include:
268
+ - app/models/**/*.rb
269
+
270
+ Rails/LexicallyScopedActionFilter:
271
+ Description: "Checks that methods specified in the filter's `only` or `except` options are explicitly defined in the controller."
272
+ StyleGuide: 'https://rails.rubystyle.guide#lexically-scoped-action-filter'
273
+ Enabled: true
274
+ Safe: false
275
+ VersionAdded: '0.52'
276
+ Include:
277
+ - app/controllers/**/*.rb
278
+
279
+ Rails/LinkToBlank:
280
+ Description: 'Checks that `link_to` with a `target: "_blank"` have a `rel: "noopener"` option passed to them.'
281
+ Reference:
282
+ - https://mathiasbynens.github.io/rel-noopener/
283
+ - https://html.spec.whatwg.org/multipage/links.html#link-type-noopener
284
+ - https://html.spec.whatwg.org/multipage/links.html#link-type-noreferrer
285
+ Enabled: true
286
+ VersionAdded: '0.62'
287
+
288
+ Rails/NotNullColumn:
289
+ Description: 'Do not add a NOT NULL column without a default value'
290
+ Enabled: true
291
+ VersionAdded: '0.43'
292
+ Include:
293
+ - db/migrate/*.rb
294
+
295
+ Rails/Output:
296
+ Description: 'Checks for calls to puts, print, etc.'
297
+ Enabled: false
298
+ VersionAdded: '0.15'
299
+ VersionChanged: '0.19'
300
+ Include:
301
+ - app/**/*.rb
302
+ - config/**/*.rb
303
+ - db/**/*.rb
304
+ - lib/**/*.rb
305
+
306
+ Rails/OutputSafety:
307
+ Description: 'The use of `html_safe` or `raw` may be a security risk.'
308
+ Enabled: true # We may need to review this. Unsure if the cop can always know which `html_safe` call is valid and which one is not.
309
+ VersionAdded: '0.41'
310
+
311
+ Rails/PluralizationGrammar:
312
+ Description: 'Checks for incorrect grammar when using methods like `3.day.ago`.'
313
+ Enabled: true
314
+ VersionAdded: '0.35'
315
+
316
+ Rails/Presence:
317
+ Description: 'Checks code that can be written more easily using `Object#presence` defined by Active Support.'
318
+ Enabled: true
319
+ VersionAdded: '0.52'
320
+
321
+ Rails/Present:
322
+ Description: 'Enforces use of `present?`.'
323
+ Enabled: true
324
+ VersionAdded: '0.48'
325
+ VersionChanged: '0.67'
326
+ # Convert usages of `!nil? && !empty?` to `present?`
327
+ NotNilAndNotEmpty: true
328
+ # Convert usages of `!blank?` to `present?`
329
+ NotBlank: true
330
+ # Convert usages of `unless blank?` to `if present?`
331
+ UnlessBlank: true
332
+
333
+ Rails/ReadWriteAttribute:
334
+ Description: >-
335
+ Checks for read_attribute(:attr) and
336
+ write_attribute(:attr, val).
337
+ StyleGuide: 'https://rails.rubystyle.guide#read-attribute'
338
+ Enabled: true
339
+ VersionAdded: '0.20'
340
+ VersionChanged: '0.29'
341
+ Include:
342
+ - app/models/**/*.rb
343
+
344
+ Rails/RedundantAllowNil:
345
+ Description: >-
346
+ Finds redundant use of `allow_nil` when `allow_blank` is set to
347
+ certain values in model validations.
348
+ Enabled: true
349
+ VersionAdded: '0.67'
350
+ Include:
351
+ - app/models/**/*.rb
352
+
353
+ Rails/RedundantReceiverInWithOptions:
354
+ Description: 'Checks for redundant receiver in `with_options`.'
355
+ Enabled: true
356
+ VersionAdded: '0.52'
357
+
358
+ Rails/ReflectionClassName:
359
+ Description: 'Use a string for `class_name` option value in the definition of a reflection.'
360
+ Enabled: true
361
+ VersionAdded: '0.64'
362
+
363
+ Rails/RefuteMethods:
364
+ Description: 'Use `assert_not` methods instead of `refute` methods.'
365
+ Enabled: true
366
+ VersionAdded: '0.56'
367
+ Include:
368
+ - '**/test/**/*'
369
+
370
+ Rails/RelativeDateConstant:
371
+ Description: 'Do not assign relative date to constants.'
372
+ Enabled: true
373
+ VersionAdded: '0.48'
374
+ VersionChanged: '0.59'
375
+ AutoCorrect: false
376
+
377
+ Rails/RequestReferer:
378
+ Description: 'Use consistent syntax for request.referer.'
379
+ Enabled: true
380
+ VersionAdded: '0.41'
381
+ EnforcedStyle: referrer # A typo in a "remote API" (HTTP RFC) should not force us using badly named methods
382
+ SupportedStyles:
383
+ - referer
384
+ - referrer
385
+
386
+ Rails/ReversibleMigration:
387
+ Description: 'Checks whether the change method of the migration file is reversible.'
388
+ StyleGuide: 'https://rails.rubystyle.guide#reversible-migration'
389
+ Reference: 'https://api.rubyonrails.org/classes/ActiveRecord/Migration/CommandRecorder.html'
390
+ Enabled: true
391
+ VersionAdded: '0.47'
392
+ Include:
393
+ - db/migrate/*.rb
394
+
395
+ Rails/SafeNavigation:
396
+ Description: "Use Ruby's safe navigation operator (`&.`) instead of `try!`"
397
+ Enabled: false
398
+ VersionAdded: '0.43'
399
+ # This will convert usages of `try` to use safe navigation as well as `try!`.
400
+ # `try` and `try!` work slightly differently. `try!` and safe navigation will
401
+ # both raise a `NoMethodError` if the receiver of the method call does not
402
+ # implement the intended method. `try` will not raise an exception for this.
403
+ ConvertTry: false
404
+
405
+ Rails/SaveBang:
406
+ Description: 'Identifies possible cases where Active Record save! or related should be used.'
407
+ StyleGuide: 'https://rails.rubystyle.guide#save-bang'
408
+ Enabled: false
409
+ VersionAdded: '0.42'
410
+ VersionChanged: '0.59'
411
+ AllowImplicitReturn: true
412
+ AllowedReceivers: []
413
+ SafeAutoCorrect: false
414
+
415
+ Rails/ScopeArgs:
416
+ Description: 'Checks the arguments of ActiveRecord scopes.'
417
+ Enabled: true
418
+ VersionAdded: '0.19'
419
+ Include:
420
+ - app/models/**/*.rb
421
+
422
+ Rails/SkipsModelValidations:
423
+ Description: >-
424
+ Use methods that skips model validations with caution.
425
+ See reference for more information.
426
+ Reference: 'https://guides.rubyonrails.org/active_record_validations.html#skipping-validations'
427
+ Enabled: false
428
+ VersionAdded: '0.47'
429
+ VersionChanged: '0.60'
430
+ Blacklist:
431
+ - decrement!
432
+ - decrement_counter
433
+ - increment!
434
+ - increment_counter
435
+ - toggle!
436
+ - touch
437
+ - update_all
438
+ - update_attribute
439
+ - update_column
440
+ - update_columns
441
+ - update_counters
442
+ Whitelist: []
443
+
444
+ Rails/TimeZone:
445
+ Description: 'Checks the correct usage of time zone aware methods.'
446
+ StyleGuide: 'https://rails.rubystyle.guide#time'
447
+ Reference: 'http://danilenko.org/2012/7/6/rails_timezones'
448
+ Enabled: false
449
+ Safe: false
450
+ VersionAdded: '0.30'
451
+ VersionChanged: '0.68'
452
+ # The value `strict` means that `Time` should be used with `zone`.
453
+ # The value `flexible` allows usage of `in_time_zone` instead of `zone`.
454
+ EnforcedStyle: flexible
455
+ SupportedStyles:
456
+ - strict
457
+ - flexible
458
+
459
+ Rails/UniqBeforePluck:
460
+ Description: 'Prefer the use of uniq or distinct before pluck.'
461
+ Enabled: true
462
+ VersionAdded: '0.40'
463
+ VersionChanged: '0.47'
464
+ EnforcedStyle: conservative
465
+ SupportedStyles:
466
+ - conservative
467
+ - aggressive
468
+ AutoCorrect: false
469
+
470
+ Rails/UnknownEnv:
471
+ Description: 'Use correct environment name.'
472
+ Enabled: true
473
+ VersionAdded: '0.51'
474
+ Environments:
475
+ - development
476
+ - test
477
+ - production
478
+
479
+ Rails/Validation:
480
+ Description: 'Use validates :attribute, hash of validations.'
481
+ Enabled: true
482
+ VersionAdded: '0.9'
483
+ VersionChanged: '0.41'
484
+ Include:
485
+ - app/models/**/*.rb