brew vendor-gems: commit updates.
This commit is contained in:
parent
60ca9b7450
commit
e41f025ec0
@ -89,7 +89,7 @@ $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ruby-progressbar-1.11
|
|||||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/unicode-display_width-2.1.0/lib"
|
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/unicode-display_width-2.1.0/lib"
|
||||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-1.22.0/lib"
|
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-1.22.0/lib"
|
||||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-performance-1.11.5/lib"
|
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-performance-1.11.5/lib"
|
||||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rails-2.12.2/lib"
|
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rails-2.12.3/lib"
|
||||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rspec-2.5.0/lib"
|
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rspec-2.5.0/lib"
|
||||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-sorbet-0.6.2/lib"
|
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-sorbet-0.6.2/lib"
|
||||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ruby-macho-2.5.1/lib"
|
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ruby-macho-2.5.1/lib"
|
||||||
|
|||||||
@ -9,7 +9,7 @@ AllCops:
|
|||||||
- bin/*
|
- bin/*
|
||||||
- db/schema.rb
|
- db/schema.rb
|
||||||
# What version of Rails is the inspected code using? If a value is specified
|
# What version of Rails is the inspected code using? If a value is specified
|
||||||
# for TargetRailsVersion then it is used. Acceptable values are specificed
|
# for TargetRailsVersion then it is used. Acceptable values are specified
|
||||||
# as a float (i.e. 5.1); the patch version of Rails should not be included.
|
# as a float (i.e. 5.1); the patch version of Rails should not be included.
|
||||||
# If TargetRailsVersion is not set, RuboCop will parse the Gemfile.lock or
|
# If TargetRailsVersion is not set, RuboCop will parse the Gemfile.lock or
|
||||||
# gems.locked file to find the version of Rails that has been bound to the
|
# gems.locked file to find the version of Rails that has been bound to the
|
||||||
@ -189,6 +189,9 @@ Rails/ContentTag:
|
|||||||
Enabled: true
|
Enabled: true
|
||||||
VersionAdded: '2.6'
|
VersionAdded: '2.6'
|
||||||
VersionChanged: '2.12'
|
VersionChanged: '2.12'
|
||||||
|
# This `Exclude` config prevents false positives for `tag` calls to `has_one: tag`. No helpers are used in normal models.
|
||||||
|
Exclude:
|
||||||
|
- app/models/**/*.rb
|
||||||
|
|
||||||
Rails/CreateTableWithTimestamps:
|
Rails/CreateTableWithTimestamps:
|
||||||
Description: >-
|
Description: >-
|
||||||
@ -198,6 +201,10 @@ Rails/CreateTableWithTimestamps:
|
|||||||
VersionAdded: '0.52'
|
VersionAdded: '0.52'
|
||||||
Include:
|
Include:
|
||||||
- db/migrate/*.rb
|
- db/migrate/*.rb
|
||||||
|
Exclude:
|
||||||
|
# Respect the `active_storage_variant_records` table of `*_create_active_storage_tables.active_storage.rb`
|
||||||
|
# auto-generated by `bin/rails active_storage:install` even if `created_at` is not specified.
|
||||||
|
- db/migrate/*_create_active_storage_tables.active_storage.rb
|
||||||
|
|
||||||
Rails/Date:
|
Rails/Date:
|
||||||
Description: >-
|
Description: >-
|
||||||
@ -816,7 +823,7 @@ Rails/UniqBeforePluck:
|
|||||||
AutoCorrect: false
|
AutoCorrect: false
|
||||||
|
|
||||||
Rails/UniqueValidationWithoutIndex:
|
Rails/UniqueValidationWithoutIndex:
|
||||||
Description: 'Uniqueness validation should be with a unique index.'
|
Description: 'Uniqueness validation should have a unique index on the database column.'
|
||||||
Enabled: true
|
Enabled: true
|
||||||
VersionAdded: '2.5'
|
VersionAdded: '2.5'
|
||||||
Include:
|
Include:
|
||||||
@ -33,6 +33,9 @@ module RuboCop
|
|||||||
end
|
end
|
||||||
|
|
||||||
def on_send(node)
|
def on_send(node)
|
||||||
|
return unless node.receiver.nil?
|
||||||
|
return if node.arguments.count >= 3
|
||||||
|
|
||||||
first_argument = node.first_argument
|
first_argument = node.first_argument
|
||||||
return if !first_argument ||
|
return if !first_argument ||
|
||||||
allowed_argument?(first_argument) ||
|
allowed_argument?(first_argument) ||
|
||||||
@ -41,12 +44,7 @@ module RuboCop
|
|||||||
preferred_method = node.first_argument.value.to_s.underscore
|
preferred_method = node.first_argument.value.to_s.underscore
|
||||||
message = format(MSG, preferred_method: preferred_method, current_argument: first_argument.source)
|
message = format(MSG, preferred_method: preferred_method, current_argument: first_argument.source)
|
||||||
|
|
||||||
add_offense(node, message: message) do |corrector|
|
register_offense(node, message, preferred_method)
|
||||||
autocorrect(corrector, node, preferred_method)
|
|
||||||
|
|
||||||
@corrected_nodes ||= Set.new.compare_by_identity
|
|
||||||
@corrected_nodes.add(node)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
@ -63,6 +61,15 @@ module RuboCop
|
|||||||
allowed_name?(argument)
|
allowed_name?(argument)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def register_offense(node, message, preferred_method)
|
||||||
|
add_offense(node, message: message) do |corrector|
|
||||||
|
autocorrect(corrector, node, preferred_method)
|
||||||
|
|
||||||
|
@corrected_nodes ||= Set.new.compare_by_identity
|
||||||
|
@corrected_nodes.add(node)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def autocorrect(corrector, node, preferred_method)
|
def autocorrect(corrector, node, preferred_method)
|
||||||
range = correction_range(node)
|
range = correction_range(node)
|
||||||
|
|
||||||
@ -43,9 +43,20 @@ module RuboCop
|
|||||||
private
|
private
|
||||||
|
|
||||||
def ignored?(node)
|
def ignored?(node)
|
||||||
|
return true if active_model_error_where?(node.receiver)
|
||||||
|
|
||||||
method_chain = node.each_node(:send).map(&:method_name)
|
method_chain = node.each_node(:send).map(&:method_name)
|
||||||
|
|
||||||
(cop_config['IgnoredMethods'].map(&:to_sym) & method_chain).any?
|
(cop_config['IgnoredMethods'].map(&:to_sym) & method_chain).any?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def active_model_error_where?(node)
|
||||||
|
node.method?(:where) && active_model_error?(node.receiver)
|
||||||
|
end
|
||||||
|
|
||||||
|
def active_model_error?(node)
|
||||||
|
node.send_type? && node.method?(:errors)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -90,7 +90,7 @@ module RuboCop
|
|||||||
end
|
end
|
||||||
|
|
||||||
def nested_relative_date(node, &callback)
|
def nested_relative_date(node, &callback)
|
||||||
return if node.block_type?
|
return if node.nil? || node.block_type?
|
||||||
|
|
||||||
node.each_child_node do |child|
|
node.each_child_node do |child|
|
||||||
nested_relative_date(child, &callback)
|
nested_relative_date(child, &callback)
|
||||||
@ -317,16 +317,24 @@ module RuboCop
|
|||||||
return if receiver != node.receiver &&
|
return if receiver != node.receiver &&
|
||||||
reversible_change_table_call?(node)
|
reversible_change_table_call?(node)
|
||||||
|
|
||||||
|
action = if method_name == :remove
|
||||||
|
target_rails_version >= 6.1 ? 't.remove (without type)' : 't.remove'
|
||||||
|
else
|
||||||
|
"change_table(with #{method_name})"
|
||||||
|
end
|
||||||
|
|
||||||
add_offense(
|
add_offense(
|
||||||
node,
|
node,
|
||||||
message: format(MSG, action: "change_table(with #{method_name})")
|
message: format(MSG, action: action)
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
def reversible_change_table_call?(node)
|
def reversible_change_table_call?(node)
|
||||||
case node.method_name
|
case node.method_name
|
||||||
when :change, :remove
|
when :change
|
||||||
false
|
false
|
||||||
|
when :remove
|
||||||
|
target_rails_version >= 6.1 && all_hash_key?(node.arguments.last, :type)
|
||||||
when :change_default, :change_column_default, :change_table_comment,
|
when :change_default, :change_column_default, :change_table_comment,
|
||||||
:change_column_comment
|
:change_column_comment
|
||||||
all_hash_key?(node.arguments.last, :from, :to)
|
all_hash_key?(node.arguments.last, :from, :to)
|
||||||
@ -27,7 +27,7 @@ module RuboCop
|
|||||||
class UniqueValidationWithoutIndex < Base
|
class UniqueValidationWithoutIndex < Base
|
||||||
include ActiveRecordHelper
|
include ActiveRecordHelper
|
||||||
|
|
||||||
MSG = 'Uniqueness validation should be with a unique index.'
|
MSG = 'Uniqueness validation should have a unique index on the database column.'
|
||||||
RESTRICT_ON_SEND = %i[validates].freeze
|
RESTRICT_ON_SEND = %i[validates].freeze
|
||||||
|
|
||||||
def on_send(node)
|
def on_send(node)
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user