Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build(deps): bump rubocop-rails from 2.9.0 to 2.9.1 in /Library/Homebrew #10036

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion Library/Homebrew/Gemfile.lock
Expand Up @@ -116,7 +116,7 @@ GEM
rubocop-performance (1.9.1)
rubocop (>= 0.90.0, < 2.0)
rubocop-ast (>= 0.4.0)
rubocop-rails (2.9.0)
rubocop-rails (2.9.1)
activesupport (>= 4.2.0)
rack (>= 1.1)
rubocop (>= 0.90.0, < 2.0)
Expand Down
Expand Up @@ -683,8 +683,7 @@ class RuboCop::Cop::Rails::FindEach < ::RuboCop::Cop::Base

private

def ignored?(relation_method); end
def method_chain(node); end
def ignored?(node); end
end

RuboCop::Cop::Rails::FindEach::MSG = T.let(T.unsafe(nil), String)
Expand Down Expand Up @@ -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)

class RuboCop::Cop::Rails::HelperInstanceVariable < ::RuboCop::Cop::Base
def form_builder_class?(param0 = T.unsafe(nil)); end
def on_ivar(node); end
def on_ivasgn(node); end

private

def inherit_form_builder?(node); end
end

RuboCop::Cop::Rails::HelperInstanceVariable::MSG = T.let(T.unsafe(nil), String)
Expand Down
10 changes: 10 additions & 0 deletions Library/Homebrew/sorbet/rbi/hidden-definitions/hidden.rbi
Expand Up @@ -7675,6 +7675,11 @@ module Homebrew
MIN_PORT = ::T.let(nil, ::T.untyped)
end

class Homebrew::BundleVersion
extend ::T::Private::Methods::MethodHooks
extend ::T::Private::Methods::SingletonMethodHooks
end

class Homebrew::CLI::Args
extend ::T::Private::Methods::MethodHooks
extend ::T::Private::Methods::SingletonMethodHooks
Expand Down Expand Up @@ -7834,6 +7839,11 @@ class Homebrew::FormulaCreator
extend ::T::Private::Methods::SingletonMethodHooks
end

module Homebrew::Livecheck
extend ::T::Private::Methods::MethodHooks
extend ::T::Private::Methods::SingletonMethodHooks
end

class Homebrew::Style::LineLocation
extend ::T::Private::Methods::MethodHooks
extend ::T::Private::Methods::SingletonMethodHooks
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/vendor/bundle/bundler/setup.rb
Expand Up @@ -78,7 +78,7 @@
$:.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-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-sorbet-0.5.1/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ruby-macho-2.5.0/lib"
Expand Down
Expand Up @@ -30,7 +30,7 @@ class FindEach < Base
def on_send(node)
return unless node.receiver&.send_type?
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
add_offense(range) do |corrector|
Expand All @@ -40,12 +40,9 @@ def on_send(node)

private

def method_chain(node)
node.each_node(:send).map(&:method_name)
end

def ignored?(relation_method)
cop_config['IgnoredMethods'].include?(relation_method)
def ignored?(node)
method_chain = node.each_node(:send).map(&:method_name)
(cop_config['IgnoredMethods'].map(&:to_sym) & method_chain).any?
end
end
end
Expand Down
Expand Up @@ -13,6 +13,9 @@ module Rails
# variable, consider moving the behaviour elsewhere, for
# example to a model, decorator or presenter.
#
# Provided that a class inherits `ActionView::Helpers::FormBuilder`,
# an offense will not be registered.
#
# @example
# # bad
# def welcome_message
Expand All @@ -23,18 +26,41 @@ module Rails
# def welcome_message(user)
# "Hello #{user.name}"
# end
#
# # good
# class MyFormBuilder < ActionView::Helpers::FormBuilder
# @template.do_something
# end
class HelperInstanceVariable < Base
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)
return if inherit_form_builder?(node)

add_offense(node)
end

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)
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
Expand Down
Expand Up @@ -13,11 +13,13 @@ module Rails
# User.where('name IS NULL')
# User.where('name IN (?)', ['john', 'jane'])
# User.where('name IN (:names)', names: ['john', 'jane'])
# User.where('users.name = :name', name: 'Gabe')
#
# # good
# User.where(name: 'Gabe')
# User.where(name: nil)
# User.where(name: ['john', 'jane'])
# User.where(users: { name: 'Gabe' })
class WhereEquals < Base
include RangeHelp
extend AutoCorrector
Expand Down Expand Up @@ -68,7 +70,7 @@ def extract_column_and_value(template_node, value_node)
when EQ_ANONYMOUS_RE, IN_ANONYMOUS_RE
value_node.source
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.source
Expand All @@ -83,7 +85,9 @@ def extract_column_and_value(template_node, value_node)

def build_good_method(column, value)
if column.include?('.')
"where('#{column}' => #{value})"
table, column = column.split('.')

"where(#{table}: { #{column}: #{value} })"
else
"where(#{column}: #{value})"
end
Expand Down
Expand Up @@ -4,7 +4,7 @@ module RuboCop
module Rails
# This module holds the RuboCop Rails version information.
module Version
STRING = '2.9.0'
STRING = '2.9.1'

def self.document_version
STRING.match('\d+\.\d+').to_s
Expand Down