Merge pull request #10036 from Homebrew/dependabot/bundler/Library/Homebrew/rubocop-rails-2.9.1
build(deps): bump rubocop-rails from 2.9.0 to 2.9.1 in /Library/Homebrew
This commit is contained in:
commit
25f2c897a8
@ -116,7 +116,7 @@ GEM
|
|||||||
rubocop-performance (1.9.1)
|
rubocop-performance (1.9.1)
|
||||||
rubocop (>= 0.90.0, < 2.0)
|
rubocop (>= 0.90.0, < 2.0)
|
||||||
rubocop-ast (>= 0.4.0)
|
rubocop-ast (>= 0.4.0)
|
||||||
rubocop-rails (2.9.0)
|
rubocop-rails (2.9.1)
|
||||||
activesupport (>= 4.2.0)
|
activesupport (>= 4.2.0)
|
||||||
rack (>= 1.1)
|
rack (>= 1.1)
|
||||||
rubocop (>= 0.90.0, < 2.0)
|
rubocop (>= 0.90.0, < 2.0)
|
||||||
|
|||||||
@ -683,8 +683,7 @@ class RuboCop::Cop::Rails::FindEach < ::RuboCop::Cop::Base
|
|||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def ignored?(relation_method); end
|
def ignored?(node); end
|
||||||
def method_chain(node); end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
RuboCop::Cop::Rails::FindEach::MSG = T.let(T.unsafe(nil), String)
|
RuboCop::Cop::Rails::FindEach::MSG = T.let(T.unsafe(nil), String)
|
||||||
@ -723,8 +722,13 @@ RuboCop::Cop::Rails::HasManyOrHasOneDependent::MSG = T.let(T.unsafe(nil), String
|
|||||||
RuboCop::Cop::Rails::HasManyOrHasOneDependent::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
RuboCop::Cop::Rails::HasManyOrHasOneDependent::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
||||||
|
|
||||||
class RuboCop::Cop::Rails::HelperInstanceVariable < ::RuboCop::Cop::Base
|
class RuboCop::Cop::Rails::HelperInstanceVariable < ::RuboCop::Cop::Base
|
||||||
|
def form_builder_class?(param0 = T.unsafe(nil)); end
|
||||||
def on_ivar(node); end
|
def on_ivar(node); end
|
||||||
def on_ivasgn(node); end
|
def on_ivasgn(node); end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def inherit_form_builder?(node); end
|
||||||
end
|
end
|
||||||
|
|
||||||
RuboCop::Cop::Rails::HelperInstanceVariable::MSG = T.let(T.unsafe(nil), String)
|
RuboCop::Cop::Rails::HelperInstanceVariable::MSG = T.let(T.unsafe(nil), String)
|
||||||
@ -78,7 +78,7 @@ $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ruby-progressbar-1.10
|
|||||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/unicode-display_width-1.7.0/lib"
|
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/unicode-display_width-1.7.0/lib"
|
||||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-1.3.1/lib"
|
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-1.3.1/lib"
|
||||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-performance-1.9.1/lib"
|
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-performance-1.9.1/lib"
|
||||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rails-2.9.0/lib"
|
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rails-2.9.1/lib"
|
||||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rspec-2.0.1/lib"
|
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rspec-2.0.1/lib"
|
||||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-sorbet-0.5.1/lib"
|
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-sorbet-0.5.1/lib"
|
||||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ruby-macho-2.5.0/lib"
|
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ruby-macho-2.5.0/lib"
|
||||||
|
|||||||
@ -30,7 +30,7 @@ module RuboCop
|
|||||||
def on_send(node)
|
def on_send(node)
|
||||||
return unless node.receiver&.send_type?
|
return unless node.receiver&.send_type?
|
||||||
return unless SCOPE_METHODS.include?(node.receiver.method_name)
|
return unless SCOPE_METHODS.include?(node.receiver.method_name)
|
||||||
return if method_chain(node).any? { |m| ignored?(m) }
|
return if ignored?(node)
|
||||||
|
|
||||||
range = node.loc.selector
|
range = node.loc.selector
|
||||||
add_offense(range) do |corrector|
|
add_offense(range) do |corrector|
|
||||||
@ -40,12 +40,9 @@ module RuboCop
|
|||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def method_chain(node)
|
def ignored?(node)
|
||||||
node.each_node(:send).map(&:method_name)
|
method_chain = node.each_node(:send).map(&:method_name)
|
||||||
end
|
(cop_config['IgnoredMethods'].map(&:to_sym) & method_chain).any?
|
||||||
|
|
||||||
def ignored?(relation_method)
|
|
||||||
cop_config['IgnoredMethods'].include?(relation_method)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -13,6 +13,9 @@ module RuboCop
|
|||||||
# variable, consider moving the behaviour elsewhere, for
|
# variable, consider moving the behaviour elsewhere, for
|
||||||
# example to a model, decorator or presenter.
|
# example to a model, decorator or presenter.
|
||||||
#
|
#
|
||||||
|
# Provided that a class inherits `ActionView::Helpers::FormBuilder`,
|
||||||
|
# an offense will not be registered.
|
||||||
|
#
|
||||||
# @example
|
# @example
|
||||||
# # bad
|
# # bad
|
||||||
# def welcome_message
|
# def welcome_message
|
||||||
@ -23,18 +26,41 @@ module RuboCop
|
|||||||
# def welcome_message(user)
|
# def welcome_message(user)
|
||||||
# "Hello #{user.name}"
|
# "Hello #{user.name}"
|
||||||
# end
|
# end
|
||||||
|
#
|
||||||
|
# # good
|
||||||
|
# class MyFormBuilder < ActionView::Helpers::FormBuilder
|
||||||
|
# @template.do_something
|
||||||
|
# end
|
||||||
class HelperInstanceVariable < Base
|
class HelperInstanceVariable < Base
|
||||||
MSG = 'Do not use instance variables in helpers.'
|
MSG = 'Do not use instance variables in helpers.'
|
||||||
|
|
||||||
|
def_node_matcher :form_builder_class?, <<~PATTERN
|
||||||
|
(const
|
||||||
|
(const
|
||||||
|
(const nil? :ActionView) :Helpers) :FormBuilder)
|
||||||
|
PATTERN
|
||||||
|
|
||||||
def on_ivar(node)
|
def on_ivar(node)
|
||||||
|
return if inherit_form_builder?(node)
|
||||||
|
|
||||||
add_offense(node)
|
add_offense(node)
|
||||||
end
|
end
|
||||||
|
|
||||||
def on_ivasgn(node)
|
def on_ivasgn(node)
|
||||||
return if node.parent.or_asgn_type?
|
return if node.parent.or_asgn_type? || inherit_form_builder?(node)
|
||||||
|
|
||||||
add_offense(node.loc.name)
|
add_offense(node.loc.name)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def inherit_form_builder?(node)
|
||||||
|
node.each_ancestor(:class) do |class_node|
|
||||||
|
return true if form_builder_class?(class_node.parent_class)
|
||||||
|
end
|
||||||
|
|
||||||
|
false
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -13,11 +13,13 @@ module RuboCop
|
|||||||
# User.where('name IS NULL')
|
# User.where('name IS NULL')
|
||||||
# User.where('name IN (?)', ['john', 'jane'])
|
# User.where('name IN (?)', ['john', 'jane'])
|
||||||
# User.where('name IN (:names)', names: ['john', 'jane'])
|
# User.where('name IN (:names)', names: ['john', 'jane'])
|
||||||
|
# User.where('users.name = :name', name: 'Gabe')
|
||||||
#
|
#
|
||||||
# # good
|
# # good
|
||||||
# User.where(name: 'Gabe')
|
# User.where(name: 'Gabe')
|
||||||
# User.where(name: nil)
|
# User.where(name: nil)
|
||||||
# User.where(name: ['john', 'jane'])
|
# User.where(name: ['john', 'jane'])
|
||||||
|
# User.where(users: { name: 'Gabe' })
|
||||||
class WhereEquals < Base
|
class WhereEquals < Base
|
||||||
include RangeHelp
|
include RangeHelp
|
||||||
extend AutoCorrector
|
extend AutoCorrector
|
||||||
@ -68,7 +70,7 @@ module RuboCop
|
|||||||
when EQ_ANONYMOUS_RE, IN_ANONYMOUS_RE
|
when EQ_ANONYMOUS_RE, IN_ANONYMOUS_RE
|
||||||
value_node.source
|
value_node.source
|
||||||
when EQ_NAMED_RE, IN_NAMED_RE
|
when EQ_NAMED_RE, IN_NAMED_RE
|
||||||
return unless value_node.hash_type?
|
return unless value_node&.hash_type?
|
||||||
|
|
||||||
pair = value_node.pairs.find { |p| p.key.value.to_sym == Regexp.last_match(2).to_sym }
|
pair = value_node.pairs.find { |p| p.key.value.to_sym == Regexp.last_match(2).to_sym }
|
||||||
pair.value.source
|
pair.value.source
|
||||||
@ -83,7 +85,9 @@ module RuboCop
|
|||||||
|
|
||||||
def build_good_method(column, value)
|
def build_good_method(column, value)
|
||||||
if column.include?('.')
|
if column.include?('.')
|
||||||
"where('#{column}' => #{value})"
|
table, column = column.split('.')
|
||||||
|
|
||||||
|
"where(#{table}: { #{column}: #{value} })"
|
||||||
else
|
else
|
||||||
"where(#{column}: #{value})"
|
"where(#{column}: #{value})"
|
||||||
end
|
end
|
||||||
@ -4,7 +4,7 @@ module RuboCop
|
|||||||
module Rails
|
module Rails
|
||||||
# This module holds the RuboCop Rails version information.
|
# This module holds the RuboCop Rails version information.
|
||||||
module Version
|
module Version
|
||||||
STRING = '2.9.0'
|
STRING = '2.9.1'
|
||||||
|
|
||||||
def self.document_version
|
def self.document_version
|
||||||
STRING.match('\d+\.\d+').to_s
|
STRING.match('\d+\.\d+').to_s
|
||||||
Loading…
x
Reference in New Issue
Block a user