makandra-rubocop 6.2.0 → 8.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.
data/config/ext/rails.yml CHANGED
@@ -23,6 +23,27 @@ AllCops:
23
23
  # as the default.
24
24
  TargetRailsVersion: ~
25
25
 
26
+ Lint/NumberConversion:
27
+ # Add Rails' duration methods to the ignore list for `Lint/NumberConversion`
28
+ # so that calling `to_i` on one of these does not register an offense.
29
+ # See: https://github.com/rubocop/rubocop/issues/8950
30
+ IgnoredMethods:
31
+ - ago
32
+ - from_now
33
+ - second
34
+ - seconds
35
+ - minute
36
+ - minutes
37
+ - hour
38
+ - hours
39
+ - day
40
+ - days
41
+ - week
42
+ - weeks
43
+ - fortnight
44
+ - fortnights
45
+ - in_milliseconds
46
+
26
47
  Rails/ActionFilter:
27
48
  Description: 'Enforces consistent use of action filter methods.'
28
49
  Enabled: true
@@ -68,6 +89,16 @@ Rails/ActiveSupportAliases:
68
89
  Enabled: false
69
90
  VersionAdded: '0.48'
70
91
 
92
+ Rails/AddColumnIndex:
93
+ Description: >-
94
+ Rails migrations don't make use of a given `index` key, but also
95
+ doesn't given an error when it's used, so it makes it seem like an
96
+ index might be used.
97
+ Enabled: true
98
+ VersionAdded: '2.11'
99
+ Include:
100
+ - db/migrate/*.rb
101
+
71
102
  Rails/AfterCommitOverride:
72
103
  Description: >-
73
104
  This cop enforces that there is only one call to `after_commit`
@@ -134,8 +165,9 @@ Rails/BelongsTo:
134
165
  Rails/Blank:
135
166
  Description: 'Enforces use of `blank?`.'
136
167
  Enabled: true
168
+ SafeAutoCorrect: false
137
169
  VersionAdded: '0.48'
138
- VersionChanged: '0.67'
170
+ VersionChanged: '2.10'
139
171
  # Convert usages of `nil? || empty?` to `blank?`
140
172
  NilOrEmpty: true
141
173
  # Convert usages of `!present?` to `blank?`
@@ -159,7 +191,7 @@ Rails/ContentTag:
159
191
  Reference:
160
192
  - 'https://github.com/rails/rails/issues/25195'
161
193
  - 'https://api.rubyonrails.org/classes/ActionView/Helpers/TagHelper.html#method-i-content_tag'
162
- Enabled: false # The Github page returned an 500 so I was not able to evaluate this cop
194
+ Enabled: false # We currently use content_tag in many applications. If content_tag should become deprecated in the future we'll have to change it anyway, but until then, we'll keep the content_tag syntax
163
195
  VersionAdded: '2.6'
164
196
 
165
197
  Rails/CreateTableWithTimestamps:
@@ -177,7 +209,7 @@ Rails/Date:
177
209
  such as Date.today, Date.current etc.
178
210
  Enabled: false # It's not that simple. Really.
179
211
  VersionAdded: '0.30'
180
- VersionChanged: '0.33'
212
+ VersionChanged: '2.11'
181
213
  # The value `strict` disallows usage of `Date.today`, `Date.current`,
182
214
  # `Date#to_time` etc.
183
215
  # The value `flexible` allows usage of `Date.current`, `Date.yesterday`, etc
@@ -187,6 +219,8 @@ Rails/Date:
187
219
  SupportedStyles:
188
220
  - strict
189
221
  - flexible
222
+ AllowToTime: false # datetime.to_time can handle timezones, but this depends on a setting, which one may not be
223
+ # aware of, see https://api.rubyonrails.org/classes/DateTime.html#method-i-to_time,
190
224
 
191
225
  Rails/DefaultScope:
192
226
  Description: 'Avoid use of `default_scope`.'
@@ -214,7 +248,7 @@ Rails/DynamicFindBy:
214
248
  StyleGuide: 'https://rails.rubystyle.guide#find_by'
215
249
  Enabled: false # We occasionally define custom find_by_* methods (e.g. `find_by_anything`) which don't work like ActiveRecord's methods.
216
250
  VersionAdded: '0.44'
217
- VersionChanged: '2.6'
251
+ VersionChanged: '2.10'
218
252
  # The `Whitelist` has been deprecated, Please use `AllowedMethods` instead.
219
253
  Whitelist:
220
254
  - find_by_sql
@@ -223,6 +257,12 @@ Rails/DynamicFindBy:
223
257
  AllowedReceivers:
224
258
  - Gem::Specification
225
259
 
260
+ Rails/EagerEvaluationLogMessage:
261
+ Description: 'Checks that blocks are used for interpolated strings passed to `Rails.logger.debug`.'
262
+ Reference: 'https://guides.rubyonrails.org/debugging_rails_applications.html#impact-of-logs-on-performance'
263
+ Enabled: true
264
+ VersionAdded: '2.11'
265
+
226
266
  Rails/EnumHash:
227
267
  Description: 'Prefer hash syntax over array syntax when defining enums.'
228
268
  StyleGuide: 'https://rails.rubystyle.guide#enums'
@@ -243,6 +283,19 @@ Rails/EnvironmentComparison:
243
283
  Enabled: true
244
284
  VersionAdded: '0.52'
245
285
 
286
+ Rails/EnvironmentVariableAccess:
287
+ Description: 'Do not access `ENV` directly after initialization.'
288
+ Enabled: false
289
+ VersionAdded: '2.10'
290
+ VersionChanged: '2.11'
291
+ Include:
292
+ - app/**/*.rb
293
+ - lib/**/*.rb
294
+ Exclude:
295
+ - lib/**/*.rake
296
+ AllowReads: false
297
+ AllowWrites: false
298
+
246
299
  Rails/Exit:
247
300
  Description: >-
248
301
  Favor `fail`, `break`, `return`, etc. over `exit` in
@@ -257,6 +310,11 @@ Rails/Exit:
257
310
  Exclude:
258
311
  - lib/**/*.rake
259
312
 
313
+ Rails/ExpandedDateRange:
314
+ Description: 'Checks for expanded date range.'
315
+ Enabled: false # We think the range syntax is clearer than using #all_year for example
316
+ VersionAdded: '2.11'
317
+
260
318
  Rails/FilePath:
261
319
  Description: 'Use `Rails.root.join` for file path joining.'
262
320
  Enabled: false
@@ -272,6 +330,8 @@ Rails/FindBy:
272
330
  StyleGuide: 'https://rails.rubystyle.guide#find_by'
273
331
  Enabled: false
274
332
  VersionAdded: '0.30'
333
+ VersionChanged: '2.11'
334
+ IgnoreWhereFirst: true
275
335
  Include:
276
336
  - app/models/**/*.rb
277
337
 
@@ -333,11 +393,20 @@ Rails/HttpStatus:
333
393
  Description: 'Enforces use of symbolic or numeric value to define HTTP status.'
334
394
  Enabled: false
335
395
  VersionAdded: '0.54'
396
+ VersionChanged: '2.11'
336
397
  EnforcedStyle: symbolic
337
398
  SupportedStyles:
338
399
  - numeric
339
400
  - symbolic
340
401
 
402
+ Rails/I18nLocaleAssignment:
403
+ Description: 'Prefer the usage of `I18n.with_locale` instead of manually updating `I18n.locale` value.'
404
+ Enabled: false
405
+ VersionAdded: '2.11'
406
+ Include:
407
+ - spec/**/*.rb
408
+ - test/**/*.rb
409
+
341
410
  Rails/IgnoredSkipActionFilterOption:
342
411
  Description: 'Checks that `if` and `only` (or `except`) are not used together as options of `skip_*` action filter.'
343
412
  Reference: 'https://api.rubyonrails.org/classes/AbstractController/Callbacks/ClassMethods.html#method-i-_normalize_callback_options'
@@ -386,7 +455,7 @@ Rails/LinkToBlank:
386
455
  - https://mathiasbynens.github.io/rel-noopener/
387
456
  - https://html.spec.whatwg.org/multipage/links.html#link-type-noopener
388
457
  - https://html.spec.whatwg.org/multipage/links.html#link-type-noreferrer
389
- Enabled: true
458
+ Enabled: false
390
459
  VersionAdded: '0.62'
391
460
 
392
461
  Rails/MailerName:
@@ -546,7 +615,9 @@ Rails/RedundantReceiverInWithOptions:
546
615
  Rails/ReflectionClassName:
547
616
  Description: 'Use a string for `class_name` option value in the definition of a reflection.'
548
617
  Enabled: true
618
+ Safe: false
549
619
  VersionAdded: '0.64'
620
+ VersionChanged: '2.10'
550
621
 
551
622
  Rails/RefuteMethods:
552
623
  Description: 'Use `assert_not` methods instead of `refute` methods.'
@@ -589,6 +660,12 @@ Rails/RequestReferer:
589
660
  - referer
590
661
  - referrer
591
662
 
663
+ Rails/RequireDependency:
664
+ Description: 'Do not use `require_dependency` when running in Zeitwerk mode. `require_dependency` is for autoloading in classic mode.'
665
+ Reference: 'https://guides.rubyonrails.org/autoloading_and_reloading_constants.html'
666
+ Enabled: false # We should enable this cop later, when all or most of our applications use zeitwerk
667
+ VersionAdded: '2.10'
668
+
592
669
  Rails/ReversibleMigration:
593
670
  Description: 'Checks whether the change method of the migration file is reversible.'
594
671
  StyleGuide: 'https://rails.rubystyle.guide#reversible-migration'
@@ -598,6 +675,13 @@ Rails/ReversibleMigration:
598
675
  Include:
599
676
  - db/migrate/*.rb
600
677
 
678
+ Rails/ReversibleMigrationMethodDefinition:
679
+ Description: 'Checks whether the migration implements either a `change` method or both an `up` and a `down` method.'
680
+ Enabled: false # If the migration starts with a class definition, no change-, up-, or down-method is recognized, although they exist
681
+ VersionAdded: '2.10'
682
+ Include:
683
+ - db/migrate/*.rb
684
+
601
685
  Rails/SafeNavigation:
602
686
  Description: "Use Ruby's safe navigation operator (`&.`) instead of `try!`."
603
687
  Enabled: false
@@ -693,13 +777,24 @@ Rails/TimeZone:
693
777
  Enabled: false
694
778
  Safe: false
695
779
  VersionAdded: '0.30'
696
- VersionChanged: '0.68'
780
+ VersionChanged: '2.10'
697
781
  # The value `strict` means that `Time` should be used with `zone`.
698
782
  # The value `flexible` allows usage of `in_time_zone` instead of `zone`.
699
783
  EnforcedStyle: flexible
700
784
  SupportedStyles:
701
785
  - strict
702
786
  - flexible
787
+ Exclude:
788
+ - '**/*.gemspec'
789
+
790
+ Rails/TimeZoneAssignment:
791
+ Description: 'Prefer the usage of `Time.use_zone` instead of manually updating `Time.zone` value.'
792
+ Reference: 'https://thoughtbot.com/blog/its-about-time-zones'
793
+ Enabled: false
794
+ VersionAdded: '2.10'
795
+ Include:
796
+ - spec/**/*.rb
797
+ - test/**/*.rb
703
798
 
704
799
  Rails/UniqBeforePluck:
705
800
  Description: 'Prefer the use of uniq or distinct before pluck.'
@@ -729,6 +824,13 @@ Rails/UnknownEnv:
729
824
  - test
730
825
  - production
731
826
 
827
+ Rails/UnusedIgnoredColumns:
828
+ Description: 'Remove a column that does not exist from `ignored_columns`.'
829
+ Enabled: true
830
+ VersionAdded: '2.11'
831
+ Include:
832
+ - app/models/**/*.rb
833
+
732
834
  Rails/Validation:
733
835
  Description: 'Use validates :attribute, hash of validations.'
734
836
  Enabled: true
@@ -742,6 +844,7 @@ Rails/WhereEquals:
742
844
  StyleGuide: 'https://rails.rubystyle.guide/#hash-conditions'
743
845
  Enabled: true
744
846
  VersionAdded: '2.9'
847
+ VersionChanged: '2.10'
745
848
 
746
849
  Rails/WhereExists:
747
850
  Description: 'Prefer `exists?(...)` over `where(...).exists?`.'
@@ -751,7 +854,7 @@ Rails/WhereExists:
751
854
  - exists
752
855
  - where
753
856
  VersionAdded: '2.7'
754
- VersionChanged: '2.8'
857
+ VersionChanged: '2.10'
755
858
 
756
859
  Rails/WhereNot:
757
860
  Description: 'Use `where.not(...)` instead of manually constructing negated SQL in `where`.'
data/config/ext/rspec.yml CHANGED
@@ -259,7 +259,9 @@ RSpec/ExampleLength:
259
259
  Description: Checks for long examples.
260
260
  Enabled: false # We do not want to have such limitation
261
261
  Max: 5
262
+ CountAsOne: []
262
263
  VersionAdded: '1.5'
264
+ VersionChanged: '2.3'
263
265
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExampleLength
264
266
 
265
267
  RSpec/ExampleWithoutDescription:
@@ -296,7 +298,7 @@ RSpec/ExpectActual:
296
298
 
297
299
  RSpec/ExpectChange:
298
300
  Description: Checks for consistent style of change matcher.
299
- Enabled: true
301
+ Enabled: false # We decided to disable this cop https://github.com/makandra/makandra-rubocop/issues/29
300
302
  EnforcedStyle: method_call
301
303
  SupportedStyles:
302
304
  - method_call
@@ -355,6 +357,12 @@ RSpec/HooksBeforeExamples:
355
357
  VersionAdded: '1.29'
356
358
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/HooksBeforeExamples
357
359
 
360
+ RSpec/IdenticalEqualityAssertion:
361
+ Description: Checks for equality assertions with identical expressions on both sides.
362
+ Enabled: true
363
+ VersionAdded: '2.4'
364
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/IdenticalEqualityAssertion
365
+
358
366
  RSpec/ImplicitBlockExpectation:
359
367
  Description: Check that implicit block expectation syntax is not used.
360
368
  Enabled: true
@@ -757,6 +765,12 @@ RSpec/FactoryBot/FactoryClassName:
757
765
  VersionChanged: '2.0'
758
766
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/FactoryClassName
759
767
 
768
+ RSpec/Rails/AvoidSetupHook:
769
+ Description: Checks that tests use RSpec `before` hook over Rails `setup` method.
770
+ Enabled: true
771
+ VersionAdded: '2.4'
772
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Rails/AvoidSetupHook
773
+
760
774
  RSpec/Rails/HttpStatus:
761
775
  Description: Enforces use of symbolic or numeric value to describe HTTP status.
762
776
  Enabled: false # This should not be enforced
@@ -1,3 +1,3 @@
1
1
  module MakandraRubocop
2
- VERSION = '6.2.0'.freeze
2
+ VERSION = '8.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.3.0'
8
+ spec.required_ruby_version = '>= 2.5.0'
9
9
  spec.authors = ['Arne Hartherz', 'Emanuel Denzel']
10
10
  spec.email = ['arne.hartherz@makandra.de', 'emanuel.denzel@makandra.de']
11
11
 
@@ -23,10 +23,11 @@ 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', '~> 1.9.1'
27
- spec.add_dependency 'rubocop-rails', '~> 2.9.1'
28
- spec.add_dependency 'rubocop-rspec', '~> 2.2.0'
26
+ spec.add_dependency 'rubocop', '~> 1.25.0'
27
+ spec.add_dependency 'rubocop-rails', '~> 2.11.3'
28
+ spec.add_dependency 'rubocop-rspec', '~> 2.4.0'
29
29
 
30
30
  spec.add_development_dependency 'bundler', '~> 2.0'
31
31
  spec.add_development_dependency 'rake', '~> 12.3'
32
+ spec.metadata['rubygems_mfa_required'] = 'true'
32
33
  end
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: 6.2.0
4
+ version: 8.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: 2021-07-20 00:00:00.000000000 Z
12
+ date: 2022-01-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rubocop
@@ -17,42 +17,42 @@ dependencies:
17
17
  requirements:
18
18
  - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: 1.9.1
20
+ version: 1.25.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.9.1
27
+ version: 1.25.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.9.1
34
+ version: 2.11.3
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.9.1
41
+ version: 2.11.3
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: rubocop-rspec
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
46
  - - "~>"
47
47
  - !ruby/object:Gem::Version
48
- version: 2.2.0
48
+ version: 2.4.0
49
49
  type: :runtime
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
53
  - - "~>"
54
54
  - !ruby/object:Gem::Version
55
- version: 2.2.0
55
+ version: 2.4.0
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: bundler
58
58
  requirement: !ruby/object:Gem::Requirement
@@ -110,7 +110,8 @@ files:
110
110
  homepage: https://github.com/makandra/makandra-rubocop
111
111
  licenses:
112
112
  - MIT
113
- metadata: {}
113
+ metadata:
114
+ rubygems_mfa_required: 'true'
114
115
  post_install_message:
115
116
  rdoc_options: []
116
117
  require_paths:
@@ -119,14 +120,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
119
120
  requirements:
120
121
  - - ">="
121
122
  - !ruby/object:Gem::Version
122
- version: 2.3.0
123
+ version: 2.5.0
123
124
  required_rubygems_version: !ruby/object:Gem::Requirement
124
125
  requirements:
125
126
  - - ">="
126
127
  - !ruby/object:Gem::Version
127
128
  version: '0'
128
129
  requirements: []
129
- rubygems_version: 3.2.19
130
+ rubygems_version: 3.0.3
130
131
  signing_key:
131
132
  specification_version: 4
132
133
  summary: makandra's default Rubocop configuration