rubocop-rails 2.26.2 → 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 (64) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.txt +1 -1
  3. data/README.md +45 -7
  4. data/config/default.yml +87 -49
  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/add_column_index.rb +1 -0
  13. data/lib/rubocop/cop/rails/arel_star.rb +5 -5
  14. data/lib/rubocop/cop/rails/belongs_to.rb +1 -1
  15. data/lib/rubocop/cop/rails/blank.rb +1 -1
  16. data/lib/rubocop/cop/rails/bulk_change_table.rb +1 -0
  17. data/lib/rubocop/cop/rails/content_tag.rb +1 -1
  18. data/lib/rubocop/cop/rails/dangerous_column_names.rb +2 -0
  19. data/lib/rubocop/cop/rails/delegate.rb +53 -7
  20. data/lib/rubocop/cop/rails/duplicate_association.rb +8 -4
  21. data/lib/rubocop/cop/rails/eager_evaluation_log_message.rb +1 -3
  22. data/lib/rubocop/cop/rails/enum_syntax.rb +2 -0
  23. data/lib/rubocop/cop/rails/env_local.rb +26 -3
  24. data/lib/rubocop/cop/rails/file_path.rb +61 -9
  25. data/lib/rubocop/cop/rails/http_positional_arguments.rb +7 -0
  26. data/lib/rubocop/cop/rails/index_by.rb +37 -12
  27. data/lib/rubocop/cop/rails/index_with.rb +37 -12
  28. data/lib/rubocop/cop/rails/inquiry.rb +1 -1
  29. data/lib/rubocop/cop/rails/lexically_scoped_action_filter.rb +11 -1
  30. data/lib/rubocop/cop/rails/match_route.rb +1 -9
  31. data/lib/rubocop/cop/rails/multiple_route_paths.rb +50 -0
  32. data/lib/rubocop/cop/rails/not_null_column.rb +6 -2
  33. data/lib/rubocop/cop/rails/output.rb +1 -2
  34. data/lib/rubocop/cop/rails/pluck.rb +30 -4
  35. data/lib/rubocop/cop/rails/pluralization_grammar.rb +1 -1
  36. data/lib/rubocop/cop/rails/presence.rb +1 -1
  37. data/lib/rubocop/cop/rails/present.rb +1 -1
  38. data/lib/rubocop/cop/rails/redundant_active_record_all_method.rb +1 -1
  39. data/lib/rubocop/cop/rails/redundant_receiver_in_with_options.rb +6 -1
  40. data/lib/rubocop/cop/rails/reflection_class_name.rb +2 -2
  41. data/lib/rubocop/cop/rails/relative_date_constant.rb +1 -1
  42. data/lib/rubocop/cop/rails/reversible_migration.rb +4 -1
  43. data/lib/rubocop/cop/rails/root_pathname_methods.rb +6 -1
  44. data/lib/rubocop/cop/rails/save_bang.rb +8 -7
  45. data/lib/rubocop/cop/rails/schema_comment.rb +2 -1
  46. data/lib/rubocop/cop/rails/select_map.rb +3 -2
  47. data/lib/rubocop/cop/rails/skips_model_validations.rb +1 -1
  48. data/lib/rubocop/cop/rails/squished_sql_heredocs.rb +1 -1
  49. data/lib/rubocop/cop/rails/strip_heredoc.rb +1 -1
  50. data/lib/rubocop/cop/rails/strong_parameters_expect.rb +104 -0
  51. data/lib/rubocop/cop/rails/three_state_boolean_column.rb +3 -2
  52. data/lib/rubocop/cop/rails/time_zone.rb +16 -7
  53. data/lib/rubocop/cop/rails/transaction_exit_statement.rb +7 -2
  54. data/lib/rubocop/cop/rails/uniq_before_pluck.rb +10 -33
  55. data/lib/rubocop/cop/rails/unique_validation_without_index.rb +1 -1
  56. data/lib/rubocop/cop/rails/where_range.rb +1 -1
  57. data/lib/rubocop/cop/rails_cops.rb +3 -0
  58. data/lib/rubocop/rails/migration_file_skippable.rb +54 -0
  59. data/lib/rubocop/rails/plugin.rb +48 -0
  60. data/lib/rubocop/rails/version.rb +1 -1
  61. data/lib/rubocop/rails.rb +1 -8
  62. data/lib/rubocop-rails.rb +4 -5
  63. metadata +28 -12
  64. data/lib/rubocop/rails/inject.rb +0 -18
@@ -0,0 +1,104 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RuboCop
4
+ module Cop
5
+ module Rails
6
+ # Enforces the use of `ActionController::Parameters#expect` as a method for strong parameter handling.
7
+ #
8
+ # @safety
9
+ # This cop's autocorrection is considered unsafe because there are cases where the HTTP status may change
10
+ # from 500 to 400 when handling invalid parameters. This change, however, reflects an intentional
11
+ # incompatibility introduced for valid reasons by the `expect` method, which aligns better with
12
+ # strong parameter conventions.
13
+ #
14
+ # @example
15
+ #
16
+ # # bad
17
+ # params.require(:user).permit(:name, :age)
18
+ # params.permit(user: [:name, :age]).require(:user)
19
+ #
20
+ # # good
21
+ # params.expect(user: [:name, :age])
22
+ #
23
+ class StrongParametersExpect < Base
24
+ extend AutoCorrector
25
+ extend TargetRailsVersion
26
+
27
+ MSG = 'Use `%<prefer>s` instead.'
28
+ RESTRICT_ON_SEND = %i[require permit].freeze
29
+
30
+ minimum_target_rails_version 8.0
31
+
32
+ def_node_matcher :params_require_permit, <<~PATTERN
33
+ $(call
34
+ $(call
35
+ (send nil? :params) :require _) :permit _+)
36
+ PATTERN
37
+
38
+ def_node_matcher :params_permit_require, <<~PATTERN
39
+ $(call
40
+ $(call
41
+ (send nil? :params) :permit (hash (pair _require_param_name _ )))
42
+ :require _require_param_name)
43
+ PATTERN
44
+
45
+ # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
46
+ def on_send(node)
47
+ return if part_of_ignored_node?(node)
48
+
49
+ if (permit_method, require_method = params_require_permit(node))
50
+ range = offense_range(require_method, node)
51
+ prefer = expect_method(require_method, permit_method)
52
+ replace_argument = true
53
+ elsif (require_method, permit_method = params_permit_require(node))
54
+ range = offense_range(permit_method, node)
55
+ prefer = "expect(#{permit_method.arguments.map(&:source).join(', ')})"
56
+ replace_argument = false
57
+ else
58
+ return
59
+ end
60
+
61
+ add_offense(range, message: format(MSG, prefer: prefer)) do |corrector|
62
+ corrector.remove(require_method.receiver.source_range.end.join(require_method.source_range.end))
63
+ corrector.replace(permit_method.loc.selector, 'expect')
64
+ if replace_argument
65
+ corrector.insert_before(permit_method.first_argument, "#{require_key(require_method)}[")
66
+ corrector.insert_after(permit_method.last_argument, ']')
67
+ end
68
+ end
69
+
70
+ ignore_node(node)
71
+ end
72
+ # rubocop:enable Metrics/AbcSize, Metrics/MethodLength
73
+ alias on_csend on_send
74
+
75
+ private
76
+
77
+ def offense_range(method_node, node)
78
+ method_node.loc.selector.join(node.source_range.end)
79
+ end
80
+
81
+ def expect_method(require_method, permit_method)
82
+ require_key = require_key(require_method)
83
+ permit_args = permit_method.arguments.map(&:source).join(', ')
84
+
85
+ arguments = "#{require_key}[#{permit_args}]"
86
+
87
+ "expect(#{arguments})"
88
+ end
89
+
90
+ def require_key(require_method)
91
+ if (first_argument = require_method.first_argument).respond_to?(:value)
92
+ require_arg = first_argument.value
93
+ separator = ': '
94
+ else
95
+ require_arg = first_argument.source
96
+ separator = ' => '
97
+ end
98
+
99
+ "#{require_arg}#{separator}"
100
+ end
101
+ end
102
+ end
103
+ end
104
+ end
@@ -18,8 +18,9 @@ module RuboCop
18
18
  # t.boolean :active, default: true, null: false
19
19
  #
20
20
  class ThreeStateBooleanColumn < Base
21
- MSG = 'Boolean columns should always have a default value and a `NOT NULL` constraint.'
21
+ include MigrationsHelper
22
22
 
23
+ MSG = 'Boolean columns should always have a default value and a `NOT NULL` constraint.'
23
24
  RESTRICT_ON_SEND = %i[add_column column boolean].freeze
24
25
 
25
26
  def_node_matcher :three_state_boolean?, <<~PATTERN
@@ -44,7 +45,7 @@ module RuboCop
44
45
 
45
46
  return if required_options?(options_node)
46
47
 
47
- def_node = node.each_ancestor(:def, :defs).first
48
+ def_node = node.each_ancestor(:any_def).first
48
49
  table_node = table_node(node)
49
50
  return if def_node && (table_node.nil? || change_column_null?(def_node, table_node, column_node))
50
51
 
@@ -28,6 +28,8 @@ module RuboCop
28
28
  # Time.zone.now
29
29
  # Time.zone.parse('2015-03-02T19:05:37')
30
30
  # Time.zone.parse('2015-03-02T19:05:37Z') # Respect ISO 8601 format with timezone specifier.
31
+ # Time.parse('2015-03-02T19:05:37Z') # Also respects ISO 8601
32
+ # '2015-03-02T19:05:37Z'.to_time # Also respects ISO 8601
31
33
  #
32
34
  # @example EnforcedStyle: flexible (default)
33
35
  # # `flexible` allows usage of `in_time_zone` instead of `zone`.
@@ -67,6 +69,7 @@ module RuboCop
67
69
 
68
70
  def on_send(node)
69
71
  return if !node.receiver&.str_type? || !node.method?(:to_time)
72
+ return if attach_timezone_specifier?(node.receiver)
70
73
 
71
74
  add_offense(node.loc.selector, message: MSG_STRING_TO_TIME) do |corrector|
72
75
  corrector.replace(node, "Time.zone.parse(#{node.receiver.source})") unless node.csend_type?
@@ -94,11 +97,9 @@ module RuboCop
94
97
  end
95
98
 
96
99
  def autocorrect_time_new(node, corrector)
97
- if node.arguments?
98
- corrector.replace(node.loc.selector, 'local')
99
- else
100
- corrector.replace(node.loc.selector, 'now')
101
- end
100
+ replacement = replacement(node)
101
+
102
+ corrector.replace(node.loc.selector, replacement)
102
103
  end
103
104
 
104
105
  # remove redundant `.in_time_zone` from `Time.zone.now.in_time_zone`
@@ -134,7 +135,9 @@ module RuboCop
134
135
  end
135
136
 
136
137
  def attach_timezone_specifier?(date)
137
- date.respond_to?(:value) && TIMEZONE_SPECIFIER.match?(date.value.to_s)
138
+ return false unless date.respond_to?(:value)
139
+
140
+ !date.value.to_s.valid_encoding? || TIMEZONE_SPECIFIER.match?(date.value.to_s)
138
141
  end
139
142
 
140
143
  def build_message(klass, method_name, node)
@@ -180,7 +183,7 @@ module RuboCop
180
183
 
181
184
  def safe_method(method_name, node)
182
185
  if %w[new current].include?(method_name)
183
- node.arguments? ? 'local' : 'now'
186
+ replacement(node)
184
187
  else
185
188
  method_name
186
189
  end
@@ -256,6 +259,12 @@ module RuboCop
256
259
  pair.key.sym_type? && pair.key.value == :in && !pair.value.nil_type?
257
260
  end
258
261
  end
262
+
263
+ def replacement(node)
264
+ return 'now' unless node.arguments?
265
+
266
+ node.first_argument.str_type? ? 'parse' : 'local'
267
+ end
259
268
  end
260
269
  end
261
270
  end
@@ -15,6 +15,10 @@ module RuboCop
15
15
  #
16
16
  # If you are defining custom transaction methods, you can configure it with `TransactionMethods`.
17
17
  #
18
+ # NOTE: This cop is disabled on Rails >= 7.2 because transactions were restored
19
+ # to their historical behavior. In Rails 7.1, the behavior is controlled with
20
+ # the config `active_record.commit_transaction_on_non_local_return`.
21
+ #
18
22
  # @example
19
23
  # # bad
20
24
  # ApplicationRecord.transaction do
@@ -76,6 +80,7 @@ module RuboCop
76
80
  PATTERN
77
81
 
78
82
  def on_send(node)
83
+ return if target_rails_version >= 7.2
79
84
  return unless in_transaction_block?(node)
80
85
 
81
86
  exit_statements(node.parent.body).each do |statement_node|
@@ -94,7 +99,7 @@ module RuboCop
94
99
  return false unless transaction_method_name?(node.method_name)
95
100
  return false unless (parent = node.parent)
96
101
 
97
- parent.block_type? && parent.body
102
+ parent.any_block_type? && parent.body
98
103
  end
99
104
 
100
105
  def statement(statement_node)
@@ -108,7 +113,7 @@ module RuboCop
108
113
  end
109
114
 
110
115
  def nested_block?(statement_node)
111
- name = statement_node.ancestors.find(&:block_type?).children.first.method_name
116
+ name = statement_node.ancestors.find(&:any_block_type?).children.first.method_name
112
117
  !transaction_method_name?(name)
113
118
  end
114
119
 
@@ -51,51 +51,28 @@ module RuboCop
51
51
 
52
52
  MSG = 'Use `distinct` before `pluck`.'
53
53
  RESTRICT_ON_SEND = %i[uniq].freeze
54
- NEWLINE = "\n"
55
- PATTERN = '[!^block (send (send %<type>s :pluck ...) :uniq ...)]'
56
54
 
57
- def_node_matcher :conservative_node_match, format(PATTERN, type: 'const')
58
-
59
- def_node_matcher :aggressive_node_match, format(PATTERN, type: '_')
55
+ def_node_matcher :uniq_before_pluck, '[!^any_block $(send $(send _ :pluck ...) :uniq ...)]'
60
56
 
61
57
  def on_send(node)
62
- uniq = if style == :conservative
63
- conservative_node_match(node)
64
- else
65
- aggressive_node_match(node)
66
- end
67
-
68
- return unless uniq
58
+ uniq_before_pluck(node) do |uniq_node, pluck_node|
59
+ next if style == :conservative && !pluck_node.receiver&.const_type?
69
60
 
70
- add_offense(node.loc.selector) do |corrector|
71
- autocorrect(corrector, node)
61
+ add_offense(uniq_node.loc.selector) do |corrector|
62
+ autocorrect(corrector, uniq_node, pluck_node)
63
+ end
72
64
  end
73
65
  end
74
66
 
75
67
  private
76
68
 
77
- def autocorrect(corrector, node)
78
- method = node.method_name
69
+ def autocorrect(corrector, uniq_node, pluck_node)
70
+ corrector.remove(range_between(pluck_node.loc.end.end_pos, uniq_node.loc.selector.end_pos))
79
71
 
80
- corrector.remove(dot_method_with_whitespace(method, node))
81
- if (dot = node.receiver.loc.dot)
72
+ if (dot = pluck_node.loc.dot)
82
73
  corrector.insert_before(dot.begin, '.distinct')
83
74
  else
84
- corrector.insert_before(node.receiver, 'distinct.')
85
- end
86
- end
87
-
88
- def dot_method_with_whitespace(method, node)
89
- range_between(dot_method_begin_pos(method, node), node.loc.selector.end_pos)
90
- end
91
-
92
- def dot_method_begin_pos(method, node)
93
- lines = node.source.split(NEWLINE)
94
-
95
- if lines.last.strip == ".#{method}"
96
- node.source.rindex(NEWLINE)
97
- else
98
- node.loc.dot.begin_pos
75
+ corrector.insert_before(pluck_node, 'distinct.')
99
76
  end
100
77
  end
101
78
  end
@@ -73,7 +73,7 @@ module RuboCop
73
73
 
74
74
  def column_names(node, uniqueness_part)
75
75
  arg = node.first_argument
76
- return unless arg.str_type? || arg.sym_type?
76
+ return unless arg.type?(:str, :sym)
77
77
 
78
78
  ret = [arg.value]
79
79
  names_from_scope = column_names_from_scope(uniqueness_part)
@@ -89,7 +89,7 @@ module RuboCop
89
89
 
90
90
  def where_not?(node)
91
91
  receiver = node.receiver
92
- receiver&.send_type? && receiver&.method?(:where)
92
+ receiver&.send_type? && receiver.method?(:where)
93
93
  end
94
94
 
95
95
  # rubocop:disable Metrics
@@ -7,9 +7,11 @@ require_relative 'mixin/database_type_resolvable'
7
7
  require_relative 'mixin/enforce_superclass'
8
8
  require_relative 'mixin/index_method'
9
9
  require_relative 'mixin/migrations_helper'
10
+ require_relative 'mixin/routes_helper'
10
11
  require_relative 'mixin/target_rails_version'
11
12
 
12
13
  require_relative 'rails/action_controller_flash_before_render'
14
+ require_relative 'rails/strong_parameters_expect'
13
15
  require_relative 'rails/action_controller_test_case'
14
16
  require_relative 'rails/action_filter'
15
17
  require_relative 'rails/action_order'
@@ -77,6 +79,7 @@ require_relative 'rails/link_to_blank'
77
79
  require_relative 'rails/mailer_name'
78
80
  require_relative 'rails/match_route'
79
81
  require_relative 'rails/migration_class_name'
82
+ require_relative 'rails/multiple_route_paths'
80
83
  require_relative 'rails/negate_include'
81
84
  require_relative 'rails/not_null_column'
82
85
  require_relative 'rails/order_by_id'
@@ -0,0 +1,54 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RuboCop
4
+ module Rails
5
+ # This module allows cops to detect and ignore files that have already been migrated
6
+ # by leveraging the `AllCops: MigratedSchemaVersion` configuration.
7
+ #
8
+ # [source,yaml]
9
+ # -----
10
+ # AllCops:
11
+ # MigratedSchemaVersion: '20241225000000'
12
+ # -----
13
+ #
14
+ # When applied to cops, it overrides the `add_global_offense` and `add_offense` methods,
15
+ # ensuring that cops skip processing if the file is determined to be a migrated file
16
+ # based on the schema version.
17
+ #
18
+ # @api private
19
+ module MigrationFileSkippable
20
+ def add_global_offense(message = nil, severity: nil)
21
+ return if already_migrated_file?
22
+
23
+ super if method(__method__).super_method
24
+ end
25
+
26
+ def add_offense(node_or_range, message: nil, severity: nil, &block)
27
+ return if already_migrated_file?
28
+
29
+ super if method(__method__).super_method
30
+ end
31
+
32
+ def self.apply_to_cops!
33
+ RuboCop::Cop::Registry.all.each { |cop| cop.prepend(MigrationFileSkippable) }
34
+ end
35
+
36
+ private
37
+
38
+ def already_migrated_file?
39
+ return false unless migrated_schema_version
40
+
41
+ match_data = File.basename(processed_source.file_path).match(/(?<timestamp>\d{14})/)
42
+ schema_version = match_data['timestamp'] if match_data
43
+
44
+ return false unless schema_version
45
+
46
+ schema_version <= migrated_schema_version.to_s # Ignore applied migration files.
47
+ end
48
+
49
+ def migrated_schema_version
50
+ @migrated_schema_version ||= config.for_all_cops.fetch('MigratedSchemaVersion', nil)
51
+ end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'lint_roller'
4
+
5
+ module RuboCop
6
+ module Rails
7
+ # A plugin that integrates RuboCop Rails with RuboCop's plugin system.
8
+ class Plugin < LintRoller::Plugin
9
+ def about
10
+ LintRoller::About.new(
11
+ name: 'rubocop-rails',
12
+ version: Version::STRING,
13
+ homepage: 'https://github.com/rubocop/rubocop-rails',
14
+ description: 'A RuboCop extension focused on enforcing Rails best practices and coding conventions.'
15
+ )
16
+ end
17
+
18
+ def supported?(context)
19
+ context.engine == :rubocop
20
+ end
21
+
22
+ def rules(_context)
23
+ project_root = Pathname.new(__dir__).join('../../..')
24
+
25
+ ConfigObsoletion.files << project_root.join('config', 'obsoletion.yml')
26
+
27
+ # FIXME: This is a dirty hack relying on a private constant to prevent
28
+ # "Warning: AllCops does not support TargetRailsVersion parameter".
29
+ # It should be updated to a better design in the future.
30
+ without_warnings do
31
+ ConfigValidator.const_set(:COMMON_PARAMS, ConfigValidator::COMMON_PARAMS.dup << 'TargetRailsVersion')
32
+ end
33
+
34
+ LintRoller::Rules.new(type: :path, config_format: :rubocop, value: project_root.join('config', 'default.yml'))
35
+ end
36
+
37
+ private
38
+
39
+ def without_warnings
40
+ original_verbose = $VERBOSE
41
+ $VERBOSE = nil
42
+ yield
43
+ ensure
44
+ $VERBOSE = original_verbose
45
+ end
46
+ end
47
+ end
48
+ end
@@ -4,7 +4,7 @@ module RuboCop
4
4
  module Rails
5
5
  # This module holds the RuboCop Rails version information.
6
6
  module Version
7
- STRING = '2.26.2'
7
+ STRING = '2.32.0'
8
8
 
9
9
  def self.document_version
10
10
  STRING.match('\d+\.\d+').to_s
data/lib/rubocop/rails.rb CHANGED
@@ -1,14 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RuboCop
4
- # RuboCop Rails project namespace
4
+ # RuboCop Rails project namespace.
5
5
  module Rails
6
- PROJECT_ROOT = Pathname.new(__dir__).parent.parent.expand_path.freeze
7
- CONFIG_DEFAULT = PROJECT_ROOT.join('config', 'default.yml').freeze
8
- CONFIG = YAML.safe_load(CONFIG_DEFAULT.read, permitted_classes: [Regexp, Symbol]).freeze
9
-
10
- private_constant(:CONFIG_DEFAULT, :PROJECT_ROOT)
11
-
12
- ::RuboCop::ConfigObsoletion.files << PROJECT_ROOT.join('config', 'obsoletion.yml')
13
6
  end
14
7
  end
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.26.2
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-09-21 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.52.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.52.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
@@ -171,6 +185,7 @@ files:
171
185
  - lib/rubocop/cop/rails/mailer_name.rb
172
186
  - lib/rubocop/cop/rails/match_route.rb
173
187
  - lib/rubocop/cop/rails/migration_class_name.rb
188
+ - lib/rubocop/cop/rails/multiple_route_paths.rb
174
189
  - lib/rubocop/cop/rails/negate_include.rb
175
190
  - lib/rubocop/cop/rails/not_null_column.rb
176
191
  - lib/rubocop/cop/rails/order_by_id.rb
@@ -214,6 +229,7 @@ files:
214
229
  - lib/rubocop/cop/rails/skips_model_validations.rb
215
230
  - lib/rubocop/cop/rails/squished_sql_heredocs.rb
216
231
  - lib/rubocop/cop/rails/strip_heredoc.rb
232
+ - lib/rubocop/cop/rails/strong_parameters_expect.rb
217
233
  - lib/rubocop/cop/rails/table_name_assignment.rb
218
234
  - lib/rubocop/cop/rails/three_state_boolean_column.rb
219
235
  - lib/rubocop/cop/rails/time_zone.rb
@@ -236,7 +252,8 @@ files:
236
252
  - lib/rubocop/cop/rails/where_range.rb
237
253
  - lib/rubocop/cop/rails_cops.rb
238
254
  - lib/rubocop/rails.rb
239
- - lib/rubocop/rails/inject.rb
255
+ - lib/rubocop/rails/migration_file_skippable.rb
256
+ - lib/rubocop/rails/plugin.rb
240
257
  - lib/rubocop/rails/schema_loader.rb
241
258
  - lib/rubocop/rails/schema_loader/schema.rb
242
259
  - lib/rubocop/rails/version.rb
@@ -247,10 +264,10 @@ metadata:
247
264
  homepage_uri: https://docs.rubocop.org/rubocop-rails/
248
265
  changelog_uri: https://github.com/rubocop/rubocop-rails/blob/master/CHANGELOG.md
249
266
  source_code_uri: https://github.com/rubocop/rubocop-rails/
250
- documentation_uri: https://docs.rubocop.org/rubocop-rails/2.26/
267
+ documentation_uri: https://docs.rubocop.org/rubocop-rails/2.32/
251
268
  bug_tracker_uri: https://github.com/rubocop/rubocop-rails/issues
252
269
  rubygems_mfa_required: 'true'
253
- post_install_message:
270
+ default_lint_roller_plugin: RuboCop::Rails::Plugin
254
271
  rdoc_options: []
255
272
  require_paths:
256
273
  - lib
@@ -265,8 +282,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
265
282
  - !ruby/object:Gem::Version
266
283
  version: '0'
267
284
  requirements: []
268
- rubygems_version: 3.5.16
269
- signing_key:
285
+ rubygems_version: 3.6.2
270
286
  specification_version: 4
271
287
  summary: Automatic Rails code style checking tool.
272
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