rubocop-rails 2.0.1 → 2.19.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE.txt +1 -1
- data/README.md +52 -5
- data/config/default.yml +726 -32
- data/config/obsoletion.yml +17 -0
- data/lib/rubocop/cop/mixin/active_record_helper.rb +106 -0
- data/lib/rubocop/cop/mixin/active_record_migrations_helper.rb +32 -0
- data/lib/rubocop/cop/mixin/class_send_node_helper.rb +20 -0
- data/lib/rubocop/cop/mixin/enforce_superclass.rb +40 -0
- data/lib/rubocop/cop/mixin/index_method.rb +165 -0
- data/lib/rubocop/cop/mixin/migrations_helper.rb +26 -0
- data/lib/rubocop/cop/rails/action_controller_flash_before_render.rb +112 -0
- data/lib/rubocop/cop/rails/action_controller_test_case.rb +47 -0
- data/lib/rubocop/cop/rails/action_filter.rb +11 -21
- data/lib/rubocop/cop/rails/action_order.rb +116 -0
- data/lib/rubocop/cop/rails/active_record_aliases.rb +23 -24
- data/lib/rubocop/cop/rails/active_record_callbacks_order.rb +143 -0
- data/lib/rubocop/cop/rails/active_record_override.rb +3 -6
- data/lib/rubocop/cop/rails/active_support_aliases.rb +13 -22
- data/lib/rubocop/cop/rails/active_support_on_load.rb +70 -0
- data/lib/rubocop/cop/rails/add_column_index.rb +61 -0
- data/lib/rubocop/cop/rails/after_commit_override.rb +81 -0
- data/lib/rubocop/cop/rails/application_controller.rb +36 -0
- data/lib/rubocop/cop/rails/application_job.rb +9 -4
- data/lib/rubocop/cop/rails/application_mailer.rb +39 -0
- data/lib/rubocop/cop/rails/application_record.rb +9 -9
- data/lib/rubocop/cop/rails/arel_star.rb +47 -0
- data/lib/rubocop/cop/rails/assert_not.rb +8 -10
- data/lib/rubocop/cop/rails/attribute_default_block_value.rb +90 -0
- data/lib/rubocop/cop/rails/belongs_to.rb +12 -24
- data/lib/rubocop/cop/rails/blank.rb +40 -36
- data/lib/rubocop/cop/rails/bulk_change_table.rb +40 -35
- data/lib/rubocop/cop/rails/compact_blank.rb +111 -0
- data/lib/rubocop/cop/rails/content_tag.rb +93 -0
- data/lib/rubocop/cop/rails/create_table_with_timestamps.rb +22 -15
- data/lib/rubocop/cop/rails/date.rb +41 -36
- data/lib/rubocop/cop/rails/default_scope.rb +61 -0
- data/lib/rubocop/cop/rails/delegate.rb +33 -29
- data/lib/rubocop/cop/rails/delegate_allow_blank.rb +9 -10
- data/lib/rubocop/cop/rails/deprecated_active_model_errors_methods.rb +168 -0
- data/lib/rubocop/cop/rails/dot_separated_keys.rb +71 -0
- data/lib/rubocop/cop/rails/duplicate_association.rb +56 -0
- data/lib/rubocop/cop/rails/duplicate_scope.rb +46 -0
- data/lib/rubocop/cop/rails/duration_arithmetic.rb +98 -0
- data/lib/rubocop/cop/rails/dynamic_find_by.rb +76 -31
- data/lib/rubocop/cop/rails/eager_evaluation_log_message.rb +82 -0
- data/lib/rubocop/cop/rails/enum_hash.rb +75 -0
- data/lib/rubocop/cop/rails/enum_uniqueness.rb +30 -12
- data/lib/rubocop/cop/rails/environment_comparison.rb +70 -22
- data/lib/rubocop/cop/rails/environment_variable_access.rb +67 -0
- data/lib/rubocop/cop/rails/exit.rb +7 -13
- data/lib/rubocop/cop/rails/expanded_date_range.rb +102 -0
- data/lib/rubocop/cop/rails/file_path.rb +48 -31
- data/lib/rubocop/cop/rails/find_by.rb +43 -24
- data/lib/rubocop/cop/rails/find_by_id.rb +94 -0
- data/lib/rubocop/cop/rails/find_each.rb +42 -18
- data/lib/rubocop/cop/rails/freeze_time.rb +79 -0
- data/lib/rubocop/cop/rails/has_and_belongs_to_many.rb +4 -3
- data/lib/rubocop/cop/rails/has_many_or_has_one_dependent.rb +62 -25
- data/lib/rubocop/cop/rails/helper_instance_variable.rb +32 -4
- data/lib/rubocop/cop/rails/http_positional_arguments.rb +61 -32
- data/lib/rubocop/cop/rails/http_status.rb +27 -23
- data/lib/rubocop/cop/rails/i18n_lazy_lookup.rb +96 -0
- data/lib/rubocop/cop/rails/i18n_locale_assignment.rb +37 -0
- data/lib/rubocop/cop/rails/i18n_locale_texts.rb +110 -0
- data/lib/rubocop/cop/rails/ignored_columns_assignment.rb +50 -0
- data/lib/rubocop/cop/rails/ignored_skip_action_filter_option.rb +9 -16
- data/lib/rubocop/cop/rails/index_by.rb +65 -0
- data/lib/rubocop/cop/rails/index_with.rb +68 -0
- data/lib/rubocop/cop/rails/inquiry.rb +39 -0
- data/lib/rubocop/cop/rails/inverse_of.rb +33 -27
- data/lib/rubocop/cop/rails/lexically_scoped_action_filter.rb +62 -32
- data/lib/rubocop/cop/rails/link_to_blank.rb +31 -32
- data/lib/rubocop/cop/rails/mailer_name.rb +90 -0
- data/lib/rubocop/cop/rails/match_route.rb +120 -0
- data/lib/rubocop/cop/rails/migration_class_name.rb +63 -0
- data/lib/rubocop/cop/rails/negate_include.rb +42 -0
- data/lib/rubocop/cop/rails/not_null_column.rb +16 -12
- data/lib/rubocop/cop/rails/order_by_id.rb +51 -0
- data/lib/rubocop/cop/rails/output.rb +29 -10
- data/lib/rubocop/cop/rails/output_safety.rb +9 -4
- data/lib/rubocop/cop/rails/pick.rb +64 -0
- data/lib/rubocop/cop/rails/pluck.rb +96 -0
- data/lib/rubocop/cop/rails/pluck_id.rb +59 -0
- data/lib/rubocop/cop/rails/pluck_in_where.rb +71 -0
- data/lib/rubocop/cop/rails/pluralization_grammar.rb +14 -19
- data/lib/rubocop/cop/rails/presence.rb +54 -26
- data/lib/rubocop/cop/rails/present.rb +40 -37
- data/lib/rubocop/cop/rails/rake_environment.rb +112 -0
- data/lib/rubocop/cop/rails/read_write_attribute.rb +56 -18
- data/lib/rubocop/cop/rails/redundant_allow_nil.rb +33 -45
- data/lib/rubocop/cop/rails/redundant_foreign_key.rb +77 -0
- data/lib/rubocop/cop/rails/redundant_presence_validation_on_belongs_to.rb +257 -0
- data/lib/rubocop/cop/rails/redundant_receiver_in_with_options.rb +34 -32
- data/lib/rubocop/cop/rails/redundant_travel_back.rb +57 -0
- data/lib/rubocop/cop/rails/reflection_class_name.rb +56 -7
- data/lib/rubocop/cop/rails/refute_methods.rb +56 -35
- data/lib/rubocop/cop/rails/relative_date_constant.rb +52 -33
- data/lib/rubocop/cop/rails/render_inline.rb +41 -0
- data/lib/rubocop/cop/rails/render_plain_text.rb +71 -0
- data/lib/rubocop/cop/rails/request_referer.rb +10 -11
- data/lib/rubocop/cop/rails/require_dependency.rb +38 -0
- data/lib/rubocop/cop/rails/response_parsed_body.rb +57 -0
- data/lib/rubocop/cop/rails/reversible_migration.rb +122 -82
- data/lib/rubocop/cop/rails/reversible_migration_method_definition.rb +66 -0
- data/lib/rubocop/cop/rails/root_join_chain.rb +72 -0
- data/lib/rubocop/cop/rails/root_pathname_methods.rb +238 -0
- data/lib/rubocop/cop/rails/root_public_path.rb +59 -0
- data/lib/rubocop/cop/rails/safe_navigation.rb +55 -43
- data/lib/rubocop/cop/rails/safe_navigation_with_blank.rb +50 -0
- data/lib/rubocop/cop/rails/save_bang.rb +89 -63
- data/lib/rubocop/cop/rails/schema_comment.rb +104 -0
- data/lib/rubocop/cop/rails/scope_args.rb +8 -3
- data/lib/rubocop/cop/rails/short_i18n.rb +71 -0
- data/lib/rubocop/cop/rails/skips_model_validations.rb +53 -16
- data/lib/rubocop/cop/rails/squished_sql_heredocs.rb +87 -0
- data/lib/rubocop/cop/rails/strip_heredoc.rb +56 -0
- data/lib/rubocop/cop/rails/table_name_assignment.rb +44 -0
- data/lib/rubocop/cop/rails/three_state_boolean_column.rb +73 -0
- data/lib/rubocop/cop/rails/time_zone.rb +83 -67
- data/lib/rubocop/cop/rails/time_zone_assignment.rb +37 -0
- data/lib/rubocop/cop/rails/to_formatted_s.rb +46 -0
- data/lib/rubocop/cop/rails/to_s_with_argument.rb +78 -0
- data/lib/rubocop/cop/rails/top_level_hash_with_indifferent_access.rb +49 -0
- data/lib/rubocop/cop/rails/transaction_exit_statement.rb +99 -0
- data/lib/rubocop/cop/rails/uniq_before_pluck.rb +40 -49
- data/lib/rubocop/cop/rails/unique_validation_without_index.rb +172 -0
- data/lib/rubocop/cop/rails/unknown_env.rb +52 -21
- data/lib/rubocop/cop/rails/unused_ignored_columns.rb +76 -0
- data/lib/rubocop/cop/rails/validation.rb +54 -23
- data/lib/rubocop/cop/rails/where_equals.rb +102 -0
- data/lib/rubocop/cop/rails/where_exists.rb +138 -0
- data/lib/rubocop/cop/rails/where_missing.rb +118 -0
- data/lib/rubocop/cop/rails/where_not.rb +101 -0
- data/lib/rubocop/cop/rails/where_not_with_multiple_conditions.rb +55 -0
- data/lib/rubocop/cop/rails_cops.rb +78 -8
- data/lib/rubocop/rails/inject.rb +1 -1
- data/lib/rubocop/rails/schema_loader/schema.rb +191 -0
- data/lib/rubocop/rails/schema_loader.rb +61 -0
- data/lib/rubocop/rails/version.rb +5 -1
- data/lib/rubocop/rails.rb +3 -1
- data/lib/rubocop-rails.rb +22 -0
- metadata +120 -19
- data/bin/setup +0 -7
@@ -0,0 +1,191 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RuboCop
|
4
|
+
module Rails
|
5
|
+
module SchemaLoader
|
6
|
+
# Represent db/schema.rb
|
7
|
+
class Schema
|
8
|
+
attr_reader :tables, :add_indices
|
9
|
+
|
10
|
+
def initialize(ast)
|
11
|
+
@tables = []
|
12
|
+
@add_indices = []
|
13
|
+
|
14
|
+
build!(ast)
|
15
|
+
end
|
16
|
+
|
17
|
+
def table_by(name:)
|
18
|
+
tables.find do |table|
|
19
|
+
table.name == name
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def add_indices_by(table_name:)
|
24
|
+
add_indices.select do |add_index|
|
25
|
+
add_index.table_name == table_name
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def build!(ast)
|
32
|
+
raise "Unexpected type: #{ast.type}" unless ast.block_type?
|
33
|
+
|
34
|
+
each_table(ast) do |table_def|
|
35
|
+
next unless table_def.method?(:create_table)
|
36
|
+
|
37
|
+
@tables << Table.new(table_def)
|
38
|
+
end
|
39
|
+
|
40
|
+
# Compatibility for Rails 4.2.
|
41
|
+
each_add_index(ast) do |add_index_def|
|
42
|
+
@add_indices << AddIndex.new(add_index_def)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def each_table(ast)
|
47
|
+
case ast.body.type
|
48
|
+
when :begin
|
49
|
+
ast.body.children.each do |node|
|
50
|
+
next unless node.block_type? && node.method?(:create_table)
|
51
|
+
|
52
|
+
yield(node)
|
53
|
+
end
|
54
|
+
else
|
55
|
+
yield ast.body
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def each_add_index(ast)
|
60
|
+
ast.body.children.each do |node|
|
61
|
+
next unless node.respond_to?(:send_type?)
|
62
|
+
next if !node&.send_type? || !node.method?(:add_index)
|
63
|
+
|
64
|
+
yield(node)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
# Represent a table
|
70
|
+
class Table
|
71
|
+
attr_reader :name, :columns, :indices
|
72
|
+
|
73
|
+
def initialize(node)
|
74
|
+
@name = node.send_node.first_argument.value
|
75
|
+
@columns = build_columns(node)
|
76
|
+
@indices = build_indices(node)
|
77
|
+
end
|
78
|
+
|
79
|
+
def with_column?(name:)
|
80
|
+
@columns.any? { |c| c.name == name }
|
81
|
+
end
|
82
|
+
|
83
|
+
private
|
84
|
+
|
85
|
+
def build_columns(node)
|
86
|
+
each_content(node).map do |child|
|
87
|
+
next unless child&.send_type?
|
88
|
+
next if child.method?(:index)
|
89
|
+
|
90
|
+
Column.new(child)
|
91
|
+
end.compact
|
92
|
+
end
|
93
|
+
|
94
|
+
def build_indices(node)
|
95
|
+
each_content(node).map do |child|
|
96
|
+
next unless child&.send_type?
|
97
|
+
next unless child.method?(:index)
|
98
|
+
|
99
|
+
Index.new(child)
|
100
|
+
end.compact
|
101
|
+
end
|
102
|
+
|
103
|
+
def each_content(node, &block)
|
104
|
+
return enum_for(__method__, node) unless block
|
105
|
+
|
106
|
+
case node.body&.type
|
107
|
+
when :begin
|
108
|
+
node.body.children.each(&block)
|
109
|
+
else
|
110
|
+
yield(node.body)
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
# Represent a column
|
116
|
+
class Column
|
117
|
+
attr_reader :name, :type, :not_null
|
118
|
+
|
119
|
+
def initialize(node)
|
120
|
+
@name = node.first_argument.str_content
|
121
|
+
@type = node.method_name
|
122
|
+
@not_null = nil
|
123
|
+
|
124
|
+
analyze_keywords!(node)
|
125
|
+
end
|
126
|
+
|
127
|
+
private
|
128
|
+
|
129
|
+
def analyze_keywords!(node)
|
130
|
+
pairs = node.arguments.last
|
131
|
+
return unless pairs.hash_type?
|
132
|
+
|
133
|
+
pairs.each_pair do |k, v|
|
134
|
+
@not_null = !v.true_type? if k.value == :null
|
135
|
+
end
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
# Represent an index
|
140
|
+
class Index
|
141
|
+
attr_reader :name, :columns, :expression, :unique
|
142
|
+
|
143
|
+
def initialize(node)
|
144
|
+
@columns, @expression = build_columns_or_expr(node.first_argument)
|
145
|
+
@unique = nil
|
146
|
+
|
147
|
+
analyze_keywords!(node)
|
148
|
+
end
|
149
|
+
|
150
|
+
private
|
151
|
+
|
152
|
+
def build_columns_or_expr(columns)
|
153
|
+
if columns.array_type?
|
154
|
+
[columns.values.map(&:value), nil]
|
155
|
+
else
|
156
|
+
[[], columns.value]
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
160
|
+
def analyze_keywords!(node)
|
161
|
+
pairs = node.arguments.last
|
162
|
+
return unless pairs.hash_type?
|
163
|
+
|
164
|
+
pairs.each_pair do |k, v|
|
165
|
+
case k.value
|
166
|
+
when :name
|
167
|
+
@name = v.value
|
168
|
+
when :unique
|
169
|
+
@unique = true
|
170
|
+
end
|
171
|
+
end
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
175
|
+
# Represent an `add_index`
|
176
|
+
class AddIndex < Index
|
177
|
+
attr_reader :table_name
|
178
|
+
|
179
|
+
def initialize(node)
|
180
|
+
super(node)
|
181
|
+
|
182
|
+
@table_name = node.first_argument.value
|
183
|
+
@columns, @expression = build_columns_or_expr(node.arguments[1])
|
184
|
+
@unique = nil
|
185
|
+
|
186
|
+
analyze_keywords!(node)
|
187
|
+
end
|
188
|
+
end
|
189
|
+
end
|
190
|
+
end
|
191
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RuboCop
|
4
|
+
module Rails
|
5
|
+
# It loads db/schema.rb and return Schema object.
|
6
|
+
# Cops refers database schema information with this module.
|
7
|
+
module SchemaLoader
|
8
|
+
extend self
|
9
|
+
|
10
|
+
# It parses `db/schema.rb` and return it.
|
11
|
+
# It returns `nil` if it can't find `db/schema.rb`.
|
12
|
+
# So a cop that uses the loader should handle `nil` properly.
|
13
|
+
#
|
14
|
+
# @return [Schema, nil]
|
15
|
+
def load(target_ruby_version)
|
16
|
+
return @load if defined?(@load)
|
17
|
+
|
18
|
+
@load = load!(target_ruby_version)
|
19
|
+
end
|
20
|
+
|
21
|
+
def reset!
|
22
|
+
return unless instance_variable_defined?(:@load)
|
23
|
+
|
24
|
+
remove_instance_variable(:@load)
|
25
|
+
end
|
26
|
+
|
27
|
+
def db_schema_path
|
28
|
+
path = Pathname.pwd
|
29
|
+
until path.root?
|
30
|
+
schema_path = path.join('db/schema.rb')
|
31
|
+
return schema_path if schema_path.exist?
|
32
|
+
|
33
|
+
path = path.join('../').cleanpath
|
34
|
+
end
|
35
|
+
|
36
|
+
nil
|
37
|
+
end
|
38
|
+
|
39
|
+
private
|
40
|
+
|
41
|
+
def load!(target_ruby_version)
|
42
|
+
path = db_schema_path
|
43
|
+
return unless path
|
44
|
+
|
45
|
+
ast = parse(path, target_ruby_version)
|
46
|
+
Schema.new(ast)
|
47
|
+
end
|
48
|
+
|
49
|
+
def parse(path, target_ruby_version)
|
50
|
+
klass_name = :"Ruby#{target_ruby_version.to_s.sub('.', '')}"
|
51
|
+
klass = ::Parser.const_get(klass_name)
|
52
|
+
parser = klass.new(RuboCop::AST::Builder.new)
|
53
|
+
|
54
|
+
buffer = Parser::Source::Buffer.new(path, 1)
|
55
|
+
buffer.source = path.read
|
56
|
+
|
57
|
+
parser.parse(buffer)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
data/lib/rubocop/rails.rb
CHANGED
@@ -5,8 +5,10 @@ module RuboCop
|
|
5
5
|
module Rails
|
6
6
|
PROJECT_ROOT = Pathname.new(__dir__).parent.parent.expand_path.freeze
|
7
7
|
CONFIG_DEFAULT = PROJECT_ROOT.join('config', 'default.yml').freeze
|
8
|
-
CONFIG = YAML.safe_load(CONFIG_DEFAULT.read).freeze
|
8
|
+
CONFIG = YAML.safe_load(CONFIG_DEFAULT.read, permitted_classes: [Regexp, Symbol]).freeze
|
9
9
|
|
10
10
|
private_constant(:CONFIG_DEFAULT, :PROJECT_ROOT)
|
11
|
+
|
12
|
+
::RuboCop::ConfigObsoletion.files << PROJECT_ROOT.join('config', 'obsoletion.yml')
|
11
13
|
end
|
12
14
|
end
|
data/lib/rubocop-rails.rb
CHANGED
@@ -2,11 +2,33 @@
|
|
2
2
|
|
3
3
|
require 'rubocop'
|
4
4
|
require 'rack/utils'
|
5
|
+
require 'active_support/inflector'
|
6
|
+
require 'active_support/core_ext/object/blank'
|
5
7
|
|
6
8
|
require_relative 'rubocop/rails'
|
7
9
|
require_relative 'rubocop/rails/version'
|
8
10
|
require_relative 'rubocop/rails/inject'
|
11
|
+
require_relative 'rubocop/rails/schema_loader'
|
12
|
+
require_relative 'rubocop/rails/schema_loader/schema'
|
9
13
|
|
10
14
|
RuboCop::Rails::Inject.defaults!
|
11
15
|
|
12
16
|
require_relative 'rubocop/cop/rails_cops'
|
17
|
+
|
18
|
+
RuboCop::Cop::Style::HashExcept.minimum_target_ruby_version(2.0)
|
19
|
+
|
20
|
+
RuboCop::Cop::Style::MethodCallWithArgsParentheses.singleton_class.prepend(
|
21
|
+
Module.new do
|
22
|
+
def autocorrect_incompatible_with
|
23
|
+
super.push(RuboCop::Cop::Rails::EagerEvaluationLogMessage)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
)
|
27
|
+
|
28
|
+
RuboCop::Cop::Style::RedundantSelf.singleton_class.prepend(
|
29
|
+
Module.new do
|
30
|
+
def autocorrect_incompatible_with
|
31
|
+
super.push(RuboCop::Cop::Rails::SafeNavigation)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
)
|
metadata
CHANGED
@@ -1,17 +1,31 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.19.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bozhidar Batsov
|
8
8
|
- Jonas Arvidsson
|
9
9
|
- Yuji Nakayama
|
10
|
-
autorequire:
|
10
|
+
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2023-04-16 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: activesupport
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
|
+
requirements:
|
19
|
+
- - ">="
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 4.2.0
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
version: 4.2.0
|
15
29
|
- !ruby/object:Gem::Dependency
|
16
30
|
name: rack
|
17
31
|
requirement: !ruby/object:Gem::Requirement
|
@@ -32,17 +46,23 @@ dependencies:
|
|
32
46
|
requirements:
|
33
47
|
- - ">="
|
34
48
|
- !ruby/object:Gem::Version
|
35
|
-
version:
|
49
|
+
version: 1.33.0
|
50
|
+
- - "<"
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '2.0'
|
36
53
|
type: :runtime
|
37
54
|
prerelease: false
|
38
55
|
version_requirements: !ruby/object:Gem::Requirement
|
39
56
|
requirements:
|
40
57
|
- - ">="
|
41
58
|
- !ruby/object:Gem::Version
|
42
|
-
version:
|
43
|
-
|
44
|
-
|
45
|
-
|
59
|
+
version: 1.33.0
|
60
|
+
- - "<"
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '2.0'
|
63
|
+
description: |
|
64
|
+
Automatic Rails code style checking tool.
|
65
|
+
A RuboCop extension focused on enforcing Rails best practices and coding conventions.
|
46
66
|
email: rubocop@googlegroups.com
|
47
67
|
executables: []
|
48
68
|
extensions: []
|
@@ -52,76 +72,157 @@ extra_rdoc_files:
|
|
52
72
|
files:
|
53
73
|
- LICENSE.txt
|
54
74
|
- README.md
|
55
|
-
- bin/setup
|
56
75
|
- config/default.yml
|
76
|
+
- config/obsoletion.yml
|
57
77
|
- lib/rubocop-rails.rb
|
78
|
+
- lib/rubocop/cop/mixin/active_record_helper.rb
|
79
|
+
- lib/rubocop/cop/mixin/active_record_migrations_helper.rb
|
80
|
+
- lib/rubocop/cop/mixin/class_send_node_helper.rb
|
81
|
+
- lib/rubocop/cop/mixin/enforce_superclass.rb
|
82
|
+
- lib/rubocop/cop/mixin/index_method.rb
|
83
|
+
- lib/rubocop/cop/mixin/migrations_helper.rb
|
58
84
|
- lib/rubocop/cop/mixin/target_rails_version.rb
|
85
|
+
- lib/rubocop/cop/rails/action_controller_flash_before_render.rb
|
86
|
+
- lib/rubocop/cop/rails/action_controller_test_case.rb
|
59
87
|
- lib/rubocop/cop/rails/action_filter.rb
|
88
|
+
- lib/rubocop/cop/rails/action_order.rb
|
60
89
|
- lib/rubocop/cop/rails/active_record_aliases.rb
|
90
|
+
- lib/rubocop/cop/rails/active_record_callbacks_order.rb
|
61
91
|
- lib/rubocop/cop/rails/active_record_override.rb
|
62
92
|
- lib/rubocop/cop/rails/active_support_aliases.rb
|
93
|
+
- lib/rubocop/cop/rails/active_support_on_load.rb
|
94
|
+
- lib/rubocop/cop/rails/add_column_index.rb
|
95
|
+
- lib/rubocop/cop/rails/after_commit_override.rb
|
96
|
+
- lib/rubocop/cop/rails/application_controller.rb
|
63
97
|
- lib/rubocop/cop/rails/application_job.rb
|
98
|
+
- lib/rubocop/cop/rails/application_mailer.rb
|
64
99
|
- lib/rubocop/cop/rails/application_record.rb
|
100
|
+
- lib/rubocop/cop/rails/arel_star.rb
|
65
101
|
- lib/rubocop/cop/rails/assert_not.rb
|
102
|
+
- lib/rubocop/cop/rails/attribute_default_block_value.rb
|
66
103
|
- lib/rubocop/cop/rails/belongs_to.rb
|
67
104
|
- lib/rubocop/cop/rails/blank.rb
|
68
105
|
- lib/rubocop/cop/rails/bulk_change_table.rb
|
106
|
+
- lib/rubocop/cop/rails/compact_blank.rb
|
107
|
+
- lib/rubocop/cop/rails/content_tag.rb
|
69
108
|
- lib/rubocop/cop/rails/create_table_with_timestamps.rb
|
70
109
|
- lib/rubocop/cop/rails/date.rb
|
110
|
+
- lib/rubocop/cop/rails/default_scope.rb
|
71
111
|
- lib/rubocop/cop/rails/delegate.rb
|
72
112
|
- lib/rubocop/cop/rails/delegate_allow_blank.rb
|
113
|
+
- lib/rubocop/cop/rails/deprecated_active_model_errors_methods.rb
|
114
|
+
- lib/rubocop/cop/rails/dot_separated_keys.rb
|
115
|
+
- lib/rubocop/cop/rails/duplicate_association.rb
|
116
|
+
- lib/rubocop/cop/rails/duplicate_scope.rb
|
117
|
+
- lib/rubocop/cop/rails/duration_arithmetic.rb
|
73
118
|
- lib/rubocop/cop/rails/dynamic_find_by.rb
|
119
|
+
- lib/rubocop/cop/rails/eager_evaluation_log_message.rb
|
120
|
+
- lib/rubocop/cop/rails/enum_hash.rb
|
74
121
|
- lib/rubocop/cop/rails/enum_uniqueness.rb
|
75
122
|
- lib/rubocop/cop/rails/environment_comparison.rb
|
123
|
+
- lib/rubocop/cop/rails/environment_variable_access.rb
|
76
124
|
- lib/rubocop/cop/rails/exit.rb
|
125
|
+
- lib/rubocop/cop/rails/expanded_date_range.rb
|
77
126
|
- lib/rubocop/cop/rails/file_path.rb
|
78
127
|
- lib/rubocop/cop/rails/find_by.rb
|
128
|
+
- lib/rubocop/cop/rails/find_by_id.rb
|
79
129
|
- lib/rubocop/cop/rails/find_each.rb
|
130
|
+
- lib/rubocop/cop/rails/freeze_time.rb
|
80
131
|
- lib/rubocop/cop/rails/has_and_belongs_to_many.rb
|
81
132
|
- lib/rubocop/cop/rails/has_many_or_has_one_dependent.rb
|
82
133
|
- lib/rubocop/cop/rails/helper_instance_variable.rb
|
83
134
|
- lib/rubocop/cop/rails/http_positional_arguments.rb
|
84
135
|
- lib/rubocop/cop/rails/http_status.rb
|
136
|
+
- lib/rubocop/cop/rails/i18n_lazy_lookup.rb
|
137
|
+
- lib/rubocop/cop/rails/i18n_locale_assignment.rb
|
138
|
+
- lib/rubocop/cop/rails/i18n_locale_texts.rb
|
139
|
+
- lib/rubocop/cop/rails/ignored_columns_assignment.rb
|
85
140
|
- lib/rubocop/cop/rails/ignored_skip_action_filter_option.rb
|
141
|
+
- lib/rubocop/cop/rails/index_by.rb
|
142
|
+
- lib/rubocop/cop/rails/index_with.rb
|
143
|
+
- lib/rubocop/cop/rails/inquiry.rb
|
86
144
|
- lib/rubocop/cop/rails/inverse_of.rb
|
87
145
|
- lib/rubocop/cop/rails/lexically_scoped_action_filter.rb
|
88
146
|
- lib/rubocop/cop/rails/link_to_blank.rb
|
147
|
+
- lib/rubocop/cop/rails/mailer_name.rb
|
148
|
+
- lib/rubocop/cop/rails/match_route.rb
|
149
|
+
- lib/rubocop/cop/rails/migration_class_name.rb
|
150
|
+
- lib/rubocop/cop/rails/negate_include.rb
|
89
151
|
- lib/rubocop/cop/rails/not_null_column.rb
|
152
|
+
- lib/rubocop/cop/rails/order_by_id.rb
|
90
153
|
- lib/rubocop/cop/rails/output.rb
|
91
154
|
- lib/rubocop/cop/rails/output_safety.rb
|
155
|
+
- lib/rubocop/cop/rails/pick.rb
|
156
|
+
- lib/rubocop/cop/rails/pluck.rb
|
157
|
+
- lib/rubocop/cop/rails/pluck_id.rb
|
158
|
+
- lib/rubocop/cop/rails/pluck_in_where.rb
|
92
159
|
- lib/rubocop/cop/rails/pluralization_grammar.rb
|
93
160
|
- lib/rubocop/cop/rails/presence.rb
|
94
161
|
- lib/rubocop/cop/rails/present.rb
|
162
|
+
- lib/rubocop/cop/rails/rake_environment.rb
|
95
163
|
- lib/rubocop/cop/rails/read_write_attribute.rb
|
96
164
|
- lib/rubocop/cop/rails/redundant_allow_nil.rb
|
165
|
+
- lib/rubocop/cop/rails/redundant_foreign_key.rb
|
166
|
+
- lib/rubocop/cop/rails/redundant_presence_validation_on_belongs_to.rb
|
97
167
|
- lib/rubocop/cop/rails/redundant_receiver_in_with_options.rb
|
168
|
+
- lib/rubocop/cop/rails/redundant_travel_back.rb
|
98
169
|
- lib/rubocop/cop/rails/reflection_class_name.rb
|
99
170
|
- lib/rubocop/cop/rails/refute_methods.rb
|
100
171
|
- lib/rubocop/cop/rails/relative_date_constant.rb
|
172
|
+
- lib/rubocop/cop/rails/render_inline.rb
|
173
|
+
- lib/rubocop/cop/rails/render_plain_text.rb
|
101
174
|
- lib/rubocop/cop/rails/request_referer.rb
|
175
|
+
- lib/rubocop/cop/rails/require_dependency.rb
|
176
|
+
- lib/rubocop/cop/rails/response_parsed_body.rb
|
102
177
|
- lib/rubocop/cop/rails/reversible_migration.rb
|
178
|
+
- lib/rubocop/cop/rails/reversible_migration_method_definition.rb
|
179
|
+
- lib/rubocop/cop/rails/root_join_chain.rb
|
180
|
+
- lib/rubocop/cop/rails/root_pathname_methods.rb
|
181
|
+
- lib/rubocop/cop/rails/root_public_path.rb
|
103
182
|
- lib/rubocop/cop/rails/safe_navigation.rb
|
183
|
+
- lib/rubocop/cop/rails/safe_navigation_with_blank.rb
|
104
184
|
- lib/rubocop/cop/rails/save_bang.rb
|
185
|
+
- lib/rubocop/cop/rails/schema_comment.rb
|
105
186
|
- lib/rubocop/cop/rails/scope_args.rb
|
187
|
+
- lib/rubocop/cop/rails/short_i18n.rb
|
106
188
|
- lib/rubocop/cop/rails/skips_model_validations.rb
|
189
|
+
- lib/rubocop/cop/rails/squished_sql_heredocs.rb
|
190
|
+
- lib/rubocop/cop/rails/strip_heredoc.rb
|
191
|
+
- lib/rubocop/cop/rails/table_name_assignment.rb
|
192
|
+
- lib/rubocop/cop/rails/three_state_boolean_column.rb
|
107
193
|
- lib/rubocop/cop/rails/time_zone.rb
|
194
|
+
- lib/rubocop/cop/rails/time_zone_assignment.rb
|
195
|
+
- lib/rubocop/cop/rails/to_formatted_s.rb
|
196
|
+
- lib/rubocop/cop/rails/to_s_with_argument.rb
|
197
|
+
- lib/rubocop/cop/rails/top_level_hash_with_indifferent_access.rb
|
198
|
+
- lib/rubocop/cop/rails/transaction_exit_statement.rb
|
108
199
|
- lib/rubocop/cop/rails/uniq_before_pluck.rb
|
200
|
+
- lib/rubocop/cop/rails/unique_validation_without_index.rb
|
109
201
|
- lib/rubocop/cop/rails/unknown_env.rb
|
202
|
+
- lib/rubocop/cop/rails/unused_ignored_columns.rb
|
110
203
|
- lib/rubocop/cop/rails/validation.rb
|
204
|
+
- lib/rubocop/cop/rails/where_equals.rb
|
205
|
+
- lib/rubocop/cop/rails/where_exists.rb
|
206
|
+
- lib/rubocop/cop/rails/where_missing.rb
|
207
|
+
- lib/rubocop/cop/rails/where_not.rb
|
208
|
+
- lib/rubocop/cop/rails/where_not_with_multiple_conditions.rb
|
111
209
|
- lib/rubocop/cop/rails_cops.rb
|
112
210
|
- lib/rubocop/rails.rb
|
113
211
|
- lib/rubocop/rails/inject.rb
|
212
|
+
- lib/rubocop/rails/schema_loader.rb
|
213
|
+
- lib/rubocop/rails/schema_loader/schema.rb
|
114
214
|
- lib/rubocop/rails/version.rb
|
115
|
-
homepage: https://github.com/rubocop
|
215
|
+
homepage: https://github.com/rubocop/rubocop-rails
|
116
216
|
licenses:
|
117
217
|
- MIT
|
118
218
|
metadata:
|
119
|
-
homepage_uri: https://docs.rubocop.org/
|
120
|
-
changelog_uri: https://github.com/rubocop
|
121
|
-
source_code_uri: https://github.com/rubocop
|
122
|
-
documentation_uri: https://docs.rubocop.org/
|
123
|
-
bug_tracker_uri: https://github.com/rubocop
|
124
|
-
|
219
|
+
homepage_uri: https://docs.rubocop.org/rubocop-rails/
|
220
|
+
changelog_uri: https://github.com/rubocop/rubocop-rails/blob/master/CHANGELOG.md
|
221
|
+
source_code_uri: https://github.com/rubocop/rubocop-rails/
|
222
|
+
documentation_uri: https://docs.rubocop.org/rubocop-rails/2.19/
|
223
|
+
bug_tracker_uri: https://github.com/rubocop/rubocop-rails/issues
|
224
|
+
rubygems_mfa_required: 'true'
|
225
|
+
post_install_message:
|
125
226
|
rdoc_options: []
|
126
227
|
require_paths:
|
127
228
|
- lib
|
@@ -129,15 +230,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
129
230
|
requirements:
|
130
231
|
- - ">="
|
131
232
|
- !ruby/object:Gem::Version
|
132
|
-
version: 2.
|
233
|
+
version: 2.6.0
|
133
234
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
134
235
|
requirements:
|
135
236
|
- - ">="
|
136
237
|
- !ruby/object:Gem::Version
|
137
238
|
version: '0'
|
138
239
|
requirements: []
|
139
|
-
rubygems_version: 3.0.
|
140
|
-
signing_key:
|
240
|
+
rubygems_version: 3.5.0.dev
|
241
|
+
signing_key:
|
141
242
|
specification_version: 4
|
142
243
|
summary: Automatic Rails code style checking tool.
|
143
244
|
test_files: []
|