makandra-rubocop 4.4.0 → 5.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,10 @@
1
1
  require:
2
2
  - rubocop-rails
3
3
 
4
+ inherit_mode:
5
+ merge:
6
+ - Exclude
7
+
4
8
  AllCops:
5
9
  Exclude:
6
10
  - 'node_modules/**/*'
@@ -56,15 +60,33 @@ Rails/ActiveSupportAliases:
56
60
  Enabled: false
57
61
  VersionAdded: '0.48'
58
62
 
63
+ Rails/ApplicationController:
64
+ Description: 'Check that controllers subclass ApplicationController.'
65
+ Enabled: false # We have Controllers like `/jasmine` which do not inherit from ApplicationController
66
+ SafeAutoCorrect: false
67
+ VersionAdded: '2.4'
68
+ VersionChanged: '2.5'
69
+
59
70
  Rails/ApplicationJob:
60
71
  Description: 'Check that jobs subclass ApplicationJob.'
61
72
  Enabled: true
73
+ SafeAutoCorrect: false
62
74
  VersionAdded: '0.49'
75
+ VersionChanged: '2.5'
76
+
77
+ Rails/ApplicationMailer:
78
+ Description: 'Check that mailers subclass ApplicationMailer.'
79
+ Enabled: true
80
+ SafeAutoCorrect: false
81
+ VersionAdded: '2.4'
82
+ VersionChanged: '2.5'
63
83
 
64
84
  Rails/ApplicationRecord:
65
85
  Description: 'Check that models subclass ApplicationRecord.'
66
86
  Enabled: false # Because not all models are necessarily domain models (e.g. migration models for legacy databases)
87
+ SafeAutoCorrect: false
67
88
  VersionAdded: '0.49'
89
+ VersionChanged: '2.5'
68
90
 
69
91
  Rails/AssertNot:
70
92
  Description: 'Use `assert_not` instead of `assert !`.'
@@ -190,8 +212,8 @@ Rails/FilePath:
190
212
  Description: 'Use `Rails.root.join` for file path joining.'
191
213
  Enabled: false
192
214
  VersionAdded: '0.47'
193
- VersionChanged: '0.57'
194
- EnforcedStyle: arguments
215
+ VersionChanged: '2.4'
216
+ EnforcedStyle: slashes
195
217
  SupportedStyles:
196
218
  - slashes
197
219
  - arguments
@@ -260,6 +282,16 @@ Rails/IgnoredSkipActionFilterOption:
260
282
  Include:
261
283
  - app/controllers/**/*.rb
262
284
 
285
+ Rails/IndexBy:
286
+ Description: 'Prefer `index_by` over `each_with_object` or `map`.'
287
+ Enabled: true
288
+ VersionAdded: '2.5'
289
+
290
+ Rails/IndexWith:
291
+ Description: 'Prefer `index_with` over `each_with_object` or `map`.'
292
+ Enabled: true
293
+ VersionAdded: '2.5'
294
+
263
295
  Rails/InverseOf:
264
296
  Description: 'Checks for associations where the inverse cannot be determined automatically.'
265
297
  Enabled: true
@@ -330,6 +362,17 @@ Rails/Present:
330
362
  # Convert usages of `unless blank?` to `if present?`
331
363
  UnlessBlank: true
332
364
 
365
+ Rails/RakeEnvironment:
366
+ Description: 'Include `:environment` as a dependency for all Rake tasks.'
367
+ Enabled: false
368
+ Safe: false
369
+ VersionAdded: '2.4'
370
+ Include:
371
+ - '**/Rakefile'
372
+ - '**/*.rake'
373
+ Exclude:
374
+ - 'lib/capistrano/tasks/**/*.rake'
375
+
333
376
  Rails/ReadWriteAttribute:
334
377
  Description: >-
335
378
  Checks for read_attribute(:attr) and
@@ -364,6 +407,10 @@ Rails/RefuteMethods:
364
407
  Description: 'Use `assert_not` methods instead of `refute` methods.'
365
408
  Enabled: true
366
409
  VersionAdded: '0.56'
410
+ EnforcedStyle: assert_not
411
+ SupportedStyles:
412
+ - assert_not
413
+ - refute
367
414
  Include:
368
415
  - '**/test/**/*'
369
416
 
@@ -402,6 +449,18 @@ Rails/SafeNavigation:
402
449
  # implement the intended method. `try` will not raise an exception for this.
403
450
  ConvertTry: false
404
451
 
452
+ Rails/SafeNavigationWithBlank:
453
+ Description: 'Avoid `foo&.blank?` in conditionals.'
454
+ Enabled: true
455
+ VersionAdded: '2.4'
456
+ # While the safe navigation operator is generally a good idea, when
457
+ # checking `foo&.blank?` in a conditional, `foo` being `nil` will actually
458
+ # do the opposite of what the author intends.
459
+ #
460
+ # foo&.blank? #=> nil
461
+ # foo.blank? #=> true
462
+ SafeAutoCorrect: false
463
+
405
464
  Rails/SaveBang:
406
465
  Description: 'Identifies possible cases where Active Record save! or related should be used.'
407
466
  StyleGuide: 'https://rails.rubystyle.guide#save-bang'
@@ -467,6 +526,13 @@ Rails/UniqBeforePluck:
467
526
  - aggressive
468
527
  AutoCorrect: false
469
528
 
529
+ Rails/UniqueValidationWithoutIndex:
530
+ Description: 'Uniqueness validation should be with a unique index.'
531
+ Enabled: true
532
+ VersionAdded: '2.5'
533
+ Include:
534
+ - app/models/**/*.rb
535
+
470
536
  Rails/UnknownEnv:
471
537
  Description: 'Use correct environment name.'
472
538
  Enabled: false # https://github.com/makandra/makandra-rubocop/issues/11
@@ -1,3 +1,3 @@
1
1
  module MakandraRubocop
2
- VERSION = '4.4.0'.freeze
2
+ VERSION = '5.0.0'.freeze
3
3
  end
@@ -23,8 +23,8 @@ Gem::Specification.new do |spec|
23
23
  spec.executables = spec.files.grep(%r(^exe/)) { |f| File.basename(f) }
24
24
  spec.require_paths = ['lib']
25
25
 
26
- spec.add_dependency 'rubocop', '~> 0.76.0'
27
- spec.add_dependency 'rubocop-rails', '~> 2.3.2'
26
+ spec.add_dependency 'rubocop', '~> 0.81.0'
27
+ spec.add_dependency 'rubocop-rails', '~> 2.5.1'
28
28
 
29
29
  spec.add_development_dependency 'bundler', '~> 2.0'
30
30
  spec.add_development_dependency 'rake', '~> 12.3'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: makandra-rubocop
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.4.0
4
+ version: 5.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arne Hartherz
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2020-04-06 00:00:00.000000000 Z
12
+ date: 2020-04-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rubocop
@@ -17,28 +17,28 @@ dependencies:
17
17
  requirements:
18
18
  - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: 0.76.0
20
+ version: 0.81.0
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - "~>"
26
26
  - !ruby/object:Gem::Version
27
- version: 0.76.0
27
+ version: 0.81.0
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: rubocop-rails
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
32
  - - "~>"
33
33
  - !ruby/object:Gem::Version
34
- version: 2.3.2
34
+ version: 2.5.1
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
39
  - - "~>"
40
40
  - !ruby/object:Gem::Version
41
- version: 2.3.2
41
+ version: 2.5.1
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: bundler
44
44
  requirement: !ruby/object:Gem::Requirement