rubocop-rails 2.25.1 → 2.32.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.
Files changed (80) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.txt +1 -1
  3. data/README.md +60 -8
  4. data/config/default.yml +103 -51
  5. data/lib/rubocop/cop/mixin/active_record_helper.rb +2 -2
  6. data/lib/rubocop/cop/mixin/active_record_migrations_helper.rb +2 -2
  7. data/lib/rubocop/cop/mixin/database_type_resolvable.rb +2 -2
  8. data/lib/rubocop/cop/mixin/enforce_superclass.rb +6 -1
  9. data/lib/rubocop/cop/mixin/index_method.rb +69 -61
  10. data/lib/rubocop/cop/mixin/routes_helper.rb +20 -0
  11. data/lib/rubocop/cop/mixin/target_rails_version.rb +3 -5
  12. data/lib/rubocop/cop/rails/action_order.rb +1 -5
  13. data/lib/rubocop/cop/rails/active_record_callbacks_order.rb +1 -5
  14. data/lib/rubocop/cop/rails/add_column_index.rb +1 -0
  15. data/lib/rubocop/cop/rails/application_record.rb +4 -0
  16. data/lib/rubocop/cop/rails/arel_star.rb +5 -5
  17. data/lib/rubocop/cop/rails/belongs_to.rb +1 -1
  18. data/lib/rubocop/cop/rails/blank.rb +1 -1
  19. data/lib/rubocop/cop/rails/bulk_change_table.rb +3 -2
  20. data/lib/rubocop/cop/rails/compact_blank.rb +29 -8
  21. data/lib/rubocop/cop/rails/content_tag.rb +1 -1
  22. data/lib/rubocop/cop/rails/dangerous_column_names.rb +2 -0
  23. data/lib/rubocop/cop/rails/date.rb +2 -2
  24. data/lib/rubocop/cop/rails/delegate.rb +53 -7
  25. data/lib/rubocop/cop/rails/duplicate_association.rb +8 -4
  26. data/lib/rubocop/cop/rails/eager_evaluation_log_message.rb +1 -3
  27. data/lib/rubocop/cop/rails/enum_hash.rb +31 -8
  28. data/lib/rubocop/cop/rails/enum_syntax.rb +130 -0
  29. data/lib/rubocop/cop/rails/enum_uniqueness.rb +29 -7
  30. data/lib/rubocop/cop/rails/env_local.rb +26 -3
  31. data/lib/rubocop/cop/rails/file_path.rb +62 -10
  32. data/lib/rubocop/cop/rails/http_positional_arguments.rb +7 -0
  33. data/lib/rubocop/cop/rails/ignored_skip_action_filter_option.rb +1 -1
  34. data/lib/rubocop/cop/rails/index_by.rb +37 -12
  35. data/lib/rubocop/cop/rails/index_with.rb +37 -12
  36. data/lib/rubocop/cop/rails/inquiry.rb +1 -1
  37. data/lib/rubocop/cop/rails/lexically_scoped_action_filter.rb +11 -1
  38. data/lib/rubocop/cop/rails/match_route.rb +1 -9
  39. data/lib/rubocop/cop/rails/multiple_route_paths.rb +50 -0
  40. data/lib/rubocop/cop/rails/not_null_column.rb +6 -2
  41. data/lib/rubocop/cop/rails/output.rb +1 -2
  42. data/lib/rubocop/cop/rails/pluck.rb +30 -4
  43. data/lib/rubocop/cop/rails/pluck_in_where.rb +17 -8
  44. data/lib/rubocop/cop/rails/pluralization_grammar.rb +30 -16
  45. data/lib/rubocop/cop/rails/presence.rb +1 -1
  46. data/lib/rubocop/cop/rails/present.rb +1 -3
  47. data/lib/rubocop/cop/rails/redundant_active_record_all_method.rb +1 -30
  48. data/lib/rubocop/cop/rails/redundant_foreign_key.rb +1 -1
  49. data/lib/rubocop/cop/rails/redundant_presence_validation_on_belongs_to.rb +9 -0
  50. data/lib/rubocop/cop/rails/redundant_receiver_in_with_options.rb +7 -2
  51. data/lib/rubocop/cop/rails/reflection_class_name.rb +3 -3
  52. data/lib/rubocop/cop/rails/relative_date_constant.rb +1 -1
  53. data/lib/rubocop/cop/rails/render_plain_text.rb +6 -3
  54. data/lib/rubocop/cop/rails/request_referer.rb +1 -1
  55. data/lib/rubocop/cop/rails/reversible_migration.rb +4 -1
  56. data/lib/rubocop/cop/rails/root_pathname_methods.rb +21 -12
  57. data/lib/rubocop/cop/rails/save_bang.rb +8 -7
  58. data/lib/rubocop/cop/rails/schema_comment.rb +2 -1
  59. data/lib/rubocop/cop/rails/select_map.rb +3 -2
  60. data/lib/rubocop/cop/rails/skips_model_validations.rb +5 -3
  61. data/lib/rubocop/cop/rails/squished_sql_heredocs.rb +1 -1
  62. data/lib/rubocop/cop/rails/strip_heredoc.rb +1 -1
  63. data/lib/rubocop/cop/rails/strong_parameters_expect.rb +104 -0
  64. data/lib/rubocop/cop/rails/three_state_boolean_column.rb +3 -2
  65. data/lib/rubocop/cop/rails/time_zone.rb +16 -7
  66. data/lib/rubocop/cop/rails/transaction_exit_statement.rb +7 -2
  67. data/lib/rubocop/cop/rails/uniq_before_pluck.rb +10 -33
  68. data/lib/rubocop/cop/rails/unique_validation_without_index.rb +1 -1
  69. data/lib/rubocop/cop/rails/validation.rb +1 -1
  70. data/lib/rubocop/cop/rails/where_equals.rb +28 -12
  71. data/lib/rubocop/cop/rails/where_not.rb +11 -6
  72. data/lib/rubocop/cop/rails/where_range.rb +7 -2
  73. data/lib/rubocop/cop/rails_cops.rb +4 -0
  74. data/lib/rubocop/rails/migration_file_skippable.rb +54 -0
  75. data/lib/rubocop/rails/plugin.rb +48 -0
  76. data/lib/rubocop/rails/version.rb +1 -1
  77. data/lib/rubocop/rails.rb +1 -8
  78. data/lib/rubocop-rails.rb +4 -5
  79. metadata +29 -12
  80. data/lib/rubocop/rails/inject.rb +0 -18
data/lib/rubocop-rails.rb CHANGED
@@ -3,18 +3,17 @@
3
3
  require 'rubocop'
4
4
  require 'rack/utils'
5
5
  require 'active_support/inflector'
6
- require 'active_support/core_ext/object/blank'
7
6
 
8
7
  require_relative 'rubocop/rails'
9
8
  require_relative 'rubocop/rails/version'
10
- require_relative 'rubocop/rails/inject'
11
9
  require_relative 'rubocop/rails/schema_loader'
12
10
  require_relative 'rubocop/rails/schema_loader/schema'
13
-
14
- RuboCop::Rails::Inject.defaults!
15
-
11
+ require_relative 'rubocop/rails/plugin'
16
12
  require_relative 'rubocop/cop/rails_cops'
17
13
 
14
+ require_relative 'rubocop/rails/migration_file_skippable'
15
+ RuboCop::Rails::MigrationFileSkippable.apply_to_cops!
16
+
18
17
  RuboCop::Cop::Style::HashExcept.minimum_target_ruby_version(2.0)
19
18
 
20
19
  RuboCop::Cop::Style::InverseMethods.singleton_class.prepend(
metadata CHANGED
@@ -1,16 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.25.1
4
+ version: 2.32.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bozhidar Batsov
8
8
  - Jonas Arvidsson
9
9
  - Yuji Nakayama
10
- autorequire:
11
10
  bindir: bin
12
11
  cert_chain: []
13
- date: 2024-06-29 00:00:00.000000000 Z
12
+ date: 2025-05-17 00:00:00.000000000 Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: activesupport
@@ -26,6 +25,20 @@ dependencies:
26
25
  - - ">="
27
26
  - !ruby/object:Gem::Version
28
27
  version: 4.2.0
28
+ - !ruby/object:Gem::Dependency
29
+ name: lint_roller
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - "~>"
33
+ - !ruby/object:Gem::Version
34
+ version: '1.1'
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - "~>"
40
+ - !ruby/object:Gem::Version
41
+ version: '1.1'
29
42
  - !ruby/object:Gem::Dependency
30
43
  name: rack
31
44
  requirement: !ruby/object:Gem::Requirement
@@ -46,7 +59,7 @@ dependencies:
46
59
  requirements:
47
60
  - - ">="
48
61
  - !ruby/object:Gem::Version
49
- version: 1.33.0
62
+ version: 1.75.0
50
63
  - - "<"
51
64
  - !ruby/object:Gem::Version
52
65
  version: '2.0'
@@ -56,7 +69,7 @@ dependencies:
56
69
  requirements:
57
70
  - - ">="
58
71
  - !ruby/object:Gem::Version
59
- version: 1.33.0
72
+ version: 1.75.0
60
73
  - - "<"
61
74
  - !ruby/object:Gem::Version
62
75
  version: '2.0'
@@ -66,7 +79,7 @@ dependencies:
66
79
  requirements:
67
80
  - - ">="
68
81
  - !ruby/object:Gem::Version
69
- version: 1.31.1
82
+ version: 1.44.0
70
83
  - - "<"
71
84
  - !ruby/object:Gem::Version
72
85
  version: '2.0'
@@ -76,7 +89,7 @@ dependencies:
76
89
  requirements:
77
90
  - - ">="
78
91
  - !ruby/object:Gem::Version
79
- version: 1.31.1
92
+ version: 1.44.0
80
93
  - - "<"
81
94
  - !ruby/object:Gem::Version
82
95
  version: '2.0'
@@ -102,6 +115,7 @@ files:
102
115
  - lib/rubocop/cop/mixin/enforce_superclass.rb
103
116
  - lib/rubocop/cop/mixin/index_method.rb
104
117
  - lib/rubocop/cop/mixin/migrations_helper.rb
118
+ - lib/rubocop/cop/mixin/routes_helper.rb
105
119
  - lib/rubocop/cop/mixin/target_rails_version.rb
106
120
  - lib/rubocop/cop/rails/action_controller_flash_before_render.rb
107
121
  - lib/rubocop/cop/rails/action_controller_test_case.rb
@@ -140,6 +154,7 @@ files:
140
154
  - lib/rubocop/cop/rails/dynamic_find_by.rb
141
155
  - lib/rubocop/cop/rails/eager_evaluation_log_message.rb
142
156
  - lib/rubocop/cop/rails/enum_hash.rb
157
+ - lib/rubocop/cop/rails/enum_syntax.rb
143
158
  - lib/rubocop/cop/rails/enum_uniqueness.rb
144
159
  - lib/rubocop/cop/rails/env_local.rb
145
160
  - lib/rubocop/cop/rails/environment_comparison.rb
@@ -170,6 +185,7 @@ files:
170
185
  - lib/rubocop/cop/rails/mailer_name.rb
171
186
  - lib/rubocop/cop/rails/match_route.rb
172
187
  - lib/rubocop/cop/rails/migration_class_name.rb
188
+ - lib/rubocop/cop/rails/multiple_route_paths.rb
173
189
  - lib/rubocop/cop/rails/negate_include.rb
174
190
  - lib/rubocop/cop/rails/not_null_column.rb
175
191
  - lib/rubocop/cop/rails/order_by_id.rb
@@ -213,6 +229,7 @@ files:
213
229
  - lib/rubocop/cop/rails/skips_model_validations.rb
214
230
  - lib/rubocop/cop/rails/squished_sql_heredocs.rb
215
231
  - lib/rubocop/cop/rails/strip_heredoc.rb
232
+ - lib/rubocop/cop/rails/strong_parameters_expect.rb
216
233
  - lib/rubocop/cop/rails/table_name_assignment.rb
217
234
  - lib/rubocop/cop/rails/three_state_boolean_column.rb
218
235
  - lib/rubocop/cop/rails/time_zone.rb
@@ -235,7 +252,8 @@ files:
235
252
  - lib/rubocop/cop/rails/where_range.rb
236
253
  - lib/rubocop/cop/rails_cops.rb
237
254
  - lib/rubocop/rails.rb
238
- - lib/rubocop/rails/inject.rb
255
+ - lib/rubocop/rails/migration_file_skippable.rb
256
+ - lib/rubocop/rails/plugin.rb
239
257
  - lib/rubocop/rails/schema_loader.rb
240
258
  - lib/rubocop/rails/schema_loader/schema.rb
241
259
  - lib/rubocop/rails/version.rb
@@ -246,10 +264,10 @@ metadata:
246
264
  homepage_uri: https://docs.rubocop.org/rubocop-rails/
247
265
  changelog_uri: https://github.com/rubocop/rubocop-rails/blob/master/CHANGELOG.md
248
266
  source_code_uri: https://github.com/rubocop/rubocop-rails/
249
- documentation_uri: https://docs.rubocop.org/rubocop-rails/2.25/
267
+ documentation_uri: https://docs.rubocop.org/rubocop-rails/2.32/
250
268
  bug_tracker_uri: https://github.com/rubocop/rubocop-rails/issues
251
269
  rubygems_mfa_required: 'true'
252
- post_install_message:
270
+ default_lint_roller_plugin: RuboCop::Rails::Plugin
253
271
  rdoc_options: []
254
272
  require_paths:
255
273
  - lib
@@ -264,8 +282,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
264
282
  - !ruby/object:Gem::Version
265
283
  version: '0'
266
284
  requirements: []
267
- rubygems_version: 3.5.11
268
- signing_key:
285
+ rubygems_version: 3.6.2
269
286
  specification_version: 4
270
287
  summary: Automatic Rails code style checking tool.
271
288
  test_files: []
@@ -1,18 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module RuboCop
4
- module Rails
5
- # Because RuboCop doesn't yet support plugins, we have to monkey patch in a
6
- # bit of our configuration.
7
- module Inject
8
- def self.defaults!
9
- path = CONFIG_DEFAULT.to_s
10
- hash = ConfigLoader.send(:load_yaml_configuration, path)
11
- config = Config.new(hash, path).tap(&:make_excludes_absolute)
12
- puts "configuration from #{path}" if ConfigLoader.debug?
13
- config = ConfigLoader.merge_with_default(config, path, unset_nil: false)
14
- ConfigLoader.instance_variable_set(:@default_configuration, config)
15
- end
16
- end
17
- end
18
- end