Merge pull request #14168 from Homebrew/dependabot/bundler/Library/Homebrew/rubocop-rails-2.17.3

build(deps): bump rubocop-rails from 2.17.2 to 2.17.3 in /Library/Homebrew
This commit is contained in:
Mike McQuaid 2022-11-22 09:12:46 +00:00 committed by GitHub
commit fac7b05082
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
200 changed files with 233 additions and 106 deletions

View File

@ -92,7 +92,7 @@ GEM
method_source (~> 1.0)
public_suffix (5.0.0)
racc (1.6.0)
rack (3.0.0)
rack (3.0.1)
rainbow (3.1.1)
rbi (0.0.14)
ast
@ -147,7 +147,7 @@ GEM
rubocop-performance (1.15.1)
rubocop (>= 1.7.0, < 2.0)
rubocop-ast (>= 0.4.0)
rubocop-rails (2.17.2)
rubocop-rails (2.17.3)
activesupport (>= 4.2.0)
rack (>= 1.1)
rubocop (>= 1.33.0, < 2.0)

View File

@ -496,10 +496,13 @@ class Rack::Lint::Wrapper
def respond_to?(name, *_arg1); end
def response; end
def to_ary; end
def to_path; end
def verify_content_length(size); end
def verify_to_path; end
end
Rack::Lint::Wrapper::BODY_METHODS = T.let(T.unsafe(nil), Hash)
class Rack::Lint::Wrapper::ErrorWrapper
def initialize(error); end

View File

@ -178,6 +178,7 @@ RuboCop::Cop::Rails::ActionFilter::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array
class RuboCop::Cop::Rails::ActionOrder < ::RuboCop::Cop::Base
include ::RuboCop::Cop::VisibilityHelp
include ::RuboCop::Cop::DefNode
include ::RuboCop::Cop::RangeHelp
extend ::RuboCop::Cop::AutoCorrector
def action_declarations(param0, param1); end
@ -186,9 +187,14 @@ class RuboCop::Cop::Rails::ActionOrder < ::RuboCop::Cop::Base
private
def actions; end
def add_range(range1, range2); end
def correction_target(def_node); end
def expected_order; end
def find_index(node); end
def range_with_comments(node); end
def range_with_comments_and_lines(node); end
def register_offense(previous, current); end
def swap_range(corrector, range1, range2); end
end
RuboCop::Cop::Rails::ActionOrder::MSG = T.let(T.unsafe(nil), String)
@ -695,6 +701,9 @@ class RuboCop::Cop::Rails::DynamicFindBy < ::RuboCop::Cop::Base
def autocorrect_argument_keywords(corrector, node, keywords); end
def autocorrect_method_name(corrector, node); end
def column_keywords(method); end
def dynamic_find_by_arguments?(node); end
def dynamic_find_by_arguments_count?(node); end
def dynamic_find_by_arguments_type?(node); end
def static_method_name(method_name); end
def whitelisted?(node); end
end
@ -921,7 +930,7 @@ class RuboCop::Cop::Rails::FreezeTime < ::RuboCop::Cop::Base
def current_time_with_convert?(node, method_name); end
end
RuboCop::Cop::Rails::FreezeTime::CONV_METHODS = T.let(T.unsafe(nil), Array)
RuboCop::Cop::Rails::FreezeTime::CONVERT_METHODS = T.let(T.unsafe(nil), Array)
RuboCop::Cop::Rails::FreezeTime::MSG = T.let(T.unsafe(nil), String)
RuboCop::Cop::Rails::FreezeTime::NOW_METHODS = T.let(T.unsafe(nil), Array)
RuboCop::Cop::Rails::FreezeTime::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
@ -1061,6 +1070,7 @@ class RuboCop::Cop::Rails::I18nLazyLookup < ::RuboCop::Cop::Base
end
RuboCop::Cop::Rails::I18nLazyLookup::MSG = T.let(T.unsafe(nil), String)
RuboCop::Cop::Rails::I18nLazyLookup::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
class RuboCop::Cop::Rails::I18nLocaleAssignment < ::RuboCop::Cop::Base
def i18n_locale_assignment?(param0 = T.unsafe(nil)); end
@ -1775,7 +1785,8 @@ class RuboCop::Cop::Rails::RootPathnameMethods < ::RuboCop::Cop::Base
private
def build_path_glob(path, method); end
def build_path_glob_replacement(path, method); end
def build_path_replacement(path, method, args); end
def evidence(node); end
def include_interpolation?(arguments); end
def join_arguments(arguments); end
@ -2047,8 +2058,13 @@ class RuboCop::Cop::Rails::ToSWithArgument < ::RuboCop::Cop::Base
def on_csend(node); end
def on_send(node); end
private
def rails_extended_to_s?(node); end
end
RuboCop::Cop::Rails::ToSWithArgument::EXTENDED_FORMAT_TYPES = T.let(T.unsafe(nil), Set)
RuboCop::Cop::Rails::ToSWithArgument::MSG = T.let(T.unsafe(nil), String)
RuboCop::Cop::Rails::ToSWithArgument::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)

View File

@ -6742,6 +6742,7 @@ module RuboCop::AST::NodePattern::Sets
SET_INCLUDE_WITH_WITHOUT = ::T.let(nil, ::T.untyped)
SET_ON_INTEL_ON_ARM = ::T.let(nil, ::T.untyped)
SET_OR_NEWER_OR_OLDER = ::T.let(nil, ::T.untyped)
SET_STDOUT_STDERR = ::T.let(nil, ::T.untyped)
SET_SYSTEM_SHELL_OUTPUT_PIPE_OUTPUT = ::T.let(nil, ::T.untyped)
SET_WITH_WITHOUT = ::T.let(nil, ::T.untyped)
SET____ETC_4 = ::T.let(nil, ::T.untyped)

View File

@ -83,7 +83,7 @@ $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/patchelf-1.4.0/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/plist-3.6.0/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/pry-0.14.1/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rack-3.0.0/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rack-3.0.1/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/unparser-0.6.4/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rbi-0.0.14/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/extensions/universal-darwin-21/#{Gem.extension_api_version}/rdiscount-2.2.7")
@ -106,7 +106,7 @@ $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/unicode-display_width-2.3.0/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-1.35.1/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-performance-1.15.1/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-rails-2.17.2/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-rails-2.17.3/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-rspec-2.15.0/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-sorbet-0.6.11/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/ruby-macho-3.0.0/lib")

View File

@ -817,8 +817,14 @@ module Rack
verify_to_path
end
BODY_METHODS = {to_ary: true, each: true, call: true, to_path: true}
def to_path
@body.to_path
end
def respond_to?(name, *)
if name == :to_ary
if BODY_METHODS.key?(name)
@body.respond_to?(name)
else
super

View File

@ -46,7 +46,7 @@ module Rack
end
def method_override_param(req)
req.POST[METHOD_OVERRIDE_PARAM_KEY]
req.POST[METHOD_OVERRIDE_PARAM_KEY] if req.form_data? || req.parseable_data?
rescue Utils::InvalidParameterError, Utils::ParameterTypeError
req.get_header(RACK_ERRORS).puts "Invalid or incomplete POST params"
rescue EOFError

View File

@ -25,7 +25,7 @@ module Rack
VERSION
end
RELEASE = "3.0.0"
RELEASE = "3.0.1"
# Return the Rack release as a dotted string.
def self.release

View File

@ -1,41 +0,0 @@
# frozen_string_literal: true
module RuboCop
module Cop
module Rails
# Identifies passing any argument to `#to_s`.
#
# @safety
# This cop is marked as unsafe because it may detect `#to_s` calls
# that are not related to Active Support implementation.
#
# @example
#
# # bad
# obj.to_s(:delimited)
#
# # good
# obj.to_formatted_s(:delimited)
#
class ToSWithArgument < Base
extend AutoCorrector
extend TargetRailsVersion
MSG = 'Use `to_formatted_s` instead.'
RESTRICT_ON_SEND = %i[to_s].freeze
minimum_target_rails_version 7.0
def on_send(node)
return if node.arguments.empty?
add_offense(node.loc.selector) do |corrector|
corrector.replace(node.loc.selector, 'to_formatted_s')
end
end
alias on_csend on_send
end
end
end
end

View File

@ -540,7 +540,7 @@ Rails/I18nLazyLookup:
Enabled: pending
VersionAdded: '2.14'
Include:
- 'controllers/**/*'
- 'app/controllers/**/*.rb'
Rails/I18nLocaleAssignment:
Description: 'Prefer the usage of `I18n.with_locale` instead of manually updating `I18n.locale` value.'

View File

@ -10,8 +10,8 @@ module RuboCop
def_node_matcher :active_record?, <<~PATTERN
{
(const nil? :ApplicationRecord)
(const (const nil? :ActiveRecord) :Base)
(const {nil? cbase} :ApplicationRecord)
(const (const {nil? cbase} :ActiveRecord) :Base)
}
PATTERN

View File

@ -134,7 +134,7 @@ module RuboCop
end
def self.from_hash_brackets_map(node, match)
new(match, node.children.last, 'Hash['.length, ']'.length)
new(match, node.children.last, "#{node.receiver.source}[".length, ']'.length)
end
def strip_prefix_and_suffix(node, corrector)

View File

@ -8,7 +8,7 @@ module RuboCop
def_node_matcher :migration_class?, <<~PATTERN
(class
(const nil? _)
(const {nil? cbase} _)
(send
(const (const {nil? cbase} :ActiveRecord) :Migration)
:[]

View File

@ -43,8 +43,8 @@ module RuboCop
def_node_search :action_controller?, <<~PATTERN
{
(const nil? :ApplicationController)
(const (const nil? :ActionController) :Base)
(const {nil? cbase} :ApplicationController)
(const (const {nil? cbase} :ActionController) :Base)
}
PATTERN
@ -69,9 +69,12 @@ module RuboCop
def followed_by_render?(flash_node)
flash_assigment_node = find_ancestor(flash_node, type: :send)
context = flash_assigment_node
context = context.parent if context.parent.if_type?
if (if_node = context.each_ancestor(:if).first)
context = if_node
elsif context.right_siblings.empty?
return true
end
context = context.right_siblings
return true if context.empty?
context.compact.any? do |node|
render?(node)

View File

@ -30,7 +30,7 @@ module RuboCop
def_node_matcher :action_controller_test_case?, <<~PATTERN
(class
(const nil? _)
(const {nil? cbase} _)
(const (const {nil? cbase} :ActionController) :TestCase) _)
PATTERN

View File

@ -6,7 +6,8 @@ module RuboCop
# Enforces consistent ordering of the standard Rails RESTful controller actions.
#
# The cop is configurable and can enforce any ordering of the standard actions.
# All other methods are ignored.
# All other methods are ignored. So, the actions specified in `ExpectedOrder` should be
# defined before actions not specified.
#
# [source,yaml]
# ----
@ -35,6 +36,7 @@ module RuboCop
extend AutoCorrector
include VisibilityHelp
include DefNode
include RangeHelp
MSG = 'Action `%<current>s` should appear before `%<previous>s`.'
@ -71,9 +73,43 @@ module RuboCop
current: current.method_name
)
add_offense(current, message: message) do |corrector|
corrector.replace(current, previous.source)
corrector.replace(previous, current.source)
end
current = correction_target(current)
previous = correction_target(previous)
swap_range(corrector, current, previous)
end
end
def correction_target(def_node)
range_with_comments_and_lines(def_node.each_ancestor(:if).first || def_node)
end
def add_range(range1, range2)
range1.with(
begin_pos: [range1.begin_pos, range2.begin_pos].min,
end_pos: [range1.end_pos, range2.end_pos].max
)
end
def range_with_comments(node)
ranges = [
node,
*processed_source.ast_with_comments[node]
].map do |element|
element.location.expression
end
ranges.reduce do |result, range|
add_range(result, range)
end
end
def range_with_comments_and_lines(node)
range_by_whole_lines(range_with_comments(node), include_final_newline: true)
end
def swap_range(corrector, range1, range2)
corrector.insert_before(range2, range1.source)
corrector.remove(range1)
end
end
end

View File

@ -25,7 +25,7 @@ module RuboCop
MSG = 'Controllers should subclass `ApplicationController`.'
SUPERCLASS = 'ApplicationController'
BASE_PATTERN = '(const (const nil? :ActionController) :Base)'
BASE_PATTERN = '(const (const {nil? cbase} :ActionController) :Base)'
# rubocop:disable Layout/ClassStructure
include RuboCop::Cop::EnforceSuperclass

View File

@ -28,7 +28,7 @@ module RuboCop
MSG = 'Jobs should subclass `ApplicationJob`.'
SUPERCLASS = 'ApplicationJob'
BASE_PATTERN = '(const (const nil? :ActiveJob) :Base)'
BASE_PATTERN = '(const (const {nil? cbase} :ActiveJob) :Base)'
# rubocop:disable Layout/ClassStructure
include RuboCop::Cop::EnforceSuperclass

View File

@ -28,7 +28,7 @@ module RuboCop
MSG = 'Mailers should subclass `ApplicationMailer`.'
SUPERCLASS = 'ApplicationMailer'
BASE_PATTERN = '(const (const nil? :ActionMailer) :Base)'
BASE_PATTERN = '(const (const {nil? cbase} :ActionMailer) :Base)'
# rubocop:disable Layout/ClassStructure
include RuboCop::Cop::EnforceSuperclass

View File

@ -29,7 +29,7 @@ module RuboCop
MSG = 'Models should subclass `ApplicationRecord`.'
SUPERCLASS = 'ApplicationRecord'
BASE_PATTERN = '(const (const nil? :ActiveRecord) :Base)'
BASE_PATTERN = '(const (const {nil? cbase} :ActiveRecord) :Base)'
# rubocop:disable Layout/ClassStructure
include RuboCop::Cop::EnforceSuperclass

View File

@ -81,7 +81,7 @@ module RuboCop
def allowed_name?(argument)
return false unless argument.str_type? || argument.sym_type?
!/^[a-zA-Z\-][a-zA-Z\-0-9]*$/.match?(argument.value)
!/^[a-zA-Z-][a-zA-Z\-0-9]*$/.match?(argument.value)
end
def correction_range(node)

Some files were not shown because too many files have changed in this diff Show More