makandra-rubocop 11.2.0 → 12.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/config/ext/rails.yml CHANGED
@@ -7,14 +7,19 @@ inherit_mode:
7
7
 
8
8
  AllCops:
9
9
  Exclude:
10
- - 'node_modules/**/*'
11
- - 'vendor/**/*'
12
10
  - '.git/**/*'
13
- - 'bin/**/*'
14
- - 'tmp/**/*'
15
- - 'public/system/**/*'
16
- - 'db/*schema.rb'
17
- - 'log/**/*'
11
+ - app/assets/**/*
12
+ - bin/**/*
13
+ - db/*schema.rb
14
+ - node_modules/**/*
15
+ - log/**/*
16
+ - public/**/*
17
+ - storage/**/*
18
+ - tmp/**/*
19
+ - vendor/**/*
20
+ # Enable checking Active Support extensions.
21
+ # See: https://docs.rubocop.org/rubocop/configuration.html#enable-checking-active-support-extensions
22
+ ActiveSupportExtensionsEnabled: true
18
23
  # What version of Rails is the inspected code using? If a value is specified
19
24
  # for TargetRailsVersion then it is used. Acceptable values are specified
20
25
  # as a float (i.e. 5.1); the patch version of Rails should not be included.
@@ -46,6 +51,31 @@ Lint/NumberConversion:
46
51
  - in_milliseconds
47
52
  AllowedPatterns: []
48
53
 
54
+ Lint/RedundantSafeNavigation:
55
+ # Add `presence` and `present?` methods to the default of the RuboCop core.
56
+ # https://github.com/rubocop/rubocop/blob/v1.51.0/config/default.yml#L2148-L2159
57
+ AllowedMethods:
58
+ - instance_of?
59
+ - kind_of?
60
+ - is_a?
61
+ - eql?
62
+ - respond_to?
63
+ - equal?
64
+ - presence
65
+ - present?
66
+
67
+ Lint/SafeNavigationChain:
68
+ # Add `presence_in` method to the default of the RuboCop core:
69
+ # https://github.com/rubocop/rubocop/blob/v1.56.0/config/default.yml#L2265-L2271
70
+ AllowedMethods:
71
+ - present?
72
+ - blank?
73
+ - presence
74
+ - presence_in
75
+ - try
76
+ - try!
77
+ - in?
78
+
49
79
  Rails:
50
80
  Enabled: true
51
81
  DocumentationBaseURL: https://docs.rubocop.org/rubocop-rails
@@ -68,8 +98,9 @@ Rails/ActionControllerTestCase:
68
98
 
69
99
  Rails/ActionFilter:
70
100
  Description: 'Enforces consistent use of action filter methods.'
71
- Enabled: true
101
+ Enabled: false
72
102
  VersionAdded: '0.19'
103
+ VersionChanged: '2.22'
73
104
  EnforcedStyle: action
74
105
  SupportedStyles:
75
106
  - action
@@ -145,8 +176,9 @@ Rails/AddColumnIndex:
145
176
  index might be used.
146
177
  Enabled: true
147
178
  VersionAdded: '2.11'
179
+ VersionChanged: '2.20'
148
180
  Include:
149
- - db/migrate/*.rb
181
+ - db/**/*.rb
150
182
 
151
183
  Rails/AfterCommitOverride:
152
184
  Description: >-
@@ -234,12 +266,13 @@ Rails/BulkChangeTable:
234
266
  - https://api.rubyonrails.org/classes/ActiveRecord/ConnectionAdapters/Table.html
235
267
  Enabled: false # We'll maybe enable this later.
236
268
  VersionAdded: '0.57'
269
+ VersionChanged: '2.20'
237
270
  Database: null
238
271
  SupportedDatabases:
239
272
  - mysql
240
273
  - postgresql
241
274
  Include:
242
- - db/migrate/*.rb
275
+ - db/**/*.rb
243
276
 
244
277
  Rails/CompactBlank:
245
278
  Description: 'Checks if collection can be blank-compacted with `compact_blank`.'
@@ -269,18 +302,31 @@ Rails/CreateTableWithTimestamps:
269
302
  when creating a new table.
270
303
  Enabled: true
271
304
  VersionAdded: '0.52'
305
+ VersionChanged: '2.20'
272
306
  Include:
273
- - db/migrate/*.rb
307
+ - db/**/*.rb
274
308
  Exclude:
275
309
  # Respect the `active_storage_variant_records` table of `*_create_active_storage_tables.active_storage.rb`
310
+ # and `*_create_active_storage_variant_records.active_storage.rb`
276
311
  # auto-generated by `bin/rails active_storage:install` even if `created_at` is not specified.
277
- - db/migrate/*_create_active_storage_tables.active_storage.rb
312
+ - db/**/*_create_active_storage_tables.active_storage.rb
313
+ - db/**/*_create_active_storage_variant_records.active_storage.rb
314
+
315
+ Rails/DangerousColumnNames:
316
+ Description: >-
317
+ Avoid dangerous column names.
318
+ Enabled: pending
319
+ Severity: warning
320
+ VersionAdded: '2.21'
321
+ Include:
322
+ - 'db/**/*.rb'
278
323
 
279
324
  Rails/Date:
280
325
  Description: >-
281
- Checks the correct usage of date aware methods,
282
- such as Date.today, Date.current etc.
326
+ Checks the correct usage of date aware methods,
327
+ such as Date.today, Date.current etc.
283
328
  Enabled: false # It's not that simple. Really.
329
+ SafeAutoCorrect: false
284
330
  VersionAdded: '0.30'
285
331
  VersionChanged: '2.11'
286
332
  # The value `strict` disallows usage of `Date.today`, `Date.current`,
@@ -297,7 +343,6 @@ Rails/Date:
297
343
 
298
344
  Rails/DefaultScope:
299
345
  Description: 'Avoid use of `default_scope`.'
300
- StyleGuide: 'https://rails.rubystyle.guide#avoid-default-scope'
301
346
  Enabled: false
302
347
  VersionAdded: '2.7'
303
348
 
@@ -388,6 +433,11 @@ Rails/EnumUniqueness:
388
433
  Include:
389
434
  - app/models/**/*.rb
390
435
 
436
+ Rails/EnvLocal:
437
+ Description: 'Use `Rails.env.local?` instead of `Rails.env.development? || Rails.env.test?`.'
438
+ Enabled: pending
439
+ VersionAdded: '2.22'
440
+
391
441
  Rails/EnvironmentComparison:
392
442
  Description: "Favor `Rails.env.production?` over `Rails.env == 'production'`."
393
443
  Enabled: true
@@ -440,10 +490,8 @@ Rails/FindBy:
440
490
  StyleGuide: 'https://rails.rubystyle.guide#find_by'
441
491
  Enabled: false
442
492
  VersionAdded: '0.30'
443
- VersionChanged: '2.11'
493
+ VersionChanged: '2.21'
444
494
  IgnoreWhereFirst: true
445
- Include:
446
- - app/models/**/*.rb
447
495
 
448
496
  Rails/FindById:
449
497
  Description: >-
@@ -459,9 +507,7 @@ Rails/FindEach:
459
507
  Enabled: true
460
508
  Safe: false
461
509
  VersionAdded: '0.30'
462
- VersionChanged: '2.19'
463
- Include:
464
- - app/models/**/*.rb
510
+ VersionChanged: '2.21'
465
511
  AllowedMethods:
466
512
  # Methods that don't work well with `find_each`.
467
513
  - order
@@ -524,6 +570,10 @@ Rails/I18nLazyLookup:
524
570
  Reference: 'https://guides.rubyonrails.org/i18n.html#lazy-lookup'
525
571
  Enabled: true
526
572
  VersionAdded: '2.14'
573
+ EnforcedStyle: lazy
574
+ SupportedStyles:
575
+ - lazy
576
+ - explicit
527
577
  Include:
528
578
  - 'app/controllers/**/*.rb'
529
579
 
@@ -629,8 +679,9 @@ Rails/MigrationClassName:
629
679
  Description: 'The class name of the migration should match its file name.'
630
680
  Enabled: true
631
681
  VersionAdded: '2.14'
682
+ VersionChanged: '2.20'
632
683
  Include:
633
- - db/migrate/*.rb
684
+ - db/**/*.rb
634
685
 
635
686
  Rails/NegateInclude:
636
687
  Description: 'Prefer `collection.exclude?(obj)` over `!collection.include?(obj)`.'
@@ -644,8 +695,12 @@ Rails/NotNullColumn:
644
695
  Description: 'Do not add a NOT NULL column without a default value.'
645
696
  Enabled: true
646
697
  VersionAdded: '0.43'
698
+ VersionChanged: '2.20'
699
+ Database: null
700
+ SupportedDatabases:
701
+ - mysql
647
702
  Include:
648
- - db/migrate/*.rb
703
+ - db/**/*.rb
649
704
 
650
705
  Rails/OrderById:
651
706
  Description: >-
@@ -750,6 +805,16 @@ Rails/ReadWriteAttribute:
750
805
  Include:
751
806
  - app/models/**/*.rb
752
807
 
808
+ Rails/RedundantActiveRecordAllMethod:
809
+ Description: Detect redundant `all` used as a receiver for Active Record query methods.
810
+ StyleGuide: 'https://rails.rubystyle.guide/#redundant-all'
811
+ Enabled: false # While we agree that User.all.find is redundant, it can be useful to make relation access more explicit for other query methods.
812
+ Safe: false
813
+ AllowedReceivers:
814
+ - ActionMailer::Preview
815
+ - ActiveSupport::TimeZone
816
+ VersionAdded: '2.21'
817
+
753
818
  Rails/RedundantAllowNil:
754
819
  Description: >-
755
820
  Finds redundant use of `allow_nil` when `allow_blank` is set to
@@ -838,7 +903,7 @@ Rails/RequireDependency:
838
903
  VersionAdded: '2.10'
839
904
 
840
905
  Rails/ResponseParsedBody:
841
- Description: Prefer `response.parsed_body` to `JSON.parse(response.body)`.
906
+ Description: Prefer `response.parsed_body` to custom parsing logic for `response.body`.
842
907
  Enabled: true
843
908
  Safe: false
844
909
  VersionAdded: '2.18'
@@ -930,6 +995,12 @@ Rails/ScopeArgs:
930
995
  Include:
931
996
  - app/models/**/*.rb
932
997
 
998
+ Rails/SelectMap:
999
+ Description: 'Checks for uses of `select(:column_name)` with `map(&:column_name)`.'
1000
+ Enabled: pending
1001
+ Safe: false
1002
+ VersionAdded: '2.21'
1003
+
933
1004
  Rails/ShortI18n:
934
1005
  Description: 'Use the short form of the I18n methods: `t` instead of `translate` and `l` instead of `localize`.'
935
1006
  StyleGuide: 'https://rails.rubystyle.guide/#short-i18n'
@@ -1058,6 +1129,7 @@ Rails/TransactionExitStatement:
1058
1129
  - https://github.com/rails/rails/commit/15aa4200e083
1059
1130
  Enabled: true # Get a head start on deprecations: https://blog.saeloun.com/2020/04/06/rails-disallow-return-break-and-throw-to-exit-transaction.html
1060
1131
  VersionAdded: '2.14'
1132
+ TransactionMethods: []
1061
1133
 
1062
1134
  Rails/UniqBeforePluck:
1063
1135
  Description: 'Prefer the use of uniq or distinct before pluck.'
@@ -1095,6 +1167,12 @@ Rails/UnusedIgnoredColumns:
1095
1167
  Include:
1096
1168
  - app/models/**/*.rb
1097
1169
 
1170
+ Rails/UnusedRenderContent:
1171
+ Description: 'Do not specify body content for a response with a non-content status code.'
1172
+ Enabled: pending
1173
+ Severity: warning
1174
+ VersionAdded: '2.21'
1175
+
1098
1176
  Rails/Validation:
1099
1177
  Description: 'Use validates :attribute, hash of validations.'
1100
1178
  Enabled: true
@@ -1134,6 +1212,7 @@ Rails/WhereNot:
1134
1212
 
1135
1213
  Rails/WhereNotWithMultipleConditions:
1136
1214
  Description: 'Do not use `where.not(...)` with multiple conditions.'
1215
+ StyleGuide: 'https://rails.rubystyle.guide/#where-not-with-multiple-attributes'
1137
1216
  Enabled: true
1138
1217
  Severity: warning
1139
1218
  VersionAdded: '2.17'
@@ -1147,6 +1226,14 @@ Style/FormatStringToken:
1147
1226
  AllowedMethods:
1148
1227
  - redirect
1149
1228
 
1229
+ Style/InvertibleUnlessCondition:
1230
+ InverseMethods:
1231
+ # Active Support defines some common inverse methods. They are listed below:
1232
+ :present?: :blank?
1233
+ :blank?: :present?
1234
+ :include?: :exclude?
1235
+ :exclude?: :include?
1236
+
1150
1237
  Style/SymbolProc:
1151
1238
  AllowedMethods:
1152
1239
  - define_method
@@ -1,3 +1,3 @@
1
1
  module MakandraRubocop
2
- VERSION = '11.2.0'.freeze
2
+ VERSION = '12.0.0'.freeze
3
3
  end
@@ -5,7 +5,7 @@ require 'makandra_rubocop/version'
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = 'makandra-rubocop'
7
7
  spec.version = MakandraRubocop::VERSION
8
- spec.required_ruby_version = '>= 2.6.0'
8
+ spec.required_ruby_version = '>= 2.7.0'
9
9
  spec.authors = ['Arne Hartherz', 'Emanuel Denzel']
10
10
  spec.email = ['arne.hartherz@makandra.de', 'emanuel.denzel@makandra.de']
11
11
 
@@ -24,8 +24,8 @@ Gem::Specification.new do |spec|
24
24
  spec.executables = spec.files.grep(%r(^exe/)) { |f| File.basename(f) }
25
25
  spec.require_paths = ['lib']
26
26
 
27
- spec.add_dependency 'rubocop', '~> 1.36.0'
28
- spec.add_dependency 'rubocop-rails', '~> 2.19.0'
27
+ spec.add_dependency 'rubocop', '~> 1.60.0'
28
+ spec.add_dependency 'rubocop-rails', '~> 2.23.1'
29
29
  spec.add_dependency 'rubocop-rspec', '~> 2.13.2'
30
30
 
31
31
  spec.add_development_dependency 'bundler', '~> 2.0'
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: 11.2.0
4
+ version: 12.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: 2023-10-18 00:00:00.000000000 Z
12
+ date: 2024-01-17 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: 1.36.0
20
+ version: 1.60.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: 1.36.0
27
+ version: 1.60.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.19.0
34
+ version: 2.23.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.19.0
41
+ version: 2.23.1
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: rubocop-rspec
44
44
  requirement: !ruby/object:Gem::Requirement
@@ -120,14 +120,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
120
120
  requirements:
121
121
  - - ">="
122
122
  - !ruby/object:Gem::Version
123
- version: 2.6.0
123
+ version: 2.7.0
124
124
  required_rubygems_version: !ruby/object:Gem::Requirement
125
125
  requirements:
126
126
  - - ">="
127
127
  - !ruby/object:Gem::Version
128
128
  version: '0'
129
129
  requirements: []
130
- rubygems_version: 3.0.3
130
+ rubygems_version: 3.1.6
131
131
  signing_key:
132
132
  specification_version: 4
133
133
  summary: makandra's default Rubocop configuration