Merge pull request #16510 from dduugg/inverse-include-exclude-cop

Vendor remaining Rails cops, remove ActiveSupport
This commit is contained in:
Douglas Eichelberger 2024-01-30 11:59:10 -08:00 committed by GitHub
commit 3a27cac7df
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
55 changed files with 1648 additions and 54206 deletions

6
.gitignore vendored
View File

@ -70,7 +70,6 @@
**/vendor/gems/mechanize-*/test/
# Ignore dependencies we don't wish to vendor
**/vendor/bundle/ruby/*/gems/activesupport-*/
**/vendor/bundle/ruby/*/gems/ast-*/
**/vendor/bundle/ruby/*/gems/bootsnap-*/
**/vendor/bundle/ruby/*/gems/bundler-*/
@ -78,7 +77,6 @@
**/vendor/bundle/ruby/*/gems/coderay-*/
**/vendor/bundle/ruby/*/gems/colorize-*/
**/vendor/bundle/ruby/*/gems/commander-*/
**/vendor/bundle/ruby/*/gems/concurrent-ruby-*/
**/vendor/bundle/ruby/*/gems/diff-lcs-*/
**/vendor/bundle/ruby/*/gems/docile-*/
**/vendor/bundle/ruby/*/gems/ecma-re-validator-*/
@ -86,7 +84,6 @@
**/vendor/bundle/ruby/*/gems/hana-*/
**/vendor/bundle/ruby/*/gems/highline-*/
**/vendor/bundle/ruby/*/gems/hpricot-*/
**/vendor/bundle/ruby/*/gems/i18n-*/
**/vendor/bundle/ruby/*/gems/jaro_winkler-*/
**/vendor/bundle/ruby/*/gems/json-*/
**/vendor/bundle/ruby/*/gems/json_schemer-*/
@ -108,7 +105,6 @@
**/vendor/bundle/ruby/*/gems/psych-*/
**/vendor/bundle/ruby/*/gems/pry-*/
**/vendor/bundle/ruby/*/gems/racc-*/
**/vendor/bundle/ruby/*/gems/rack-*/
**/vendor/bundle/ruby/*/gems/rainbow-*/
**/vendor/bundle/ruby/*/gems/rbi-*/
**/vendor/bundle/ruby/*/gems/rdiscount-*/
@ -140,7 +136,6 @@
**/vendor/bundle/ruby/*/gems/syntax_tree-*/
**/vendor/bundle/ruby/*/gems/tapioca-*/
**/vendor/bundle/ruby/*/gems/thor-*/
**/vendor/bundle/ruby/*/gems/tzinfo-*/
**/vendor/bundle/ruby/*/gems/unf-*/
**/vendor/bundle/ruby/*/gems/unf_ext-*/
**/vendor/bundle/ruby/*/gems/unicode-display_width-*/
@ -149,7 +144,6 @@
**/vendor/bundle/ruby/*/gems/webrobots-*/
**/vendor/bundle/ruby/*/gems/yard-*/
**/vendor/bundle/ruby/*/gems/yard-sorbet-*/
**/vendor/bundle/ruby/*/gems/zeitwerk-*/
**/vendor/cache/
**/vendor/specifications/

View File

@ -2,7 +2,6 @@
require:
- ./Homebrew/rubocops.rb
- rubocop-performance
- rubocop-rails
- rubocop-rspec
- rubocop-sorbet
@ -13,7 +12,6 @@ inherit_mode:
AllCops:
TargetRubyVersion: 3.1
ActiveSupportExtensionsEnabled: true
NewCops: enable
Include:
- "**/*.rbi"
@ -51,10 +49,26 @@ FormulaAuditStrict:
Homebrew:
Enabled: true
Homebrew/Blank:
Exclude:
# Core extensions are not available here:
- "Homebrew/startup/bootsnap.rb"
Homebrew/CompactBlank:
Exclude:
# `blank?` is not necessarily available here:
- "Homebrew/extend/enumerable.rb"
# only used internally
Homebrew/MoveToExtendOS:
Enabled: false
Homebrew/NegateInclude:
Exclude:
# `exclude?` is not available here:
- "Homebrew/standalone/init.rb"
- "Homebrew/rubocops/**/*"
# `system` is a special case and aligns on second argument, so allow this for formulae.
Layout/ArgumentAlignment:
Exclude:
@ -200,32 +214,6 @@ Performance/CaseWhenSplat:
Performance/MethodObjectAsBlock:
Enabled: false
Rails:
# Selectively enable what we want.
Enabled: false
Exclude:
# This file is loaded before any extra methods are defined.
- "Homebrew/standalone/init.rb"
# Do not use ActiveSupport in RuboCops.
- "Homebrew/rubocops/**/*"
# These relate to ActiveSupport and not other parts of Rails.
Rails/Blank:
Enabled: true
Rails/CompactBlank:
Enabled: true
Rails/NegateInclude:
Enabled: true
Rails/Presence:
Enabled: true
Rails/Present:
Enabled: true
Exclude:
# `present?` is defined as `!blank?` wihin this file
- "Homebrew/extend/blank.rb"
Rails/SafeNavigationWithBlank:
Enabled: true
# Intentionally disabled as it doesn't fit with our code style.
RSpec/AnyInstance:
Enabled: false
@ -355,6 +343,10 @@ Style/HashAsLastArrayItem:
- "/**/Formula/**/*.rb"
- "**/Formula/**/*.rb"
Style/InverseMethods:
InverseMethods:
:blank?: :present?
Style/InvertibleUnlessCondition:
Enabled: true
InverseMethods:
@ -362,8 +354,7 @@ Style/InvertibleUnlessCondition:
:==: :!=
# Unset this (prefer `unless a.zero?` over `if a.nonzero?`)
:zero?:
# Don't require non-standard `exclude?` (for now at least) - it's not available in every file
:include?:
:blank?: :present?
Style/MutableConstant:
# would rather freeze too much than too little

View File

@ -43,7 +43,6 @@ end
group :style, optional: true do
gem "rubocop", require: false
gem "rubocop-performance", require: false
gem "rubocop-rails", require: false
gem "rubocop-rspec", require: false
gem "rubocop-sorbet", require: false
end
@ -72,7 +71,6 @@ group :audit, :bump_unversioned_casks, :livecheck, optional: true do
end
# vendored gems (no group)
gem "activesupport", "<7" # we're actively working to remove this: https://github.com/Homebrew/brew/issues/16190
gem "addressable"
gem "patchelf"
gem "plist"

View File

@ -1,12 +1,6 @@
GEM
remote: https://rubygems.org/
specs:
activesupport (6.1.7.6)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
zeitwerk (~> 2.3)
addressable (2.8.6)
public_suffix (>= 2.0.2, < 6.0)
ast (2.4.2)
@ -17,7 +11,6 @@ GEM
coderay (1.1.3)
commander (4.6.0)
highline (~> 2.0.0)
concurrent-ruby (1.2.3)
diff-lcs (1.5.0)
docile (1.4.0)
elftools (1.2.0)
@ -26,8 +19,6 @@ GEM
hana (1.3.7)
highline (2.0.3)
hpricot (0.8.6)
i18n (1.14.1)
concurrent-ruby (~> 1.0)
json (2.7.1)
json_schemer (2.1.1)
hana (~> 1.3)
@ -60,7 +51,6 @@ GEM
method_source (~> 1.0)
public_suffix (5.0.4)
racc (1.7.3)
rack (3.0.8)
rainbow (3.1.1)
rbi (0.1.6)
prism (>= 0.18.0, < 0.20)
@ -116,11 +106,6 @@ GEM
rubocop-performance (1.20.2)
rubocop (>= 1.48.1, < 2.0)
rubocop-ast (>= 1.30.0, < 2.0)
rubocop-rails (2.23.1)
activesupport (>= 4.2.0)
rack (>= 1.1)
rubocop (>= 1.33.0, < 2.0)
rubocop-ast (>= 1.30.0, < 2.0)
rubocop-rspec (2.26.1)
rubocop (~> 1.40)
rubocop-capybara (~> 2.17)
@ -167,8 +152,6 @@ GEM
thor (>= 1.2.0)
yard-sorbet
thor (1.3.0)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unf (0.1.4)
unf_ext
unf_ext (0.0.9.1)
@ -178,7 +161,6 @@ GEM
yard-sorbet (0.8.1)
sorbet-runtime (>= 0.5)
yard (>= 0.9)
zeitwerk (2.6.12)
PLATFORMS
aarch64-linux
@ -188,7 +170,6 @@ PLATFORMS
x86_64-linux
DEPENDENCIES
activesupport (< 7)
addressable
bootsnap
byebug
@ -210,7 +191,6 @@ DEPENDENCIES
rubocop
rubocop-ast
rubocop-performance
rubocop-rails
rubocop-rspec
rubocop-sorbet
ruby-macho

View File

@ -155,7 +155,7 @@ module Cask
end
def to_args
@dsl_args.reject(&:blank?)
@dsl_args.compact_blank
end
end
end

View File

@ -19,9 +19,7 @@ class Object
# An object is present if it's not blank.
sig { returns(T::Boolean) }
def present?
!blank?
end
def present? = !blank?
# Returns the receiver if it's present otherwise returns +nil+.
# <tt>object.presence</tt> is equivalent to
@ -48,14 +46,10 @@ class NilClass
#
# nil.blank? # => true
sig { returns(TrueClass) }
def blank?
true
end
def blank? = true
sig { returns(FalseClass) }
def present? # :nodoc:
false
end
def present? = false # :nodoc:
end
class FalseClass
@ -63,14 +57,10 @@ class FalseClass
#
# false.blank? # => true
sig { returns(TrueClass) }
def blank?
true
end
def blank? = true
sig { returns(FalseClass) }
def present? # :nodoc:
false
end
def present? = false # :nodoc:
end
class TrueClass
@ -78,14 +68,10 @@ class TrueClass
#
# true.blank? # => false
sig { returns(FalseClass) }
def blank?
false
end
def blank? = false
sig { returns(TrueClass) }
def present? # :nodoc:
true
end
def present? = true # :nodoc:
end
class Array
@ -98,9 +84,7 @@ class Array
alias blank? empty?
sig { returns(T::Boolean) }
def present? # :nodoc:
!empty?
end
def present? = !empty? # :nodoc:
end
class Hash
@ -113,9 +97,7 @@ class Hash
alias blank? empty?
sig { returns(T::Boolean) }
def present? # :nodoc:
!empty?
end
def present? = !empty? # :nodoc:
end
class Symbol
@ -126,9 +108,7 @@ class Symbol
alias blank? empty?
sig { returns(T::Boolean) }
def present? # :nodoc:
!empty?
end
def present? = !empty? # :nodoc:
end
class String
@ -164,9 +144,7 @@ class String
end
sig { returns(T::Boolean) }
def present? # :nodoc:
!blank?
end
def present? = !blank? # :nodoc:
end
class Numeric # :nodoc:
@ -175,14 +153,10 @@ class Numeric # :nodoc:
# 1.blank? # => false
# 0.blank? # => false
sig { returns(FalseClass) }
def blank?
false
end
def blank? = false
sig { returns(TrueClass) }
def present?
true
end
def present? = true
end
class Time # :nodoc:
@ -190,12 +164,8 @@ class Time # :nodoc:
#
# Time.now.blank? # => false
sig { returns(FalseClass) }
def blank?
false
end
def blank? = false
sig { returns(TrueClass) }
def present?
true
end
def present? = true
end

View File

@ -314,7 +314,7 @@ class GitHubPackages
"org.opencontainers.image.url" => bottle_hash["formula"]["homepage"],
"org.opencontainers.image.vendor" => org,
"org.opencontainers.image.version" => version,
}.reject { |_, v| v.blank? }
}.compact_blank
manifests = []
end
@ -369,7 +369,7 @@ class GitHubPackages
architecture: architecture,
os: os,
"os.version" => os_version,
}.reject { |_, v| v.blank? }
}.compact_blank
tar_sha256 = Digest::SHA256.new
Zlib::GzipReader.open(local_file) do |gz|
@ -391,7 +391,7 @@ class GitHubPackages
"sh.brew.bottle.glibc.version" => glibc_version,
"sh.brew.bottle.size" => local_file_size.to_s,
"sh.brew.tab" => tab.to_json,
}.reject { |_, v| v.blank? }
}.compact_blank
annotations_hash = formula_annotations_hash.merge(descriptor_annotations_hash).merge(
{
@ -399,7 +399,7 @@ class GitHubPackages
"org.opencontainers.image.documentation" => documentation,
"org.opencontainers.image.title" => "#{formula_full_name} #{tag}",
},
).reject { |_, v| v.blank? }.sort.to_h
).compact_blank.sort.to_h
image_manifest = {
schemaVersion: 2,

View File

@ -105,7 +105,7 @@ module Homebrew
end
content = [content] unless content.is_a?(Array)
content.reject(&:blank?).map do |release|
content.compact_blank.map do |release|
next if release["draft"] || release["prerelease"]
value = T.let(nil, T.untyped)

View File

@ -2,8 +2,15 @@
# frozen_string_literal: true
require_relative "../extend/array"
require_relative "../extend/blank"
require_relative "blank"
require_relative "compact_blank"
require_relative "io_read"
require_relative "move_to_extend_os"
require_relative "negate_include"
require_relative "presence"
require_relative "present"
require_relative "safe_navigation_with_blank"
require_relative "shell_commands"
# formula audit cops

View File

@ -0,0 +1,73 @@
# typed: true
# frozen_string_literal: true
module RuboCop
module Cop
module Homebrew
# Checks for code that can be written with simpler conditionals
# using `Object#blank?`.
#
# @note
# This cop is unsafe autocorrection, because `' '.empty?` returns false,
# but `' '.blank?` returns true. Therefore, autocorrection is not compatible
# if the receiver is a non-empty blank string, tab, or newline meta characters.
#
# @example
# # Converts usages of `nil? || empty?` to `blank?`
#
# # bad
# foo.nil? || foo.empty?
# foo == nil || foo.empty?
#
# # good
# foo.blank?
class Blank < Base
extend AutoCorrector
MSG_NIL_OR_EMPTY = "Use `%<prefer>s` instead of `%<current>s`."
# `(send nil $_)` is not actually a valid match for an offense. Nodes
# that have a single method call on the left hand side
# (`bar || foo.empty?`) will blow up when checking
# `(send (:nil) :== $_)`.
def_node_matcher :nil_or_empty?, <<~PATTERN
(or
{
(send $_ :!)
(send $_ :nil?)
(send $_ :== nil)
(send nil :== $_)
}
{
(send $_ :empty?)
(send (send (send $_ :empty?) :!) :!)
}
)
PATTERN
def on_or(node)
nil_or_empty?(node) do |var1, var2|
return if var1 != var2
message = format(MSG_NIL_OR_EMPTY, prefer: replacement(var1), current: node.source)
add_offense(node, message: message) do |corrector|
autocorrect(corrector, node)
end
end
end
private
def autocorrect(corrector, node)
variable1, _variable2 = nil_or_empty?(node)
range = node.source_range
corrector.replace(range, replacement(variable1))
end
def replacement(node)
node.respond_to?(:source) ? "#{node.source}.blank?" : "blank?"
end
end
end
end
end

View File

@ -0,0 +1,109 @@
# typed: true
# frozen_string_literal: true
module RuboCop
module Cop
module Homebrew
# Checks if collection can be blank-compacted with `compact_blank`.
#
# @note
# It is unsafe by default because false positives may occur in the
# blank check of block arguments to the receiver object.
#
# For example, `[[1, 2], [3, nil]].reject { |first, second| second.blank? }` and
# `[[1, 2], [3, nil]].compact_blank` are not compatible. The same is true for `blank?`.
# This will work fine when the receiver is a hash object.
#
# And `compact_blank!` has different implementations for `Array`, `Hash`, and
# `ActionController::Parameters`.
# `Array#compact_blank!`, `Hash#compact_blank!` are equivalent to `delete_if(&:blank?)`.
# `ActionController::Parameters#compact_blank!` is equivalent to `reject!(&:blank?)`.
# If the cop makes a mistake, autocorrected code may get unexpected behavior.
#
# @example
#
# # bad
# collection.reject(&:blank?)
# collection.reject { |_k, v| v.blank? }
#
# # good
# collection.compact_blank
#
# # bad
# collection.delete_if(&:blank?) # Same behavior as `Array#compact_blank!` and `Hash#compact_blank!`
# collection.delete_if { |_, v| v.blank? } # Same behavior as `Array#compact_blank!` and `Hash#compact_blank!`
# collection.reject!(&:blank?) # Same behavior as `ActionController::Parameters#compact_blank!`
# collection.reject! { |_k, v| v.blank? } # Same behavior as `ActionController::Parameters#compact_blank!`
#
# # good
# collection.compact_blank!
#
class CompactBlank < Base
include RangeHelp
extend AutoCorrector
MSG = "Use `%<preferred_method>s` instead."
RESTRICT_ON_SEND = [:reject, :delete_if, :reject!].freeze
def_node_matcher :reject_with_block?, <<~PATTERN
(block
(send _ {:reject :delete_if :reject!})
$(args ...)
(send
$(lvar _) :blank?))
PATTERN
def_node_matcher :reject_with_block_pass?, <<~PATTERN
(send _ {:reject :delete_if :reject!}
(block_pass
(sym :blank?)))
PATTERN
def on_send(node)
return unless bad_method?(node)
range = offense_range(node)
preferred_method = preferred_method(node)
add_offense(range, message: format(MSG, preferred_method: preferred_method)) do |corrector|
corrector.replace(range, preferred_method)
end
end
private
def bad_method?(node)
return true if reject_with_block_pass?(node)
if (arguments, receiver_in_block = reject_with_block?(node.parent))
return use_single_value_block_argument?(arguments, receiver_in_block) ||
use_hash_value_block_argument?(arguments, receiver_in_block)
end
false
end
def use_single_value_block_argument?(arguments, receiver_in_block)
arguments.length == 1 && arguments[0].source == receiver_in_block.source
end
def use_hash_value_block_argument?(arguments, receiver_in_block)
arguments.length == 2 && arguments[1].source == receiver_in_block.source
end
def offense_range(node)
end_pos = if node.parent&.block_type? && node.parent&.send_node == node
node.parent.source_range.end_pos
else
node.source_range.end_pos
end
range_between(node.loc.selector.begin_pos, end_pos)
end
def preferred_method(node)
node.method?(:reject) ? "compact_blank" : "compact_blank!"
end
end
end
end
end

View File

@ -75,7 +75,7 @@ module RuboCop
ordered.each_with_index do |dep, pos|
idx = pos+1
match_nodes = build_with_dependency_name(dep)
next if !match_nodes || match_nodes.empty?
next if match_nodes.blank?
idx1 = pos
ordered.drop(idx1+1).each_with_index do |dep2, pos2|

View File

@ -0,0 +1,43 @@
# typed: true
# frozen_string_literal: true
module RuboCop
module Cop
module Homebrew
# Enforces the use of `collection.exclude?(obj)`
# over `!collection.include?(obj)`.
#
# @note
# This cop is unsafe because false positive will occur for
# receiver objects that do not have an `exclude?` method. (e.g. `IPAddr`)
#
# @example
# # bad
# !array.include?(2)
# !hash.include?(:key)
#
# # good
# array.exclude?(2)
# hash.exclude?(:key)
#
class NegateInclude < Base
extend AutoCorrector
MSG = "Use `.exclude?` and remove the negation part."
RESTRICT_ON_SEND = [:!].freeze
def_node_matcher :negate_include_call?, <<~PATTERN
(send (send $!nil? :include? $_) :!)
PATTERN
def on_send(node)
return unless (receiver, obj = negate_include_call?(node))
add_offense(node) do |corrector|
corrector.replace(node, "#{receiver.source}.exclude?(#{obj.source})")
end
end
end
end
end
end

View File

@ -0,0 +1,153 @@
# typed: true
# frozen_string_literal: true
module RuboCop
module Cop
module Homebrew
# Checks code that can be written more easily using
# `Object#presence` defined by Active Support.
#
# @example
# # bad
# a.present? ? a : nil
#
# # bad
# !a.present? ? nil : a
#
# # bad
# a.blank? ? nil : a
#
# # bad
# !a.blank? ? a : nil
#
# # good
# a.presence
#
# @example
# # bad
# a.present? ? a : b
#
# # bad
# !a.present? ? b : a
#
# # bad
# a.blank? ? b : a
#
# # bad
# !a.blank? ? a : b
#
# # good
# a.presence || b
class Presence < Base
include RangeHelp
extend AutoCorrector
MSG = "Use `%<prefer>s` instead of `%<current>s`."
def_node_matcher :redundant_receiver_and_other, <<~PATTERN
{
(if
(send $_recv :present?)
_recv
$!begin
)
(if
(send $_recv :blank?)
$!begin
_recv
)
}
PATTERN
def_node_matcher :redundant_negative_receiver_and_other, <<~PATTERN
{
(if
(send (send $_recv :present?) :!)
$!begin
_recv
)
(if
(send (send $_recv :blank?) :!)
_recv
$!begin
)
}
PATTERN
def on_if(node)
return if ignore_if_node?(node)
redundant_receiver_and_other(node) do |receiver, other|
return if ignore_other_node?(other) || receiver.nil?
register_offense(node, receiver, other)
end
redundant_negative_receiver_and_other(node) do |receiver, other|
return if ignore_other_node?(other) || receiver.nil?
register_offense(node, receiver, other)
end
end
private
def register_offense(node, receiver, other)
add_offense(node, message: message(node, receiver, other)) do |corrector|
corrector.replace(node, replacement(receiver, other, node.left_sibling))
end
end
def ignore_if_node?(node)
node.elsif?
end
def ignore_other_node?(node)
node && (node.if_type? || node.rescue_type? || node.while_type?)
end
def message(node, receiver, other)
prefer = replacement(receiver, other, node.left_sibling).gsub(/^\s*|\n/, "")
current = current(node).gsub(/^\s*|\n/, "")
format(MSG, prefer: prefer, current: current)
end
def current(node)
if !node.ternary? && node.source.include?("\n")
"#{node.loc.keyword.with(end_pos: node.condition.loc.selector.end_pos).source} ... end"
else
node.source.gsub(/\n\s*/, " ")
end
end
def replacement(receiver, other, left_sibling)
or_source = if other&.send_type?
build_source_for_or_method(other)
elsif other.nil? || other.nil_type?
""
else
" || #{other.source}"
end
replaced = "#{receiver.source}.presence#{or_source}"
left_sibling ? "(#{replaced})" : replaced
end
def build_source_for_or_method(other)
if other.parenthesized? || other.method?("[]") || other.arithmetic_operation? || !other.arguments?
" || #{other.source}"
else
method = method_range(other).source
arguments = other.arguments.map(&:source).join(", ")
" || #{method}(#{arguments})"
end
end
def method_range(node)
range_between(node.source_range.begin_pos, node.first_argument.source_range.begin_pos - 1)
end
end
end
end
end

View File

@ -0,0 +1,76 @@
# typed: true
# frozen_string_literal: true
module RuboCop
module Cop
module Homebrew
# Checks for code that can be written with simpler conditionals
# using `Object#present?`.
#
# @example
# # Converts usages of `!nil? && !empty?` to `present?`
#
# # bad
# !foo.nil? && !foo.empty?
#
# # bad
# foo != nil && !foo.empty?
#
# # good
# foo.present?
class Present < Base
extend AutoCorrector
MSG_EXISTS_AND_NOT_EMPTY = "Use `%<prefer>s` instead of `%<current>s`."
def_node_matcher :exists_and_not_empty?, <<~PATTERN
(and
{
(send (send $_ :nil?) :!)
(send (send $_ :!) :!)
(send $_ :!= nil)
$_
}
{
(send (send $_ :empty?) :!)
}
)
PATTERN
def on_and(node)
exists_and_not_empty?(node) do |var1, var2|
return if var1 != var2
message = format(MSG_EXISTS_AND_NOT_EMPTY, prefer: replacement(var1), current: node.source)
add_offense(node, message: message) do |corrector|
autocorrect(corrector, node)
end
end
end
def on_or(node)
exists_and_not_empty?(node) do |var1, var2|
return if var1 != var2
add_offense(node, message: MSG_EXISTS_AND_NOT_EMPTY) do |corrector|
autocorrect(corrector, node)
end
end
end
def autocorrect(corrector, node)
variable1, _variable2 = exists_and_not_empty?(node)
range = node.source_range
corrector.replace(range, replacement(variable1))
end
private
def replacement(node)
node.respond_to?(:source) ? "#{node.source}.present?" : "present?"
end
end
end
end
end

View File

@ -0,0 +1,51 @@
# typed: true
# frozen_string_literal: true
module RuboCop
module Cop
module Homebrew
# Checks to make sure safe navigation isn't used with `blank?` in
# a conditional.
#
# @note
# While the safe navigation operator is generally a good idea, when
# checking `foo&.blank?` in a conditional, `foo` being `nil` will actually
# do the opposite of what the author intends.
#
# For example:
#
# [source,ruby]
# ----
# foo&.blank? #=> nil
# foo.blank? #=> true
# ----
#
# @example
# # bad
# do_something if foo&.blank?
# do_something unless foo&.blank?
#
# # good
# do_something if foo.blank?
# do_something unless foo.blank?
#
class SafeNavigationWithBlank < Base
extend AutoCorrector
MSG = "Avoid calling `blank?` with the safe navigation operator in conditionals."
def_node_matcher :safe_navigation_blank_in_conditional?, <<~PATTERN
(if $(csend ... :blank?) ...)
PATTERN
def on_if(node)
return unless safe_navigation_blank_in_conditional?(node)
add_offense(node) do |corrector|
corrector.replace(safe_navigation_blank_in_conditional?(node).location.dot, ".")
end
end
end
end
end
end

File diff suppressed because it is too large Load Diff

View File

@ -25,8 +25,6 @@ end
#
# source://byebug//lib/byebug/attacher.rb#34
module Kernel
include ::ActiveSupport::ForkTracker::CoreExt
# source://byebug//lib/byebug/attacher.rb#35
def byebug; end

View File

@ -1233,7 +1233,6 @@ Commander::VERSION = T.let(T.unsafe(nil), String)
# source://commander//lib/commander/core_ext/object.rb#3
class Object < ::BasicObject
include ::ActiveSupport::ForkTracker::CoreExt
include ::Kernel
include ::PP::ObjectMixin

File diff suppressed because it is too large Load Diff

View File

@ -3802,7 +3802,6 @@ end
#
# source://highline//lib/highline/import.rb#30
class Object < ::BasicObject
include ::ActiveSupport::ForkTracker::CoreExt
include ::Kernel
include ::PP::ObjectMixin

View File

@ -1743,8 +1743,6 @@ end
#
# source://hpricot//lib/hpricot/blankslate.rb#37
module Kernel
include ::ActiveSupport::ForkTracker::CoreExt
class << self
# Detect method additions to Kernel and remove them in the
# BlankSlate class.
@ -1756,7 +1754,6 @@ end
# source://hpricot//lib/hpricot/blankslate.rb#51
class Object < ::BasicObject
include ::ActiveSupport::ForkTracker::CoreExt
include ::Kernel
include ::PP::ObjectMixin

File diff suppressed because it is too large Load Diff

View File

@ -913,7 +913,7 @@ class Parlour::RbiGenerator::Namespace < ::Parlour::RbiGenerator::RbiObject
# @param block [T.proc.params(x: Attribute).void, nil]
# @return [Attribute]
#
# source://sorbet-runtime/0.5.11150/lib/types/private/methods/_methods.rb#255
# source://sorbet-runtime/0.5.11219/lib/types/private/methods/_methods.rb#252
def create_attr(*args, **_arg1, &blk); end
# source://parlour//lib/parlour/rbi_generator/namespace.rb#472
@ -1121,7 +1121,7 @@ class Parlour::RbiGenerator::Namespace < ::Parlour::RbiGenerator::RbiObject
# @return [Array<RbiGenerator::TypeAlias>]
#
# source://sorbet-runtime/0.5.11150/lib/types/private/methods/_methods.rb#255
# source://sorbet-runtime/0.5.11219/lib/types/private/methods/_methods.rb#252
def type_aliases(*args, **_arg1, &blk); end
private
@ -1885,7 +1885,7 @@ class Parlour::RbsGenerator::Namespace < ::Parlour::RbsGenerator::RbsObject
# @param block [T.proc.params(x: Attribute).void, nil]
# @return [Attribute]
#
# source://sorbet-runtime/0.5.11150/lib/types/private/methods/_methods.rb#255
# source://sorbet-runtime/0.5.11219/lib/types/private/methods/_methods.rb#252
def create_attr(*args, **_arg1, &blk); end
# source://parlour//lib/parlour/rbs_generator/namespace.rb#347
@ -2052,7 +2052,7 @@ class Parlour::RbsGenerator::Namespace < ::Parlour::RbsGenerator::RbsObject
# @return [Array<RbsGenerator::TypeAlias>]
#
# source://sorbet-runtime/0.5.11150/lib/types/private/methods/_methods.rb#255
# source://sorbet-runtime/0.5.11219/lib/types/private/methods/_methods.rb#252
def type_aliases(*args, **_arg1, &blk); end
private
@ -2395,7 +2395,7 @@ class Parlour::TypeParser::IntermediateSig < ::T::Struct
prop :params, T.nilable(T::Array[::Parser::AST::Node])
class << self
# source://sorbet-runtime/0.5.11150/lib/types/struct.rb#13
# source://sorbet-runtime/0.5.11219/lib/types/struct.rb#13
def inherited(s); end
end
end
@ -2450,7 +2450,7 @@ class Parlour::TypedObject
# @param comment [String, Array<String>]
# @return [void]
#
# source://sorbet-runtime/0.5.11150/lib/types/private/methods/_methods.rb#255
# source://sorbet-runtime/0.5.11219/lib/types/private/methods/_methods.rb#252
def add_comments(*args, **_arg1, &blk); end
# source://parlour//lib/parlour/typed_object.rb#32
@ -2471,7 +2471,7 @@ class Parlour::TypedObject
# @return [String]
#
# source://sorbet-runtime/0.5.11150/lib/types/private/methods/_methods.rb#255
# source://sorbet-runtime/0.5.11219/lib/types/private/methods/_methods.rb#252
def inspect(*args, **_arg1, &blk); end
# source://parlour//lib/parlour/typed_object.rb#26
@ -2480,7 +2480,7 @@ class Parlour::TypedObject
# @return [String]
#
# source://sorbet-runtime/0.5.11150/lib/types/private/methods/_methods.rb#255
# source://sorbet-runtime/0.5.11219/lib/types/private/methods/_methods.rb#252
def to_s(*args, **_arg1, &blk); end
protected

View File

@ -22,7 +22,6 @@ end
# source://pry//lib/pry/core_extensions.rb#24
class Object < ::BasicObject
include ::ActiveSupport::ForkTracker::CoreExt
include ::Kernel
include ::PP::ObjectMixin
@ -969,8 +968,6 @@ Pry::BINDING_METHOD_IMPL = T.let(T.unsafe(nil), Array)
# source://pry//lib/pry/basic_object.rb#4
class Pry::BasicObject < ::BasicObject
include ::Kernel
include ::ActiveSupport::ForkTracker::CoreExt
include ::ActiveSupport::ForkTracker::CoreExtPrivate
end
# source://pry//lib/pry/basic_object.rb#6

View File

@ -6,7 +6,6 @@
# source://racc//lib/racc/compat.rb#14
class Object < ::BasicObject
include ::ActiveSupport::ForkTracker::CoreExt
include ::Kernel
include ::PP::ObjectMixin
end

File diff suppressed because it is too large Load Diff

View File

@ -5,7 +5,6 @@
# Please instead update this file by running `bin/tapioca gem rainbow`.
class Object < ::BasicObject
include ::ActiveSupport::ForkTracker::CoreExt
include ::Kernel
include ::PP::ObjectMixin

View File

@ -1820,7 +1820,7 @@ class RBI::Rewriters::Merge::Conflict < ::T::Struct
def to_s; end
class << self
# source://sorbet-runtime/0.5.11155/lib/types/struct.rb#13
# source://sorbet-runtime/0.5.11219/lib/types/struct.rb#13
def inherited(s); end
end
end
@ -2037,7 +2037,7 @@ class RBI::Rewriters::RemoveKnownDefinitions::Operation < ::T::Struct
def to_s; end
class << self
# source://sorbet-runtime/0.5.11155/lib/types/struct.rb#13
# source://sorbet-runtime/0.5.11219/lib/types/struct.rb#13
def inherited(s); end
end
end
@ -2670,7 +2670,7 @@ class RBI::Tree < ::RBI::NodeWithComments
sig { params(annotation: ::String, annotate_scopes: T::Boolean, annotate_properties: T::Boolean).void }
def annotate!(annotation, annotate_scopes: T.unsafe(nil), annotate_properties: T.unsafe(nil)); end
# source://tapioca/0.11.13/lib/tapioca/rbi_ext/model.rb#38
# source://tapioca/0.12.0/lib/tapioca/rbi_ext/model.rb#38
sig do
params(
name: ::String,
@ -2680,19 +2680,19 @@ class RBI::Tree < ::RBI::NodeWithComments
end
def create_class(name, superclass_name: T.unsafe(nil), &block); end
# source://tapioca/0.11.13/lib/tapioca/rbi_ext/model.rb#45
# source://tapioca/0.12.0/lib/tapioca/rbi_ext/model.rb#45
sig { params(name: ::String, value: ::String).void }
def create_constant(name, value:); end
# source://tapioca/0.11.13/lib/tapioca/rbi_ext/model.rb#55
# source://tapioca/0.12.0/lib/tapioca/rbi_ext/model.rb#55
sig { params(name: ::String).void }
def create_extend(name); end
# source://tapioca/0.11.13/lib/tapioca/rbi_ext/model.rb#50
# source://tapioca/0.12.0/lib/tapioca/rbi_ext/model.rb#50
sig { params(name: ::String).void }
def create_include(name); end
# source://tapioca/0.11.13/lib/tapioca/rbi_ext/model.rb#89
# source://tapioca/0.12.0/lib/tapioca/rbi_ext/model.rb#89
sig do
params(
name: ::String,
@ -2705,19 +2705,19 @@ class RBI::Tree < ::RBI::NodeWithComments
end
def create_method(name, parameters: T.unsafe(nil), return_type: T.unsafe(nil), class_method: T.unsafe(nil), visibility: T.unsafe(nil), comments: T.unsafe(nil)); end
# source://tapioca/0.11.13/lib/tapioca/rbi_ext/model.rb#60
# source://tapioca/0.12.0/lib/tapioca/rbi_ext/model.rb#60
sig { params(name: ::String).void }
def create_mixes_in_class_methods(name); end
# source://tapioca/0.11.13/lib/tapioca/rbi_ext/model.rb#25
# source://tapioca/0.12.0/lib/tapioca/rbi_ext/model.rb#25
sig { params(name: ::String, block: T.nilable(T.proc.params(scope: ::RBI::Scope).void)).returns(::RBI::Scope) }
def create_module(name, &block); end
# source://tapioca/0.11.13/lib/tapioca/rbi_ext/model.rb#9
# source://tapioca/0.12.0/lib/tapioca/rbi_ext/model.rb#9
sig { params(constant: ::Module, block: T.nilable(T.proc.params(scope: ::RBI::Scope).void)).returns(::RBI::Scope) }
def create_path(constant, &block); end
# source://tapioca/0.11.13/lib/tapioca/rbi_ext/model.rb#74
# source://tapioca/0.12.0/lib/tapioca/rbi_ext/model.rb#74
sig do
params(
name: ::String,
@ -2779,11 +2779,11 @@ class RBI::Tree < ::RBI::NodeWithComments
private
# source://tapioca/0.11.13/lib/tapioca/rbi_ext/model.rb#116
# source://tapioca/0.12.0/lib/tapioca/rbi_ext/model.rb#116
sig { params(node: ::RBI::Node).returns(::RBI::Node) }
def create_node(node); end
# source://tapioca/0.11.13/lib/tapioca/rbi_ext/model.rb#111
# source://tapioca/0.12.0/lib/tapioca/rbi_ext/model.rb#111
sig { returns(T::Hash[::String, ::RBI::Node]) }
def nodes_cache; end
end

View File

@ -6269,12 +6269,6 @@ module RSpec::Core::HashImitatable
# source://rspec-core//lib/rspec/core/metadata.rb#367
def deconstruct_keys(*args, &block); end
# source://rspec-core//lib/rspec/core/metadata.rb#367
def deep_merge(*args, &block); end
# source://rspec-core//lib/rspec/core/metadata.rb#367
def deep_merge!(*args, &block); end
# source://rspec-core//lib/rspec/core/metadata.rb#367
def default(*args, &block); end
@ -6341,12 +6335,6 @@ module RSpec::Core::HashImitatable
# source://rspec-core//lib/rspec/core/metadata.rb#367
def except(*args, &block); end
# source://rspec-core//lib/rspec/core/metadata.rb#367
def except!(*args, &block); end
# source://rspec-core//lib/rspec/core/metadata.rb#367
def extract!(*args, &block); end
# source://rspec-core//lib/rspec/core/metadata.rb#367
def fetch(*args, &block); end
@ -6497,9 +6485,6 @@ module RSpec::Core::HashImitatable
# source://rspec-core//lib/rspec/core/metadata.rb#367
def slice(*args, &block); end
# source://rspec-core//lib/rspec/core/metadata.rb#367
def slice!(*args, &block); end
# source://rspec-core//lib/rspec/core/metadata.rb#367
def slice_after(*args, &block); end
@ -9337,15 +9322,6 @@ class RSpec::Core::OutputWrapper
# source://rspec-core//lib/rspec/core/output_wrapper.rb#23
def noecho(*args, &block); end
# source://rspec-core//lib/rspec/core/output_wrapper.rb#23
def nonblock(*args, &block); end
# source://rspec-core//lib/rspec/core/output_wrapper.rb#23
def nonblock=(*args, &block); end
# source://rspec-core//lib/rspec/core/output_wrapper.rb#23
def nonblock?(*args, &block); end
# source://rspec-core//lib/rspec/core/output_wrapper.rb#23
def nread(*args, &block); end

View File

@ -90,7 +90,7 @@ module RSpec::Sorbet::Doubles
# @return [void]
#
# source://sorbet-runtime/0.5.11150/lib/types/private/methods/_methods.rb#255
# source://sorbet-runtime/0.5.11219/lib/types/private/methods/_methods.rb#252
def allow_instance_doubles!(*args, **_arg1, &blk); end
# source://rspec-sorbet//lib/rspec/sorbet/doubles.rb#36

View File

@ -5134,9 +5134,6 @@ RuboCop::AST::NodePattern::Sets::SET_ABSTRACT_OVERRIDE_OVERRIDABLE_ETC = T.let(T
# source://rubocop-ast//lib/rubocop/ast/node_pattern/sets.rb#10
RuboCop::AST::NodePattern::Sets::SET_ADD_DEPENDENCY_ADD_RUNTIME_DEPENDENCY_ADD_DEVELOPMENT_DEPENDENCY = T.let(T.unsafe(nil), Set)
# source://rubocop-ast//lib/rubocop/ast/node_pattern/sets.rb#10
RuboCop::AST::NodePattern::Sets::SET_AFTER_ACTION_APPEND_AFTER_ACTION_APPEND_AROUND_ACTION_ETC = T.let(T.unsafe(nil), Set)
# source://rubocop-ast//lib/rubocop/ast/node_pattern/sets.rb#10
RuboCop::AST::NodePattern::Sets::SET_ALL_ANY_CLASS_OF_ETC = T.let(T.unsafe(nil), Set)
@ -5152,9 +5149,6 @@ RuboCop::AST::NodePattern::Sets::SET_ANY_EMPTY = T.let(T.unsafe(nil), Set)
# source://rubocop-ast//lib/rubocop/ast/node_pattern/sets.rb#10
RuboCop::AST::NodePattern::Sets::SET_ANY_EMPTY_NONE_ETC = T.let(T.unsafe(nil), Set)
# source://rubocop-ast//lib/rubocop/ast/node_pattern/sets.rb#10
RuboCop::AST::NodePattern::Sets::SET_AP_P_PP_ETC = T.let(T.unsafe(nil), Set)
# source://rubocop-ast//lib/rubocop/ast/node_pattern/sets.rb#10
RuboCop::AST::NodePattern::Sets::SET_ASSERT_EQUAL_REFUTE_EQUAL = T.let(T.unsafe(nil), Set)
@ -5167,21 +5161,12 @@ RuboCop::AST::NodePattern::Sets::SET_ATTR_READER_ATTR_WRITER_ATTR_ACCESSOR_ATTR
# source://rubocop-ast//lib/rubocop/ast/node_pattern/sets.rb#10
RuboCop::AST::NodePattern::Sets::SET_BACKGROUND_SCENARIO_XSCENARIO_ETC = T.let(T.unsafe(nil), Set)
# source://rubocop-ast//lib/rubocop/ast/node_pattern/sets.rb#10
RuboCop::AST::NodePattern::Sets::SET_BEFORE_AFTER = T.let(T.unsafe(nil), Set)
# source://rubocop-ast//lib/rubocop/ast/node_pattern/sets.rb#10
RuboCop::AST::NodePattern::Sets::SET_BELONGS_TO_HAS_ONE_HAS_MANY_HAS_AND_BELONGS_TO_MANY = T.let(T.unsafe(nil), Set)
# source://rubocop-ast//lib/rubocop/ast/node_pattern/sets.rb#10
RuboCop::AST::NodePattern::Sets::SET_BE_EQ_EQL_EQUAL = T.let(T.unsafe(nil), Set)
# source://rubocop-ast//lib/rubocop/ast/node_pattern/sets.rb#10
RuboCop::AST::NodePattern::Sets::SET_BE_TRUTHY_BE_FALSEY_BE_FALSY_ETC = T.let(T.unsafe(nil), Set)
# source://rubocop-ast//lib/rubocop/ast/node_pattern/sets.rb#10
RuboCop::AST::NodePattern::Sets::SET_BINWRITE_SYSWRITE_WRITE_WRITE_NONBLOCK = T.let(T.unsafe(nil), Set)
# source://rubocop-ast//lib/rubocop/ast/node_pattern/sets.rb#10
RuboCop::AST::NodePattern::Sets::SET_BRANCH_REF_TAG = T.let(T.unsafe(nil), Set)
@ -5194,9 +5179,6 @@ RuboCop::AST::NodePattern::Sets::SET_CALL_RUN = T.let(T.unsafe(nil), Set)
# source://rubocop-ast//lib/rubocop/ast/node_pattern/sets.rb#10
RuboCop::AST::NodePattern::Sets::SET_CAPTURE2_CAPTURE2E_CAPTURE3_ETC = T.let(T.unsafe(nil), Set)
# source://rubocop-ast//lib/rubocop/ast/node_pattern/sets.rb#10
RuboCop::AST::NodePattern::Sets::SET_CHANGE_COLUMN_EXECUTE = T.let(T.unsafe(nil), Set)
# source://rubocop-ast//lib/rubocop/ast/node_pattern/sets.rb#10
RuboCop::AST::NodePattern::Sets::SET_CIPHER_DIGEST = T.let(T.unsafe(nil), Set)
@ -5224,12 +5206,6 @@ RuboCop::AST::NodePattern::Sets::SET_CONTEXT_SHARED_CONTEXT = T.let(T.unsafe(nil
# source://rubocop-ast//lib/rubocop/ast/node_pattern/sets.rb#10
RuboCop::AST::NodePattern::Sets::SET_COUNT_LENGTH_SIZE = T.let(T.unsafe(nil), Set)
# source://rubocop-ast//lib/rubocop/ast/node_pattern/sets.rb#10
RuboCop::AST::NodePattern::Sets::SET_CREATED_AT_UPDATED_AT = T.let(T.unsafe(nil), Set)
# source://rubocop-ast//lib/rubocop/ast/node_pattern/sets.rb#10
RuboCop::AST::NodePattern::Sets::SET_CREATED_AT_UPDATED_AT_2 = T.let(T.unsafe(nil), Set)
# source://rubocop-ast//lib/rubocop/ast/node_pattern/sets.rb#10
RuboCop::AST::NodePattern::Sets::SET_DEFINE_METHOD = T.let(T.unsafe(nil), Set)
@ -5308,33 +5284,18 @@ RuboCop::AST::NodePattern::Sets::SET_FORMAT_SPRINTF_PRINTF = T.let(T.unsafe(nil)
# source://rubocop-ast//lib/rubocop/ast/node_pattern/sets.rb#10
RuboCop::AST::NodePattern::Sets::SET_GETHOSTBYADDR_GETHOSTBYNAME = T.let(T.unsafe(nil), Set)
# source://rubocop-ast//lib/rubocop/ast/node_pattern/sets.rb#10
RuboCop::AST::NodePattern::Sets::SET_GET_POST_PUT_ETC = T.let(T.unsafe(nil), Set)
# source://rubocop-ast//lib/rubocop/ast/node_pattern/sets.rb#10
RuboCop::AST::NodePattern::Sets::SET_GSUB_GSUB = T.let(T.unsafe(nil), Set)
# source://rubocop-ast//lib/rubocop/ast/node_pattern/sets.rb#10
RuboCop::AST::NodePattern::Sets::SET_GSUB_GSUB_SUB_SUB = T.let(T.unsafe(nil), Set)
# source://rubocop-ast//lib/rubocop/ast/node_pattern/sets.rb#10
RuboCop::AST::NodePattern::Sets::SET_HAS_MANY_HAS_ONE = T.let(T.unsafe(nil), Set)
# source://rubocop-ast//lib/rubocop/ast/node_pattern/sets.rb#10
RuboCop::AST::NodePattern::Sets::SET_HAS_MANY_HAS_ONE_BELONGS_TO = T.let(T.unsafe(nil), Set)
# source://rubocop-ast//lib/rubocop/ast/node_pattern/sets.rb#10
RuboCop::AST::NodePattern::Sets::SET_IF_UNLESS = T.let(T.unsafe(nil), Set)
# source://rubocop-ast//lib/rubocop/ast/node_pattern/sets.rb#10
RuboCop::AST::NodePattern::Sets::SET_INCLUDE_EXTEND_PREPEND = T.let(T.unsafe(nil), Set)
# source://rubocop-ast//lib/rubocop/ast/node_pattern/sets.rb#10
RuboCop::AST::NodePattern::Sets::SET_INCLUDE_MEMBER = T.let(T.unsafe(nil), Set)
# source://rubocop-ast//lib/rubocop/ast/node_pattern/sets.rb#10
RuboCop::AST::NodePattern::Sets::SET_INSERT_INSERT = T.let(T.unsafe(nil), Set)
# source://rubocop-ast//lib/rubocop/ast/node_pattern/sets.rb#10
RuboCop::AST::NodePattern::Sets::SET_INSTANCE_EVAL_CLASS_EVAL_MODULE_EVAL = T.let(T.unsafe(nil), Set)
@ -5350,9 +5311,6 @@ RuboCop::AST::NodePattern::Sets::SET_IS_EXPECTED_SHOULD_SHOULD_NOT = T.let(T.uns
# source://rubocop-ast//lib/rubocop/ast/node_pattern/sets.rb#10
RuboCop::AST::NodePattern::Sets::SET_KEYS_VALUES = T.let(T.unsafe(nil), Set)
# source://rubocop-ast//lib/rubocop/ast/node_pattern/sets.rb#10
RuboCop::AST::NodePattern::Sets::SET_KEYS_VALUES_TO_H_TO_XML = T.let(T.unsafe(nil), Set)
# source://rubocop-ast//lib/rubocop/ast/node_pattern/sets.rb#10
RuboCop::AST::NodePattern::Sets::SET_KEY_HAS_KEY_FETCH_ETC = T.let(T.unsafe(nil), Set)
@ -5371,15 +5329,15 @@ RuboCop::AST::NodePattern::Sets::SET_MAP_COLLECT = T.let(T.unsafe(nil), Set)
# source://rubocop-ast//lib/rubocop/ast/node_pattern/sets.rb#10
RuboCop::AST::NodePattern::Sets::SET_MATCH_MATCH = T.let(T.unsafe(nil), Set)
# source://rubocop-ast//lib/rubocop/ast/node_pattern/sets.rb#10
RuboCop::AST::NodePattern::Sets::SET_MATCH_MATCH_ = T.let(T.unsafe(nil), Set)
# source://rubocop-ast//lib/rubocop/ast/node_pattern/sets.rb#10
RuboCop::AST::NodePattern::Sets::SET_MATCH__MATCH = T.let(T.unsafe(nil), Set)
# source://rubocop-ast//lib/rubocop/ast/node_pattern/sets.rb#10
RuboCop::AST::NodePattern::Sets::SET_MATCH___MATCH = T.let(T.unsafe(nil), Set)
# source://rubocop-ast//lib/rubocop/ast/node_pattern/sets.rb#10
RuboCop::AST::NodePattern::Sets::SET_MESSAGES_DETAILS = T.let(T.unsafe(nil), Set)
# source://rubocop-ast//lib/rubocop/ast/node_pattern/sets.rb#10
RuboCop::AST::NodePattern::Sets::SET_MODULE_FUNCTION_RUBY2_KEYWORDS = T.let(T.unsafe(nil), Set)
@ -5395,12 +5353,6 @@ RuboCop::AST::NodePattern::Sets::SET_NEW_OPEN = T.let(T.unsafe(nil), Set)
# source://rubocop-ast//lib/rubocop/ast/node_pattern/sets.rb#10
RuboCop::AST::NodePattern::Sets::SET_NIL_ = T.let(T.unsafe(nil), Set)
# source://rubocop-ast//lib/rubocop/ast/node_pattern/sets.rb#10
RuboCop::AST::NodePattern::Sets::SET_NOTICE_ALERT = T.let(T.unsafe(nil), Set)
# source://rubocop-ast//lib/rubocop/ast/node_pattern/sets.rb#10
RuboCop::AST::NodePattern::Sets::SET_ONLY_EXCEPT = T.let(T.unsafe(nil), Set)
# source://rubocop-ast//lib/rubocop/ast/node_pattern/sets.rb#10
RuboCop::AST::NodePattern::Sets::SET_PIPELINE_PIPELINE_R_PIPELINE_RW_ETC = T.let(T.unsafe(nil), Set)
@ -5452,24 +5404,12 @@ RuboCop::AST::NodePattern::Sets::SET_RECEIVE_RECEIVE_MESSAGE_CHAIN = T.let(T.uns
# source://rubocop-ast//lib/rubocop/ast/node_pattern/sets.rb#10
RuboCop::AST::NodePattern::Sets::SET_REDUCE_INJECT = T.let(T.unsafe(nil), Set)
# source://rubocop-ast//lib/rubocop/ast/node_pattern/sets.rb#10
RuboCop::AST::NodePattern::Sets::SET_REFERER_REFERRER = T.let(T.unsafe(nil), Set)
# source://rubocop-ast//lib/rubocop/ast/node_pattern/sets.rb#10
RuboCop::AST::NodePattern::Sets::SET_REJECT_DELETE_IF_REJECT = T.let(T.unsafe(nil), Set)
# source://rubocop-ast//lib/rubocop/ast/node_pattern/sets.rb#10
RuboCop::AST::NodePattern::Sets::SET_RENDER_REDIRECT_TO = T.let(T.unsafe(nil), Set)
# source://rubocop-ast//lib/rubocop/ast/node_pattern/sets.rb#10
RuboCop::AST::NodePattern::Sets::SET_REQUIRE_REQUIRE_RELATIVE = T.let(T.unsafe(nil), Set)
# source://rubocop-ast//lib/rubocop/ast/node_pattern/sets.rb#10
RuboCop::AST::NodePattern::Sets::SET_RETURNING_UNIQUE_BY = T.let(T.unsafe(nil), Set)
# source://rubocop-ast//lib/rubocop/ast/node_pattern/sets.rb#10
RuboCop::AST::NodePattern::Sets::SET_ROOT_PUBLIC_PATH = T.let(T.unsafe(nil), Set)
# source://rubocop-ast//lib/rubocop/ast/node_pattern/sets.rb#10
RuboCop::AST::NodePattern::Sets::SET_SELECT_FILTER_FIND_ALL = T.let(T.unsafe(nil), Set)
@ -5482,15 +5422,15 @@ RuboCop::AST::NodePattern::Sets::SET_SELECT_SELECT = T.let(T.unsafe(nil), Set)
# source://rubocop-ast//lib/rubocop/ast/node_pattern/sets.rb#10
RuboCop::AST::NodePattern::Sets::SET_SEND_PUBLIC_SEND___SEND__ = T.let(T.unsafe(nil), Set)
# source://rubocop-ast//lib/rubocop/ast/node_pattern/sets.rb#10
RuboCop::AST::NodePattern::Sets::SET_SEND___SEND__ = T.let(T.unsafe(nil), Set)
# source://rubocop-ast//lib/rubocop/ast/node_pattern/sets.rb#10
RuboCop::AST::NodePattern::Sets::SET_SHOULD_SHOULD_NOT = T.let(T.unsafe(nil), Set)
# source://rubocop-ast//lib/rubocop/ast/node_pattern/sets.rb#10
RuboCop::AST::NodePattern::Sets::SET_SIG_HELPERS = T.let(T.unsafe(nil), Set)
# source://rubocop-ast//lib/rubocop/ast/node_pattern/sets.rb#10
RuboCop::AST::NodePattern::Sets::SET_SKIP_AFTER_ACTION_SKIP_AROUND_ACTION_SKIP_BEFORE_ACTION_SKIP_ACTION_CALLBACK = T.let(T.unsafe(nil), Set)
# source://rubocop-ast//lib/rubocop/ast/node_pattern/sets.rb#10
RuboCop::AST::NodePattern::Sets::SET_SKIP_PENDING = T.let(T.unsafe(nil), Set)
@ -5515,9 +5455,6 @@ RuboCop::AST::NodePattern::Sets::SET_START_WITH_STARTS_WITH_END_WITH_ENDS_WITH =
# source://rubocop-ast//lib/rubocop/ast/node_pattern/sets.rb#10
RuboCop::AST::NodePattern::Sets::SET_STATUS_CODE = T.let(T.unsafe(nil), Set)
# source://rubocop-ast//lib/rubocop/ast/node_pattern/sets.rb#10
RuboCop::AST::NodePattern::Sets::SET_STDOUT_STDERR = T.let(T.unsafe(nil), Set)
# source://rubocop-ast//lib/rubocop/ast/node_pattern/sets.rb#10
RuboCop::AST::NodePattern::Sets::SET_STRUCT_CLASS = T.let(T.unsafe(nil), Set)
@ -5531,7 +5468,7 @@ RuboCop::AST::NodePattern::Sets::SET_STRUCT_IMMUTABLESTRUCT_INEXACTSTRUCT = T.le
RuboCop::AST::NodePattern::Sets::SET_SUCC_PRED_NEXT = T.let(T.unsafe(nil), Set)
# source://rubocop-ast//lib/rubocop/ast/node_pattern/sets.rb#10
RuboCop::AST::NodePattern::Sets::SET_TIME_DATETIME = T.let(T.unsafe(nil), Set)
RuboCop::AST::NodePattern::Sets::SET_TEXT_EXACT_TEXT = T.let(T.unsafe(nil), Set)
# source://rubocop-ast//lib/rubocop/ast/node_pattern/sets.rb#10
RuboCop::AST::NodePattern::Sets::SET_TO_ENUM_ENUM_FOR = T.let(T.unsafe(nil), Set)
@ -5545,21 +5482,9 @@ RuboCop::AST::NodePattern::Sets::SET_TO_I_TO_F_TO_C_TO_R = T.let(T.unsafe(nil),
# source://rubocop-ast//lib/rubocop/ast/node_pattern/sets.rb#10
RuboCop::AST::NodePattern::Sets::SET_TO_TO_NOT_NOT_TO = T.let(T.unsafe(nil), Set)
# source://rubocop-ast//lib/rubocop/ast/node_pattern/sets.rb#10
RuboCop::AST::NodePattern::Sets::SET_TRANSLATE_LOCALIZE = T.let(T.unsafe(nil), Set)
# source://rubocop-ast//lib/rubocop/ast/node_pattern/sets.rb#10
RuboCop::AST::NodePattern::Sets::SET_TRANSLATE_T = T.let(T.unsafe(nil), Set)
# source://rubocop-ast//lib/rubocop/ast/node_pattern/sets.rb#10
RuboCop::AST::NodePattern::Sets::SET_TRUE_FALSE = T.let(T.unsafe(nil), Set)
# source://rubocop-ast//lib/rubocop/ast/node_pattern/sets.rb#10
RuboCop::AST::NodePattern::Sets::SET_TRY_TRY = T.let(T.unsafe(nil), Set)
# source://rubocop-ast//lib/rubocop/ast/node_pattern/sets.rb#10
RuboCop::AST::NodePattern::Sets::SET_T_TRANSLATE_L_LOCALIZE = T.let(T.unsafe(nil), Set)
# source://rubocop-ast//lib/rubocop/ast/node_pattern/sets.rb#10
RuboCop::AST::NodePattern::Sets::SET_ZERO_POSITIVE_NEGATIVE = T.let(T.unsafe(nil), Set)

View File

@ -13,28 +13,28 @@ module RuboCop::Cop; end
module RuboCop::Cop::Lint; end
class RuboCop::Cop::Lint::UnusedMethodArgument < ::RuboCop::Cop::Base
# source://rubocop/1.59.0/lib/rubocop/cop/lint/unused_method_argument.rb#66
# source://rubocop/1.60.2/lib/rubocop/cop/lint/unused_method_argument.rb#66
def not_implemented?(param0 = T.unsafe(nil)); end
private
# source://rubocop/1.59.0/lib/rubocop/cop/lint/unused_method_argument.rb#81
# source://rubocop/1.60.2/lib/rubocop/cop/lint/unused_method_argument.rb#81
def autocorrect(corrector, node); end
# source://rubocop/1.59.0/lib/rubocop/cop/lint/unused_method_argument.rb#85
# source://rubocop/1.60.2/lib/rubocop/cop/lint/unused_method_argument.rb#85
def check_argument(variable); end
# source://rubocop/1.59.0/lib/rubocop/cop/lint/unused_method_argument.rb#93
# source://rubocop/1.60.2/lib/rubocop/cop/lint/unused_method_argument.rb#93
def ignored_method?(body); end
# source://rubocop/1.59.0/lib/rubocop/cop/lint/unused_method_argument.rb#98
# source://rubocop/1.60.2/lib/rubocop/cop/lint/unused_method_argument.rb#98
def message(variable); end
class << self
# source://rubocop-performance//lib/rubocop-performance.rb#15
def autocorrect_incompatible_with; end
# source://rubocop/1.59.0/lib/rubocop/cop/lint/unused_method_argument.rb#75
# source://rubocop/1.60.2/lib/rubocop/cop/lint/unused_method_argument.rb#75
def joining_forces; end
end
end

File diff suppressed because it is too large Load Diff

View File

@ -5303,173 +5303,6 @@ RuboCop::Cop::RSpec::Rails::HaveHttpStatus::RESTRICT_ON_SEND = T.let(T.unsafe(ni
# source://rubocop-rspec//lib/rubocop/cop/rspec/rails/have_http_status.rb#24
RuboCop::Cop::RSpec::Rails::HaveHttpStatus::RUNNERS = T.let(T.unsafe(nil), Set)
# Enforces use of symbolic or numeric value to describe HTTP status.
#
# This cop inspects only `have_http_status` calls.
# So, this cop does not check if a method starting with `be_*` is used
# when setting for `EnforcedStyle: symbolic` or
# `EnforcedStyle: numeric`.
#
# @example `EnforcedStyle: symbolic` (default)
# # bad
# it { is_expected.to have_http_status 200 }
# it { is_expected.to have_http_status 404 }
# it { is_expected.to have_http_status "403" }
#
# # good
# it { is_expected.to have_http_status :ok }
# it { is_expected.to have_http_status :not_found }
# it { is_expected.to have_http_status :forbidden }
# it { is_expected.to have_http_status :success }
# it { is_expected.to have_http_status :error }
# @example `EnforcedStyle: numeric`
# # bad
# it { is_expected.to have_http_status :ok }
# it { is_expected.to have_http_status :not_found }
# it { is_expected.to have_http_status "forbidden" }
#
# # good
# it { is_expected.to have_http_status 200 }
# it { is_expected.to have_http_status 404 }
# it { is_expected.to have_http_status 403 }
# it { is_expected.to have_http_status :success }
# it { is_expected.to have_http_status :error }
# @example `EnforcedStyle: be_status`
# # bad
# it { is_expected.to have_http_status :ok }
# it { is_expected.to have_http_status :not_found }
# it { is_expected.to have_http_status "forbidden" }
# it { is_expected.to have_http_status 200 }
# it { is_expected.to have_http_status 404 }
# it { is_expected.to have_http_status "403" }
#
# # good
# it { is_expected.to be_ok }
# it { is_expected.to be_not_found }
# it { is_expected.to have_http_status :success }
# it { is_expected.to have_http_status :error }
#
# source://rubocop-rspec//lib/rubocop/cop/rspec/rails/http_status.rb#57
class RuboCop::Cop::RSpec::Rails::HttpStatus < ::RuboCop::Cop::RSpec::Base
include ::RuboCop::Cop::ConfigurableEnforcedStyle
extend ::RuboCop::Cop::AutoCorrector
# source://rubocop-rspec//lib/rubocop/cop/rspec/rails/http_status.rb#63
def http_status(param0 = T.unsafe(nil)); end
# source://rubocop-rspec//lib/rubocop/cop/rspec/rails/http_status.rb#67
def on_send(node); end
private
# source://rubocop-rspec//lib/rubocop/cop/rspec/rails/http_status.rb#83
def checker_class; end
end
# source://rubocop-rspec//lib/rubocop/cop/rspec/rails/http_status.rb#171
class RuboCop::Cop::RSpec::Rails::HttpStatus::BeStatusStyleChecker < ::RuboCop::Cop::RSpec::Rails::HttpStatus::StyleCheckerBase
# source://rubocop-rspec//lib/rubocop/cop/rspec/rails/http_status.rb#177
def offense_range; end
# @return [Boolean]
#
# source://rubocop-rspec//lib/rubocop/cop/rspec/rails/http_status.rb#172
def offensive?; end
# source://rubocop-rspec//lib/rubocop/cop/rspec/rails/http_status.rb#181
def prefer; end
private
# source://rubocop-rspec//lib/rubocop/cop/rspec/rails/http_status.rb#201
def normalize_str; end
# source://rubocop-rspec//lib/rubocop/cop/rspec/rails/http_status.rb#197
def number; end
# source://rubocop-rspec//lib/rubocop/cop/rspec/rails/http_status.rb#193
def symbol; end
end
# source://rubocop-rspec//lib/rubocop/cop/rspec/rails/http_status.rb#150
class RuboCop::Cop::RSpec::Rails::HttpStatus::NumericStyleChecker < ::RuboCop::Cop::RSpec::Rails::HttpStatus::StyleCheckerBase
# @return [Boolean]
#
# source://rubocop-rspec//lib/rubocop/cop/rspec/rails/http_status.rb#151
def offensive?; end
# source://rubocop-rspec//lib/rubocop/cop/rspec/rails/http_status.rb#155
def prefer; end
private
# source://rubocop-rspec//lib/rubocop/cop/rspec/rails/http_status.rb#165
def number; end
# source://rubocop-rspec//lib/rubocop/cop/rspec/rails/http_status.rb#161
def symbol; end
end
# source://rubocop-rspec//lib/rubocop/cop/rspec/rails/http_status.rb#60
RuboCop::Cop::RSpec::Rails::HttpStatus::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
# source://rubocop-rspec//lib/rubocop/cop/rspec/rails/http_status.rb#95
class RuboCop::Cop::RSpec::Rails::HttpStatus::StyleCheckerBase
# @return [StyleCheckerBase] a new instance of StyleCheckerBase
#
# source://rubocop-rspec//lib/rubocop/cop/rspec/rails/http_status.rb#102
def initialize(node); end
# @return [Boolean]
#
# source://rubocop-rspec//lib/rubocop/cop/rspec/rails/http_status.rb#118
def allowed_symbol?; end
# source://rubocop-rspec//lib/rubocop/cop/rspec/rails/http_status.rb#110
def current; end
# @return [Boolean]
#
# source://rubocop-rspec//lib/rubocop/cop/rspec/rails/http_status.rb#122
def custom_http_status_code?; end
# source://rubocop-rspec//lib/rubocop/cop/rspec/rails/http_status.rb#106
def message; end
# Returns the value of attribute node.
#
# source://rubocop-rspec//lib/rubocop/cop/rspec/rails/http_status.rb#100
def node; end
# source://rubocop-rspec//lib/rubocop/cop/rspec/rails/http_status.rb#114
def offense_range; end
end
# source://rubocop-rspec//lib/rubocop/cop/rspec/rails/http_status.rb#98
RuboCop::Cop::RSpec::Rails::HttpStatus::StyleCheckerBase::ALLOWED_STATUSES = T.let(T.unsafe(nil), Array)
# source://rubocop-rspec//lib/rubocop/cop/rspec/rails/http_status.rb#96
RuboCop::Cop::RSpec::Rails::HttpStatus::StyleCheckerBase::MSG = T.let(T.unsafe(nil), String)
# source://rubocop-rspec//lib/rubocop/cop/rspec/rails/http_status.rb#129
class RuboCop::Cop::RSpec::Rails::HttpStatus::SymbolicStyleChecker < ::RuboCop::Cop::RSpec::Rails::HttpStatus::StyleCheckerBase
# @return [Boolean]
#
# source://rubocop-rspec//lib/rubocop/cop/rspec/rails/http_status.rb#130
def offensive?; end
# source://rubocop-rspec//lib/rubocop/cop/rspec/rails/http_status.rb#134
def prefer; end
private
# source://rubocop-rspec//lib/rubocop/cop/rspec/rails/http_status.rb#144
def number; end
# source://rubocop-rspec//lib/rubocop/cop/rspec/rails/http_status.rb#140
def symbol; end
end
# Identifies redundant spec type.
#
# After setting up rspec-rails, you will have enabled
@ -7686,10 +7519,10 @@ class RuboCop::Cop::Style::TrailingCommaInArguments < ::RuboCop::Cop::Base
include ::RuboCop::Cop::ConfigurableEnforcedStyle
include ::RuboCop::Cop::RangeHelp
# source://rubocop/1.59.0/lib/rubocop/cop/style/trailing_comma_in_arguments.rb#95
# source://rubocop/1.60.2/lib/rubocop/cop/style/trailing_comma_in_arguments.rb#95
def on_csend(node); end
# source://rubocop/1.59.0/lib/rubocop/cop/style/trailing_comma_in_arguments.rb#95
# source://rubocop/1.60.2/lib/rubocop/cop/style/trailing_comma_in_arguments.rb#95
def on_send(node); end
class << self

View File

@ -5339,24 +5339,19 @@ RuboCop::Cop::EndKeywordAlignment::MSG = T.let(T.unsafe(nil), String)
module RuboCop::Cop::EnforceSuperclass
# @api private
#
# source://rubocop-rails/2.23.1/lib/rubocop/cop/mixin/enforce_superclass.rb#19
# source://rubocop//lib/rubocop/cop/mixin/enforce_superclass.rb#35
def on_class(node); end
# @api private
#
# source://rubocop-rails/2.23.1/lib/rubocop/cop/mixin/enforce_superclass.rb#25
# source://rubocop//lib/rubocop/cop/mixin/enforce_superclass.rb#39
def on_send(node); end
private
# source://rubocop-rails/2.23.1/lib/rubocop/cop/mixin/enforce_superclass.rb#33
def register_offense(offense_node); end
class << self
# @api private
# @private
#
# source://rubocop-rails/2.23.1/lib/rubocop/cop/mixin/enforce_superclass.rb#7
# source://rubocop//lib/rubocop/cop/mixin/enforce_superclass.rb#16
def included(base); end
end
end
@ -38899,7 +38894,7 @@ class RuboCop::Cop::Style::InverseMethods < ::RuboCop::Cop::Base
def remove_end_parenthesis(corrector, node, method, method_call); end
class << self
# source://rubocop-rails/2.23.1/lib/rubocop-rails.rb#22
# source://rubocop//lib/rubocop/cop/style/inverse_methods.rb#56
def autocorrect_incompatible_with; end
end
end
@ -39940,7 +39935,7 @@ class RuboCop::Cop::Style::MethodCallWithArgsParentheses < ::RuboCop::Cop::Base
def args_parenthesized?(node); end
class << self
# source://rubocop-rails/2.23.1/lib/rubocop-rails.rb#30
# source://rubocop//lib/rubocop/cop/style/method_call_with_args_parentheses.rb#213
def autocorrect_incompatible_with; end
end
end
@ -46496,7 +46491,7 @@ class RuboCop::Cop::Style::RedundantSelf < ::RuboCop::Cop::Base
def regular_method_call?(node); end
class << self
# source://rubocop-rails/2.23.1/lib/rubocop-rails.rb#38
# source://rubocop//lib/rubocop/cop/style/redundant_self.rb#56
def autocorrect_incompatible_with; end
end
end
@ -55094,10 +55089,10 @@ RuboCop::Formatter::PacmanFormatter::FALLBACK_TERMINAL_WIDTH = T.let(T.unsafe(ni
RuboCop::Formatter::PacmanFormatter::GHOST = T.let(T.unsafe(nil), String)
# source://rubocop//lib/rubocop/formatter/pacman_formatter.rb#17
RuboCop::Formatter::PacmanFormatter::PACDOT = T.let(T.unsafe(nil), Rainbow::NullPresenter)
RuboCop::Formatter::PacmanFormatter::PACDOT = T.let(T.unsafe(nil), Rainbow::Presenter)
# source://rubocop//lib/rubocop/formatter/pacman_formatter.rb#16
RuboCop::Formatter::PacmanFormatter::PACMAN = T.let(T.unsafe(nil), Rainbow::NullPresenter)
RuboCop::Formatter::PacmanFormatter::PACMAN = T.let(T.unsafe(nil), Rainbow::Presenter)
# This formatter display dots for files with no offenses and
# letters for files with problems in the them. In the end it
@ -57374,4 +57369,18 @@ end
# source://rubocop//lib/rubocop/core_ext/string.rb#4
class String
include ::Comparable
# Checks whether a string is blank. A string is considered blank if it
# is either empty or contains only whitespace characters.
#
# @example
# ''.blank? #=> true
# @example
# ' '.blank? #=> true
# @example
# ' test'.blank? #=> false
# @return [Boolean] true is the string is blank, false otherwise
#
# source://rubocop//lib/rubocop/core_ext/string.rb#19
def blank?; end
end

View File

@ -5,15 +5,7 @@
# Please instead update this file by running `bin/tapioca gem ruby-prof`.
# source://ruby-prof//lib/ruby-prof/rack.rb#4
module Rack
class << self
# source://rack/3.0.8/lib/rack/version.rb#31
def release; end
# source://rack/3.0.8/lib/rack/version.rb#23
def version; end
end
end
module Rack; end
# source://ruby-prof//lib/ruby-prof/rack.rb#5
class Rack::RubyProf

View File

@ -958,7 +958,7 @@ class Spoom::Coverage::D3::ColorPalette < ::T::Struct
prop :strong, ::String
class << self
# source://sorbet-runtime/0.5.11150/lib/types/struct.rb#13
# source://sorbet-runtime/0.5.11219/lib/types/struct.rb#13
def inherited(s); end
end
end
@ -1298,7 +1298,7 @@ class Spoom::Coverage::Snapshot < ::T::Struct
sig { params(obj: T::Hash[::String, T.untyped]).returns(::Spoom::Coverage::Snapshot) }
def from_obj(obj); end
# source://sorbet-runtime/0.5.11150/lib/types/struct.rb#13
# source://sorbet-runtime/0.5.11219/lib/types/struct.rb#13
def inherited(s); end
end
end
@ -1450,7 +1450,7 @@ class Spoom::Deadcode::Definition < ::T::Struct
def module?; end
class << self
# source://sorbet-runtime/0.5.11150/lib/types/struct.rb#13
# source://sorbet-runtime/0.5.11219/lib/types/struct.rb#13
def inherited(s); end
end
end
@ -2343,7 +2343,7 @@ class Spoom::Deadcode::Reference < ::T::Struct
def method?; end
class << self
# source://sorbet-runtime/0.5.11150/lib/types/struct.rb#13
# source://sorbet-runtime/0.5.11219/lib/types/struct.rb#13
def inherited(s); end
end
end
@ -2593,7 +2593,7 @@ class Spoom::Deadcode::Send < ::T::Struct
def each_arg_assoc(&block); end
class << self
# source://sorbet-runtime/0.5.11150/lib/types/struct.rb#13
# source://sorbet-runtime/0.5.11219/lib/types/struct.rb#13
def inherited(s); end
end
end
@ -2613,7 +2613,7 @@ class Spoom::ExecResult < ::T::Struct
def to_s; end
class << self
# source://sorbet-runtime/0.5.11150/lib/types/struct.rb#13
# source://sorbet-runtime/0.5.11219/lib/types/struct.rb#13
def inherited(s); end
end
end
@ -2821,7 +2821,7 @@ class Spoom::FileTree::Node < ::T::Struct
def path; end
class << self
# source://sorbet-runtime/0.5.11150/lib/types/struct.rb#13
# source://sorbet-runtime/0.5.11219/lib/types/struct.rb#13
def inherited(s); end
end
end
@ -2887,7 +2887,7 @@ class Spoom::Git::Commit < ::T::Struct
def timestamp; end
class << self
# source://sorbet-runtime/0.5.11150/lib/types/struct.rb#13
# source://sorbet-runtime/0.5.11219/lib/types/struct.rb#13
def inherited(s); end
# Parse a line formated as `%h %at` into a `Commit`
@ -2999,7 +2999,7 @@ class Spoom::LSP::Diagnostic < ::T::Struct
sig { params(json: T::Hash[T.untyped, T.untyped]).returns(::Spoom::LSP::Diagnostic) }
def from_json(json); end
# source://sorbet-runtime/0.5.11150/lib/types/struct.rb#13
# source://sorbet-runtime/0.5.11219/lib/types/struct.rb#13
def inherited(s); end
end
end
@ -3032,7 +3032,7 @@ class Spoom::LSP::DocumentSymbol < ::T::Struct
sig { params(json: T::Hash[T.untyped, T.untyped]).returns(::Spoom::LSP::DocumentSymbol) }
def from_json(json); end
# source://sorbet-runtime/0.5.11150/lib/types/struct.rb#13
# source://sorbet-runtime/0.5.11219/lib/types/struct.rb#13
def inherited(s); end
end
end
@ -3090,7 +3090,7 @@ class Spoom::LSP::Hover < ::T::Struct
sig { params(json: T::Hash[T.untyped, T.untyped]).returns(::Spoom::LSP::Hover) }
def from_json(json); end
# source://sorbet-runtime/0.5.11150/lib/types/struct.rb#13
# source://sorbet-runtime/0.5.11219/lib/types/struct.rb#13
def inherited(s); end
end
end
@ -3115,7 +3115,7 @@ class Spoom::LSP::Location < ::T::Struct
sig { params(json: T::Hash[T.untyped, T.untyped]).returns(::Spoom::LSP::Location) }
def from_json(json); end
# source://sorbet-runtime/0.5.11150/lib/types/struct.rb#13
# source://sorbet-runtime/0.5.11219/lib/types/struct.rb#13
def inherited(s); end
end
end
@ -3178,7 +3178,7 @@ class Spoom::LSP::Position < ::T::Struct
sig { params(json: T::Hash[T.untyped, T.untyped]).returns(::Spoom::LSP::Position) }
def from_json(json); end
# source://sorbet-runtime/0.5.11150/lib/types/struct.rb#13
# source://sorbet-runtime/0.5.11219/lib/types/struct.rb#13
def inherited(s); end
end
end
@ -3216,7 +3216,7 @@ class Spoom::LSP::Range < ::T::Struct
sig { params(json: T::Hash[T.untyped, T.untyped]).returns(::Spoom::LSP::Range) }
def from_json(json); end
# source://sorbet-runtime/0.5.11150/lib/types/struct.rb#13
# source://sorbet-runtime/0.5.11219/lib/types/struct.rb#13
def inherited(s); end
end
end
@ -3282,7 +3282,7 @@ class Spoom::LSP::SignatureHelp < ::T::Struct
sig { params(json: T::Hash[T.untyped, T.untyped]).returns(::Spoom::LSP::SignatureHelp) }
def from_json(json); end
# source://sorbet-runtime/0.5.11150/lib/types/struct.rb#13
# source://sorbet-runtime/0.5.11219/lib/types/struct.rb#13
def inherited(s); end
end
end

View File

@ -204,7 +204,7 @@ class RBI::TypedParam < ::T::Struct
const :type, ::String
class << self
# source://sorbet-runtime/0.5.11218/lib/types/struct.rb#13
# source://sorbet-runtime/0.5.11219/lib/types/struct.rb#13
def inherited(s); end
end
end
@ -212,8 +212,6 @@ end
# source://tapioca//lib/tapioca/sorbet_ext/generic_name_patch.rb#5
module T::Generic
include ::Kernel
include ::ActiveSupport::ForkTracker::CoreExt
include ::ActiveSupport::ForkTracker::CoreExtPrivate
# source://tapioca//lib/tapioca/sorbet_ext/generic_name_patch.rb#13
def [](*types); end
@ -1123,7 +1121,7 @@ class Tapioca::ConfigHelper::ConfigError < ::T::Struct
const :message_parts, T::Array[::Tapioca::ConfigHelper::ConfigErrorMessagePart]
class << self
# source://sorbet-runtime/0.5.11218/lib/types/struct.rb#13
# source://sorbet-runtime/0.5.11219/lib/types/struct.rb#13
def inherited(s); end
end
end
@ -1134,7 +1132,7 @@ class Tapioca::ConfigHelper::ConfigErrorMessagePart < ::T::Struct
const :colors, T::Array[::Symbol]
class << self
# source://sorbet-runtime/0.5.11218/lib/types/struct.rb#13
# source://sorbet-runtime/0.5.11219/lib/types/struct.rb#13
def inherited(s); end
end
end
@ -2434,7 +2432,7 @@ class Tapioca::Loaders::Loader
# @param engine [T.class_of(Rails::Engine)]
# @return [Array<String>]
#
# source://sorbet-runtime/0.5.11218/lib/types/private/methods/_methods.rb#252
# source://sorbet-runtime/0.5.11219/lib/types/private/methods/_methods.rb#252
def eager_load_paths(*args, **_arg1, &blk); end
# source://tapioca//lib/tapioca/loaders/loader.rb#198
@ -3342,7 +3340,7 @@ module Tapioca::Static::SymbolLoader
# @return [Array<T.class_of(Rails::Engine)>]
#
# source://sorbet-runtime/0.5.11218/lib/types/private/methods/_methods.rb#252
# source://sorbet-runtime/0.5.11219/lib/types/private/methods/_methods.rb#252
def engines(*args, **_arg1, &blk); end
# source://tapioca//lib/tapioca/static/symbol_loader.rb#82

File diff suppressed because it is too large Load Diff

View File

@ -381,7 +381,7 @@ class YARDSorbet::TStructProp < ::T::Struct
const :types, T::Array[::String]
class << self
# source://sorbet-runtime/0.5.11150/lib/types/struct.rb#13
# source://sorbet-runtime/0.5.11219/lib/types/struct.rb#13
def inherited(s); end
end
end

View File

@ -464,7 +464,6 @@ class Module
end
class Object < ::BasicObject
include ::ActiveSupport::ForkTracker::CoreExt
include ::Kernel
include ::PP::ObjectMixin

View File

@ -1,999 +0,0 @@
# typed: true
# DO NOT EDIT MANUALLY
# This is an autogenerated file for types exported from the `zeitwerk` gem.
# Please instead update this file by running `bin/tapioca gem zeitwerk`.
# source://zeitwerk//lib/zeitwerk/kernel.rb#3
module Kernel
include ::ActiveSupport::ForkTracker::CoreExt
private
# source://zeitwerk//lib/zeitwerk/kernel.rb#27
def require(path); end
class << self
# source://zeitwerk//lib/zeitwerk/kernel.rb#27
def require(path); end
end
end
# source://zeitwerk//lib/zeitwerk.rb#3
module Zeitwerk
class << self
# This is a dangerous method.
#
# source://zeitwerk//lib/zeitwerk.rb#20
def with_loader; end
end
end
# source://zeitwerk//lib/zeitwerk/error.rb#4
class Zeitwerk::Error < ::StandardError; end
# Centralizes the logic for the trace point used to detect the creation of
# explicit namespaces, needed to descend into matching subdirectories right
# after the constant has been defined.
#
# The implementation assumes an explicit namespace is managed by one loader.
# Loaders that reopen namespaces owned by other projects are responsible for
# loading their constant before setup. This is documented.
#
# source://zeitwerk//lib/zeitwerk/explicit_namespace.rb#11
module Zeitwerk::ExplicitNamespace
extend ::Zeitwerk::RealModName
class << self
# source://zeitwerk//lib/zeitwerk/explicit_namespace.rb#35
def __register(cpath, loader); end
# source://zeitwerk//lib/zeitwerk/explicit_namespace.rb#53
def __registered?(cpath); end
# source://zeitwerk//lib/zeitwerk/explicit_namespace.rb#45
def __unregister_loader(loader); end
private
# Maps constant paths that correspond to explicit namespaces according to
# the file system, to the loader responsible for them.
#
# source://zeitwerk//lib/zeitwerk/explicit_namespace.rb#20
def cpaths; end
# source://zeitwerk//lib/zeitwerk/explicit_namespace.rb#58
def disable_tracer_if_unneeded; end
# Returns the value of attribute mutex.
#
# source://zeitwerk//lib/zeitwerk/explicit_namespace.rb#24
def mutex; end
# source://zeitwerk//lib/zeitwerk/explicit_namespace.rb#35
def register(cpath, loader); end
# source://zeitwerk//lib/zeitwerk/explicit_namespace.rb#53
def registered?(cpath); end
# source://zeitwerk//lib/zeitwerk/explicit_namespace.rb#65
def tracepoint_class_callback(event); end
# Returns the value of attribute tracer.
#
# source://zeitwerk//lib/zeitwerk/explicit_namespace.rb#28
def tracer; end
# source://zeitwerk//lib/zeitwerk/explicit_namespace.rb#45
def unregister_loader(loader); end
end
end
# source://zeitwerk//lib/zeitwerk/gem_inflector.rb#5
class Zeitwerk::GemInflector < ::Zeitwerk::Inflector
# @return [GemInflector] a new instance of GemInflector
#
# source://zeitwerk//lib/zeitwerk/gem_inflector.rb#6
def initialize(root_file); end
# source://zeitwerk//lib/zeitwerk/gem_inflector.rb#13
def camelize(basename, abspath); end
end
# @private
#
# source://zeitwerk//lib/zeitwerk/gem_loader.rb#5
class Zeitwerk::GemLoader < ::Zeitwerk::Loader
# @return [GemLoader] a new instance of GemLoader
#
# source://zeitwerk//lib/zeitwerk/gem_loader.rb#19
def initialize(root_file, namespace:, warn_on_extra_files:); end
# source://zeitwerk//lib/zeitwerk/gem_loader.rb#34
def setup; end
private
# source://zeitwerk//lib/zeitwerk/gem_loader.rb#42
def warn_on_extra_files; end
class << self
# @private
#
# source://zeitwerk//lib/zeitwerk/gem_loader.rb#14
def __new(root_file, namespace:, warn_on_extra_files:); end
private
def new(*_arg0); end
end
end
# source://zeitwerk//lib/zeitwerk/inflector.rb#4
class Zeitwerk::Inflector
# Very basic snake case -> camel case conversion.
#
# inflector = Zeitwerk::Inflector.new
# inflector.camelize("post", ...) # => "Post"
# inflector.camelize("users_controller", ...) # => "UsersController"
# inflector.camelize("api", ...) # => "Api"
#
# Takes into account hard-coded mappings configured with `inflect`.
#
# source://zeitwerk//lib/zeitwerk/inflector.rb#15
def camelize(basename, _abspath); end
# Configures hard-coded inflections:
#
# inflector = Zeitwerk::Inflector.new
# inflector.inflect(
# "html_parser" => "HTMLParser",
# "mysql_adapter" => "MySQLAdapter"
# )
#
# inflector.camelize("html_parser", abspath) # => "HTMLParser"
# inflector.camelize("mysql_adapter", abspath) # => "MySQLAdapter"
# inflector.camelize("users_controller", abspath) # => "UsersController"
#
# source://zeitwerk//lib/zeitwerk/inflector.rb#32
def inflect(inflections); end
private
# Hard-coded basename to constant name user maps that override the default
# inflection logic.
#
# source://zeitwerk//lib/zeitwerk/inflector.rb#42
def overrides; end
end
# This is a private module.
#
# source://zeitwerk//lib/zeitwerk/internal.rb#4
module Zeitwerk::Internal
# source://zeitwerk//lib/zeitwerk/internal.rb#5
def internal(method_name); end
end
# source://zeitwerk//lib/zeitwerk/loader.rb#7
class Zeitwerk::Loader
include ::Zeitwerk::RealModName
include ::Zeitwerk::Loader::Callbacks
include ::Zeitwerk::Loader::Helpers
include ::Zeitwerk::Loader::Config
include ::Zeitwerk::Loader::EagerLoad
extend ::Zeitwerk::Internal
extend ::Zeitwerk::RealModName
# @return [Loader] a new instance of Loader
#
# source://zeitwerk//lib/zeitwerk/loader.rb#99
def initialize; end
# source://zeitwerk//lib/zeitwerk/loader.rb#43
def __autoloaded_dirs; end
# source://zeitwerk//lib/zeitwerk/loader.rb#33
def __autoloads; end
# source://zeitwerk//lib/zeitwerk/loader.rb#77
def __namespace_dirs; end
# source://zeitwerk//lib/zeitwerk/loader.rb#310
def __shadowed_file?(file); end
# source://zeitwerk//lib/zeitwerk/loader.rb#88
def __shadowed_files; end
# source://zeitwerk//lib/zeitwerk/loader.rb#59
def __to_unload; end
# @raise [Zeitwerk::Error]
#
# source://zeitwerk//lib/zeitwerk/loader.rb#234
def cpath_expected_at(path); end
# Unloads all loaded code, and calls setup again so that the loader is able
# to pick any changes in the file system.
#
# This method is not thread-safe, please see how this can be achieved by
# client code in the README of the project.
#
# @raise [Zeitwerk::Error]
#
# source://zeitwerk//lib/zeitwerk/loader.rb#223
def reload; end
# Sets autoloads in the root namespaces.
#
# source://zeitwerk//lib/zeitwerk/loader.rb#119
def setup; end
# Removes loaded constants and configured autoloads.
#
# The objects the constants stored are no longer reachable through them. In
# addition, since said objects are normally not referenced from anywhere
# else, they are eligible for garbage collection, which would effectively
# unload them.
#
# This method is public but undocumented. Main interface is `reload`, which
# means `unload` + `setup`. This one is available to be used together with
# `unregister`, which is undocumented too.
#
# source://zeitwerk//lib/zeitwerk/loader.rb#145
def unload; end
# Says if the given constant path would be unloaded on reload. This
# predicate returns `false` if reloading is disabled.
#
# @return [Boolean]
#
# source://zeitwerk//lib/zeitwerk/loader.rb#285
def unloadable_cpath?(cpath); end
# Returns an array with the constant paths that would be unloaded on reload.
# This predicate returns an empty array if reloading is disabled.
#
# source://zeitwerk//lib/zeitwerk/loader.rb#293
def unloadable_cpaths; end
# This is a dangerous method.
#
# source://zeitwerk//lib/zeitwerk/loader.rb#301
def unregister; end
private
# source://zeitwerk//lib/zeitwerk/loader.rb#456
def autoload_file(parent, cname, file); end
# @return [Boolean]
#
# source://zeitwerk//lib/zeitwerk/loader.rb#514
def autoload_path_set_by_me_for?(parent, cname); end
# source://zeitwerk//lib/zeitwerk/loader.rb#426
def autoload_subdir(parent, cname, subdir); end
# We keep track of autoloaded directories to remove them from the registry
# at the end of eager loading.
#
# Files are removed as they are autoloaded, but directories need to wait due
# to concurrency (see why in Zeitwerk::Loader::Callbacks#on_dir_autoloaded).
#
# source://zeitwerk//lib/zeitwerk/loader.rb#43
def autoloaded_dirs; end
# Maps absolute paths for which an autoload has been set ---and not
# executed--- to their corresponding parent class or module and constant
# name.
#
# "/Users/fxn/blog/app/models/user.rb" => [Object, :User],
# "/Users/fxn/blog/app/models/hotel/pricing.rb" => [Hotel, :Pricing]
# ...
#
# source://zeitwerk//lib/zeitwerk/loader.rb#33
def autoloads; end
# source://zeitwerk//lib/zeitwerk/loader.rb#493
def define_autoload(parent, cname, abspath); end
# source://zeitwerk//lib/zeitwerk/loader.rb#410
def define_autoloads_for_dir(dir, parent); end
# Returns the value of attribute dirs_autoload_monitor.
#
# source://zeitwerk//lib/zeitwerk/loader.rb#96
def dirs_autoload_monitor; end
# Returns the value of attribute mutex.
#
# source://zeitwerk//lib/zeitwerk/loader.rb#92
def mutex; end
# Maps namespace constant paths to their respective directories.
#
# For example, given this mapping:
#
# "Admin" => [
# "/Users/fxn/blog/app/controllers/admin",
# "/Users/fxn/blog/app/models/admin",
# ...
# ]
#
# when `Admin` gets defined we know that it plays the role of a namespace
# and that its children are spread over those directories. We'll visit them
# to set up the corresponding autoloads.
#
# source://zeitwerk//lib/zeitwerk/loader.rb#77
def namespace_dirs; end
# `dir` is the directory that would have autovivified a namespace. `file` is
# the file where we've found the namespace is explicitly defined.
#
# source://zeitwerk//lib/zeitwerk/loader.rb#482
def promote_namespace_from_implicit_to_explicit(dir:, file:, parent:, cname:); end
# source://zeitwerk//lib/zeitwerk/loader.rb#528
def raise_if_conflicting_directory(dir); end
# source://zeitwerk//lib/zeitwerk/loader.rb#523
def register_explicit_namespace(cpath); end
# source://zeitwerk//lib/zeitwerk/loader.rb#552
def run_on_unload_callbacks(cpath, value, abspath); end
# source://zeitwerk//lib/zeitwerk/loader.rb#310
def shadowed_file?(file); end
# A shadowed file is a file managed by this loader that is ignored when
# setting autoloads because its matching constant is already taken.
#
# This private set is populated as we descend. For example, if the loader
# has only scanned the top-level, `shadowed_files` does not have shadowed
# files that may exist deep in the project tree yet.
#
# source://zeitwerk//lib/zeitwerk/loader.rb#88
def shadowed_files; end
# Stores metadata needed for unloading. Its entries look like this:
#
# "Admin::Role" => [".../admin/role.rb", [Admin, :Role]]
#
# The cpath as key helps implementing unloadable_cpath? The file name is
# stored in order to be able to delete it from $LOADED_FEATURES, and the
# pair [Module, Symbol] is used to remove_const the constant from the class
# or module object.
#
# If reloading is enabled, this hash is filled as constants are autoloaded
# or eager loaded. Otherwise, the collection remains empty.
#
# source://zeitwerk//lib/zeitwerk/loader.rb#59
def to_unload; end
# source://zeitwerk//lib/zeitwerk/loader.rb#559
def unload_autoload(parent, cname); end
# source://zeitwerk//lib/zeitwerk/loader.rb#565
def unload_cref(parent, cname); end
class << self
# Returns an array with the absolute paths of the root directories of all
# registered loaders. This is a read-only collection.
#
# source://zeitwerk//lib/zeitwerk/loader.rb#404
def all_dirs; end
# Returns the value of attribute default_logger.
#
# source://zeitwerk//lib/zeitwerk/loader.rb#320
def default_logger; end
# Sets the attribute default_logger
#
# @param value the value to set the attribute default_logger to.
#
# source://zeitwerk//lib/zeitwerk/loader.rb#320
def default_logger=(_arg0); end
# Broadcasts `eager_load` to all loaders. Those that have not been setup
# are skipped.
#
# source://zeitwerk//lib/zeitwerk/loader.rb#376
def eager_load_all; end
# Broadcasts `eager_load_namespace` to all loaders. Those that have not
# been setup are skipped.
#
# source://zeitwerk//lib/zeitwerk/loader.rb#390
def eager_load_namespace(mod); end
# This is a shortcut for
#
# require "zeitwerk"
#
# loader = Zeitwerk::Loader.new
# loader.tag = File.basename(__FILE__, ".rb")
# loader.inflector = Zeitwerk::GemInflector.new(__FILE__)
# loader.push_dir(__dir__)
#
# except that this method returns the same object in subsequent calls from
# the same file, in the unlikely case the gem wants to be able to reload.
#
# This method returns a subclass of Zeitwerk::Loader, but the exact type
# is private, client code can only rely on the interface.
#
# source://zeitwerk//lib/zeitwerk/loader.rb#338
def for_gem(warn_on_extra_files: T.unsafe(nil)); end
# This is a shortcut for
#
# require "zeitwerk"
#
# loader = Zeitwerk::Loader.new
# loader.tag = namespace.name + "-" + File.basename(__FILE__, ".rb")
# loader.inflector = Zeitwerk::GemInflector.new(__FILE__)
# loader.push_dir(__dir__, namespace: namespace)
#
# except that this method returns the same object in subsequent calls from
# the same file, in the unlikely case the gem wants to be able to reload.
#
# This method returns a subclass of Zeitwerk::Loader, but the exact type
# is private, client code can only rely on the interface.
#
# source://zeitwerk//lib/zeitwerk/loader.rb#359
def for_gem_extension(namespace); end
end
end
# source://zeitwerk//lib/zeitwerk/loader/callbacks.rb#3
module Zeitwerk::Loader::Callbacks
include ::Zeitwerk::RealModName
extend ::Zeitwerk::Internal
# source://zeitwerk//lib/zeitwerk/loader/callbacks.rb#41
def __on_dir_autoloaded(dir); end
# source://zeitwerk//lib/zeitwerk/loader/callbacks.rb#10
def __on_file_autoloaded(file); end
# Invoked when a class or module is created or reopened, either from the
# tracer or from module autovivification. If the namespace has matching
# subdirectories, we descend into them now.
#
# @private
#
# source://zeitwerk//lib/zeitwerk/loader/callbacks.rb#81
def on_namespace_loaded(namespace); end
private
# source://zeitwerk//lib/zeitwerk/loader/callbacks.rb#41
def on_dir_autoloaded(dir); end
# source://zeitwerk//lib/zeitwerk/loader/callbacks.rb#10
def on_file_autoloaded(file); end
# source://zeitwerk//lib/zeitwerk/loader/callbacks.rb#92
def run_on_load_callbacks(cpath, value, abspath); end
end
# source://zeitwerk//lib/zeitwerk/loader/config.rb#6
module Zeitwerk::Loader::Config
include ::Zeitwerk::RealModName
extend ::Zeitwerk::Internal
# source://zeitwerk//lib/zeitwerk/loader/config.rb#86
def initialize; end
# source://zeitwerk//lib/zeitwerk/loader/config.rb#296
def __ignores?(abspath); end
def __roots; end
# Configure directories or glob patterns to be collapsed.
#
# source://zeitwerk//lib/zeitwerk/loader/config.rb#216
def collapse(*glob_patterns); end
# If `namespaces` is falsey (default), returns an array with the absolute
# paths of the root directories as strings. If truthy, returns a hash table
# instead. Keys are the absolute paths of the root directories as strings,
# values are their corresponding namespaces, class or module objects.
#
# If `ignored` is falsey (default), ignored root directories are filtered out.
#
# These are read-only collections, please add to them with `push_dir`.
#
# source://zeitwerk//lib/zeitwerk/loader/config.rb#156
def dirs(namespaces: T.unsafe(nil), ignored: T.unsafe(nil)); end
# Let eager load ignore the given files or directories. The constants defined
# in those files are still autoloadable.
#
# source://zeitwerk//lib/zeitwerk/loader/config.rb#198
def do_not_eager_load(*paths); end
# You need to call this method before setup in order to be able to reload.
# There is no way to undo this, either you want to reload or you don't.
#
# @raise [Zeitwerk::Error]
#
# source://zeitwerk//lib/zeitwerk/loader/config.rb#177
def enable_reloading; end
# Configure files, directories, or glob patterns to be totally ignored.
#
# source://zeitwerk//lib/zeitwerk/loader/config.rb#205
def ignore(*glob_patterns); end
# Returns the value of attribute inflector.
#
# source://zeitwerk//lib/zeitwerk/loader/config.rb#11
def inflector; end
# Sets the attribute inflector
#
# @param value the value to set the attribute inflector to.
#
# source://zeitwerk//lib/zeitwerk/loader/config.rb#11
def inflector=(_arg0); end
# Logs to `$stdout`, handy shortcut for debugging.
#
# source://zeitwerk//lib/zeitwerk/loader/config.rb#288
def log!; end
# Returns the value of attribute logger.
#
# source://zeitwerk//lib/zeitwerk/loader/config.rb#14
def logger; end
# Sets the attribute logger
#
# @param value the value to set the attribute logger to.
#
# source://zeitwerk//lib/zeitwerk/loader/config.rb#14
def logger=(_arg0); end
# Configure a block to be invoked once a certain constant path is loaded.
# Supports multiple callbacks, and if there are many, they are executed in
# the order in which they were defined.
#
# loader.on_load("SomeApiClient") do |klass, _abspath|
# klass.endpoint = "https://api.dev"
# end
#
# Can also be configured for any constant loaded:
#
# loader.on_load do |cpath, value, abspath|
# # ...
# end
#
# @raise [TypeError]
#
# source://zeitwerk//lib/zeitwerk/loader/config.rb#252
def on_load(cpath = T.unsafe(nil), &block); end
# Configure a block to be called after setup and on each reload.
# If setup was already done, the block runs immediately.
#
# source://zeitwerk//lib/zeitwerk/loader/config.rb#228
def on_setup(&block); end
# Configure a block to be invoked right before a certain constant is removed.
# Supports multiple callbacks, and if there are many, they are executed in the
# order in which they were defined.
#
# loader.on_unload("Country") do |klass, _abspath|
# klass.clear_cache
# end
#
# Can also be configured for any removed constant:
#
# loader.on_unload do |cpath, value, abspath|
# # ...
# end
#
# @raise [TypeError]
#
# source://zeitwerk//lib/zeitwerk/loader/config.rb#277
def on_unload(cpath = T.unsafe(nil), &block); end
# Pushes `path` to the list of root directories.
#
# Raises `Zeitwerk::Error` if `path` does not exist, or if another loader in
# the same process already manages that directory or one of its ascendants or
# descendants.
#
# @raise [Zeitwerk::Error]
#
# source://zeitwerk//lib/zeitwerk/loader/config.rb#111
def push_dir(path, namespace: T.unsafe(nil)); end
# @return [Boolean]
#
# source://zeitwerk//lib/zeitwerk/loader/config.rb#190
def reloading_enabled?; end
# Returns the loader's tag.
#
# Implemented as a method instead of via attr_reader for symmetry with the
# writer below.
#
# source://zeitwerk//lib/zeitwerk/loader/config.rb#135
def tag; end
# Sets a tag for the loader, useful for logging.
#
# source://zeitwerk//lib/zeitwerk/loader/config.rb#142
def tag=(tag); end
private
# source://zeitwerk//lib/zeitwerk/loader/config.rb#314
def actual_roots; end
# @return [Boolean]
#
# source://zeitwerk//lib/zeitwerk/loader/config.rb#339
def collapse?(dir); end
# The actual collection of absolute directory names at the time the collapse
# glob patterns were expanded. Computed on setup, and recomputed on reload.
#
# source://zeitwerk//lib/zeitwerk/loader/config.rb#57
def collapse_dirs; end
# Absolute paths of directories or glob patterns to be collapsed.
#
# source://zeitwerk//lib/zeitwerk/loader/config.rb#50
def collapse_glob_patterns; end
# Absolute paths of files or directories not to be eager loaded.
#
# source://zeitwerk//lib/zeitwerk/loader/config.rb#63
def eager_load_exclusions; end
# @return [Boolean]
#
# source://zeitwerk//lib/zeitwerk/loader/config.rb#326
def excluded_from_eager_load?(abspath); end
# source://zeitwerk//lib/zeitwerk/loader/config.rb#349
def expand_glob_patterns(glob_patterns); end
# source://zeitwerk//lib/zeitwerk/loader/config.rb#344
def expand_paths(paths); end
# Absolute paths of files, directories, or glob patterns to be totally
# ignored.
#
# source://zeitwerk//lib/zeitwerk/loader/config.rb#36
def ignored_glob_patterns; end
# @return [Boolean]
#
# source://zeitwerk//lib/zeitwerk/loader/config.rb#309
def ignored_path?(abspath); end
# The actual collection of absolute file and directory names at the time the
# ignored glob patterns were expanded. Computed on setup, and recomputed on
# reload.
#
# source://zeitwerk//lib/zeitwerk/loader/config.rb#44
def ignored_paths; end
# source://zeitwerk//lib/zeitwerk/loader/config.rb#296
def ignores?(abspath); end
# User-oriented callbacks to be fired when a constant is loaded.
#
# source://zeitwerk//lib/zeitwerk/loader/config.rb#76
def on_load_callbacks; end
# User-oriented callbacks to be fired on setup and on reload.
#
# source://zeitwerk//lib/zeitwerk/loader/config.rb#69
def on_setup_callbacks; end
# User-oriented callbacks to be fired before constants are removed.
#
# source://zeitwerk//lib/zeitwerk/loader/config.rb#83
def on_unload_callbacks; end
# source://zeitwerk//lib/zeitwerk/loader/config.rb#361
def recompute_collapse_dirs; end
# source://zeitwerk//lib/zeitwerk/loader/config.rb#356
def recompute_ignored_paths; end
# @return [Boolean]
#
# source://zeitwerk//lib/zeitwerk/loader/config.rb#321
def root_dir?(dir); end
# Absolute paths of the root directories, mapped to their respective root namespaces:
#
# "/Users/fxn/blog/app/channels" => Object,
# "/Users/fxn/blog/app/adapters" => ActiveJob::QueueAdapters,
# ...
#
# Stored in a hash to preserve order, easily handle duplicates, and have a
# fast lookup by directory.
#
# This is a private collection maintained by the loader. The public
# interface for it is `push_dir` and `dirs`.
#
# source://zeitwerk//lib/zeitwerk/loader/config.rb#29
def roots; end
end
# source://zeitwerk//lib/zeitwerk/loader/eager_load.rb#1
module Zeitwerk::Loader::EagerLoad
# Eager loads all files in the root directories, recursively. Files do not
# need to be in `$LOAD_PATH`, absolute file names are used. Ignored and
# shadowed files are not eager loaded. You can opt-out specifically in
# specific files and directories with `do_not_eager_load`, and that can be
# overridden passing `force: true`.
#
# source://zeitwerk//lib/zeitwerk/loader/eager_load.rb#9
def eager_load(force: T.unsafe(nil)); end
# @raise [Zeitwerk::SetupRequired]
#
# source://zeitwerk//lib/zeitwerk/loader/eager_load.rb#32
def eager_load_dir(path); end
# @raise [Zeitwerk::SetupRequired]
#
# source://zeitwerk//lib/zeitwerk/loader/eager_load.rb#74
def eager_load_namespace(mod); end
# Loads the given Ruby file.
#
# Raises if the argument is ignored, shadowed, or not managed by the receiver.
#
# The method is implemented as `constantize` for files, in a sense, to be able
# to descend orderly and make sure the file is loadable.
#
# @raise [Zeitwerk::Error]
#
# source://zeitwerk//lib/zeitwerk/loader/eager_load.rb#116
def load_file(path); end
private
# The caller is responsible for making sure `namespace` is the namespace that
# corresponds to `dir`.
#
# source://zeitwerk//lib/zeitwerk/loader/eager_load.rb#160
def actual_eager_load_dir(dir, namespace, force: T.unsafe(nil)); end
# In order to invoke this method, the caller has to ensure `child` is a
# strict namespace descendant of `root_namespace`.
#
# source://zeitwerk//lib/zeitwerk/loader/eager_load.rb#195
def eager_load_child_namespace(child, child_name, root_dir, root_namespace); end
end
# source://zeitwerk//lib/zeitwerk/loader/helpers.rb#3
module Zeitwerk::Loader::Helpers
private
# @return [Boolean]
#
# source://zeitwerk//lib/zeitwerk/loader/helpers.rb#128
def cdef?(parent, cname); end
# @raise [NameError]
#
# source://zeitwerk//lib/zeitwerk/loader/helpers.rb#134
def cget(parent, cname); end
# @raise [Zeitwerk::NameError]
#
# source://zeitwerk//lib/zeitwerk/loader/helpers.rb#149
def cname_for(basename, abspath); end
# Symbol#name was introduced in Ruby 3.0. It returns always the same
# frozen object, so we may save a few string allocations.
#
# source://zeitwerk//lib/zeitwerk/loader/helpers.rb#118
def cpath(parent, cname); end
# @raise [NameError]
#
# source://zeitwerk//lib/zeitwerk/loader/helpers.rb#140
def crem(parent, cname); end
# @return [Boolean]
#
# source://zeitwerk//lib/zeitwerk/loader/helpers.rb#67
def dir?(path); end
# @return [Boolean]
#
# source://zeitwerk//lib/zeitwerk/loader/helpers.rb#45
def has_at_least_one_ruby_file?(dir); end
# @return [Boolean]
#
# source://zeitwerk//lib/zeitwerk/loader/helpers.rb#72
def hidden?(basename); end
# source://zeitwerk//lib/zeitwerk/loader/helpers.rb#7
def log(message); end
# source://zeitwerk//lib/zeitwerk/loader/helpers.rb#15
def ls(dir); end
# @return [Boolean]
#
# source://zeitwerk//lib/zeitwerk/loader/helpers.rb#62
def ruby?(path); end
# source://zeitwerk//lib/zeitwerk/loader/helpers.rb#109
def strict_autoload_path(parent, cname); end
# source://zeitwerk//lib/zeitwerk/loader/helpers.rb#77
def walk_up(abspath); end
end
# source://zeitwerk//lib/zeitwerk/loader/helpers.rb#144
module Zeitwerk::Loader::Helpers::CNAME_VALIDATOR; end
# source://zeitwerk//lib/zeitwerk/loader.rb#21
Zeitwerk::Loader::MUTEX = T.let(T.unsafe(nil), Thread::Mutex)
# source://zeitwerk//lib/zeitwerk/error.rb#13
class Zeitwerk::NameError < ::NameError; end
# source://zeitwerk//lib/zeitwerk/real_mod_name.rb#3
module Zeitwerk::RealModName
# source://zeitwerk//lib/zeitwerk/real_mod_name.rb#14
def real_mod_name(mod); end
end
# source://zeitwerk//lib/zeitwerk/real_mod_name.rb#4
Zeitwerk::RealModName::UNBOUND_METHOD_MODULE_NAME = T.let(T.unsafe(nil), UnboundMethod)
# source://zeitwerk//lib/zeitwerk/registry.rb#4
module Zeitwerk::Registry
class << self
# Maps absolute paths to the loaders responsible for them.
#
# This information is used by our decorated `Kernel#require` to be able to
# invoke callbacks and autovivify modules.
#
# @private
#
# source://zeitwerk//lib/zeitwerk/registry.rb#26
def autoloads; end
# Registers gem loaders to let `for_gem` be idempotent in case of reload.
#
# @private
#
# source://zeitwerk//lib/zeitwerk/registry.rb#17
def gem_loaders_by_root_file; end
# @private
# @return [Boolean]
#
# source://zeitwerk//lib/zeitwerk/registry.rb#113
def inception?(cpath); end
# This hash table addresses an edge case in which an autoload is ignored.
#
# For example, let's suppose we want to autoload in a gem like this:
#
# # lib/my_gem.rb
# loader = Zeitwerk::Loader.new
# loader.push_dir(__dir__)
# loader.setup
#
# module MyGem
# end
#
# if you require "my_gem", as Bundler would do, this happens while setting
# up autoloads:
#
# 1. Object.autoload?(:MyGem) returns `nil` because the autoload for
# the constant is issued by Zeitwerk while the same file is being
# required.
# 2. The constant `MyGem` is undefined while setup runs.
#
# Therefore, a directory `lib/my_gem` would autovivify a module according to
# the existing information. But that would be wrong.
#
# To overcome this fundamental limitation, we keep track of the constant
# paths that are in this situation ---in the example above, "MyGem"--- and
# take this collection into account for the autovivification logic.
#
# Note that you cannot generally address this by moving the setup code
# below the constant definition, because we want libraries to be able to
# use managed constants in the module body:
#
# module MyGem
# include MyConcern
# end
#
# @private
#
# source://zeitwerk//lib/zeitwerk/registry.rb#65
def inceptions; end
# @private
#
# source://zeitwerk//lib/zeitwerk/registry.rb#121
def loader_for(path); end
# This method returns always a loader, the same instance for the same root
# file. That is how Zeitwerk::Loader.for_gem is idempotent.
#
# @private
#
# source://zeitwerk//lib/zeitwerk/registry.rb#89
def loader_for_gem(root_file, namespace:, warn_on_extra_files:); end
# Keeps track of all loaders. Useful to broadcast messages and to prevent
# them from being garbage collected.
#
# @private
#
# source://zeitwerk//lib/zeitwerk/registry.rb#11
def loaders; end
# @private
#
# source://zeitwerk//lib/zeitwerk/registry.rb#127
def on_unload(loader); end
# @private
#
# source://zeitwerk//lib/zeitwerk/registry.rb#95
def register_autoload(loader, abspath); end
# @private
#
# source://zeitwerk//lib/zeitwerk/registry.rb#107
def register_inception(cpath, abspath, loader); end
# Registers a loader.
#
# @private
#
# source://zeitwerk//lib/zeitwerk/registry.rb#71
def register_loader(loader); end
# @private
#
# source://zeitwerk//lib/zeitwerk/registry.rb#101
def unregister_autoload(abspath); end
# @private
#
# source://zeitwerk//lib/zeitwerk/registry.rb#77
def unregister_loader(loader); end
end
end
# source://zeitwerk//lib/zeitwerk/error.rb#7
class Zeitwerk::ReloadingDisabledError < ::Zeitwerk::Error
# @return [ReloadingDisabledError] a new instance of ReloadingDisabledError
#
# source://zeitwerk//lib/zeitwerk/error.rb#8
def initialize; end
end
# source://zeitwerk//lib/zeitwerk/error.rb#16
class Zeitwerk::SetupRequired < ::Zeitwerk::Error
# @return [SetupRequired] a new instance of SetupRequired
#
# source://zeitwerk//lib/zeitwerk/error.rb#17
def initialize; end
end
# source://zeitwerk//lib/zeitwerk/version.rb#4
Zeitwerk::VERSION = T.let(T.unsafe(nil), String)

View File

@ -11,10 +11,6 @@ class AbstractDownloadStrategy
include ::FileUtils::StreamUtils_
end
class ActiveSupport::Deprecation
def self.initialize(*arg, **arg1, &arg2); end
end
class Addrinfo
def connect_internal(local_addrinfo, timeout=T.unsafe(nil)); end
end
@ -27,8 +23,6 @@ class Array
def shelljoin(); end
def to_default_s(); end
def to_h(); end
end
@ -79,10 +73,6 @@ class Benchmark::Tms
def to_h(); end
end
module Benchmark
def self.ms(&block); end
end
class BigDecimal
def clone(); end
@ -93,8 +83,6 @@ class BigDecimal
def precision_scale(); end
def scale(); end
def to_digits(); end
VERSION = ::T.let(nil, ::T.untyped)
end
@ -1944,6 +1932,8 @@ class Bundler::Thor::CoreExt::HashWithIndifferentAccess
def reverse_merge(other); end
def reverse_merge!(other_hash); end
def values_at(*indices); end
end
@ -3473,18 +3463,6 @@ class Class
def json_creatable?(); end
end
class Complex
def to_d(*args); end
end
class Concurrent::SerializedExecutionDelegator
RUBYGEMS_ACTIVATION_MONITOR = ::T.let(nil, ::T.untyped)
end
class Concurrent::SynchronizedDelegator
RUBYGEMS_ACTIVATION_MONITOR = ::T.let(nil, ::T.untyped)
end
module CopHelper
def _investigate(cop, processed_source); end
@ -3507,17 +3485,7 @@ module CopHelper
end
class Date
def compare_without_coercion(arg); end
def default_inspect(); end
def infinite?(); end
def minus_without_duration(arg); end
def plus_without_duration(arg); end
def to_default_s(); end
VERSION = ::T.let(nil, ::T.untyped)
end
@ -4131,6 +4099,8 @@ class Etc::Passwd
end
class Exception
def as_json(*arg); end
def to_json(*args); end
end
@ -4193,6 +4163,7 @@ module Fiddle
TYPE_INT32_T = ::T.let(nil, ::T.untyped)
TYPE_INT64_T = ::T.let(nil, ::T.untyped)
TYPE_INT8_T = ::T.let(nil, ::T.untyped)
TYPE_VARIADIC = ::T.let(nil, ::T.untyped)
VERSION = ::T.let(nil, ::T.untyped)
WINDOWS = ::T.let(nil, ::T.untyped)
end
@ -5444,8 +5415,123 @@ class IO
def winsize(); end
def winsize=(winsize); end
PRIORITY = ::T.let(nil, ::T.untyped)
READABLE = ::T.let(nil, ::T.untyped)
WRITABLE = ::T.let(nil, ::T.untyped)
end
class IO::Buffer
include ::Comparable
def clear(*arg); end
def copy(*arg); end
def empty?(); end
def external?(); end
def free(); end
def get_string(*arg); end
def get_value(arg, arg1); end
def hexdump(); end
def initialize(*arg); end
def internal?(); end
def locked(); end
def locked?(); end
def mapped?(); end
def null?(); end
def pread(arg, arg1, arg2); end
def pwrite(arg, arg1, arg2); end
def read(arg, arg1); end
def readonly?(); end
def resize(arg); end
def set_string(*arg); end
def set_value(arg, arg1, arg2); end
def size(); end
def slice(arg, arg1); end
def transfer(); end
def valid?(); end
def write(arg, arg1); end
BIG_ENDIAN = ::T.let(nil, ::T.untyped)
DEFAULT_SIZE = ::T.let(nil, ::T.untyped)
EXTERNAL = ::T.let(nil, ::T.untyped)
HOST_ENDIAN = ::T.let(nil, ::T.untyped)
INTERNAL = ::T.let(nil, ::T.untyped)
LITTLE_ENDIAN = ::T.let(nil, ::T.untyped)
LOCKED = ::T.let(nil, ::T.untyped)
MAPPED = ::T.let(nil, ::T.untyped)
NETWORK_ENDIAN = ::T.let(nil, ::T.untyped)
PAGE_SIZE = ::T.let(nil, ::T.untyped)
PRIVATE = ::T.let(nil, ::T.untyped)
READONLY = ::T.let(nil, ::T.untyped)
end
class IO::Buffer::AccessError
end
class IO::Buffer::AccessError
end
class IO::Buffer::AllocationError
end
class IO::Buffer::AllocationError
end
class IO::Buffer::InvalidatedError
end
class IO::Buffer::InvalidatedError
end
class IO::Buffer::LockedError
end
class IO::Buffer::LockedError
end
class IO::Buffer
def self.for(arg); end
def self.map(*arg); end
end
class IO::ConsoleMode
def echo=(echo); end
def raw(*arg); end
def raw!(*arg); end
end
class IO::ConsoleMode
end
IO::EWOULDBLOCKWaitReadable = IO::EAGAINWaitReadable
IO::EWOULDBLOCKWaitWritable = IO::EAGAINWaitWritable
class IO
def self.console(*arg); end
@ -5841,8 +5927,6 @@ end
module Kernel
extend ::Forwardable
def self.at_exit(); end
def self.load(*arg); end
end
class KeyError
@ -5887,6 +5971,10 @@ class LinuxRunnerSpec
def self.inherited(s); end
end
class LoadError
include ::DidYouMean::Correctable
end
class Logger
def debug!(); end
@ -6015,208 +6103,10 @@ class Method
def public?(); end
end
module Minitest::Assertions
def assert_mock(mock); end
end
class Minitest::Expectation
def ctx(); end
def ctx=(_); end
def target(); end
def target=(_); end
end
class Minitest::Expectation
def self.[](*arg); end
def self.keyword_init?(); end
def self.members(); end
end
module Minitest::Expectations
def must_be(*args, **arg); end
def must_be_close_to(*args, **arg); end
def must_be_empty(*args, **arg); end
def must_be_instance_of(*args, **arg); end
def must_be_kind_of(*args, **arg); end
def must_be_nil(*args, **arg); end
def must_be_same_as(*args, **arg); end
def must_be_silent(*args, **arg); end
def must_be_within_delta(*args, **arg); end
def must_be_within_epsilon(*args, **arg); end
def must_equal(*args, **arg); end
def must_include(*args, **arg); end
def must_match(*args, **arg); end
def must_output(*args, **arg); end
def must_pattern_match(*args, **arg); end
def must_raise(*args, **arg); end
def must_respond_to(*args, **arg); end
def must_throw(*args, **arg); end
def path_must_exist(*args, **arg); end
def path_wont_exist(*args, **arg); end
def wont_be(*args, **arg); end
def wont_be_close_to(*args, **arg); end
def wont_be_empty(*args, **arg); end
def wont_be_instance_of(*args, **arg); end
def wont_be_kind_of(*args, **arg); end
def wont_be_nil(*args, **arg); end
def wont_be_same_as(*args, **arg); end
def wont_be_within_delta(*args, **arg); end
def wont_be_within_epsilon(*args, **arg); end
def wont_equal(*args, **arg); end
def wont_include(*args, **arg); end
def wont_match(*args, **arg); end
def wont_pattern_match(*args, **arg); end
def wont_respond_to(*args, **arg); end
end
module Minitest::Expectations
end
class Minitest::Mock
def ===(*args, **kwargs, &b); end
def __call(name, data); end
def __respond_to?(*arg); end
def class(*args, **kwargs, &b); end
def expect(name, retval, args=T.unsafe(nil), **kwargs, &blk); end
def initialize(delegator=T.unsafe(nil)); end
def inspect(*args, **kwargs, &b); end
def instance_eval(*args, **kwargs, &b); end
def instance_variables(*args, **kwargs, &b); end
def method_missing(sym, *args, **kwargs, &block); end
def object_id(*args, **kwargs, &b); end
def public_send(*args, **kwargs, &b); end
def respond_to?(sym, include_private=T.unsafe(nil)); end
def send(*args, **kwargs, &b); end
def to_s(*args, **kwargs, &b); end
def verify(); end
end
class Minitest::Mock
end
class Minitest::Spec
include ::Minitest::Spec::DSL::InstanceMethods
TYPES = ::T.let(nil, ::T.untyped)
end
module Minitest::Spec::DSL
def after(_type=T.unsafe(nil), &block); end
def before(_type=T.unsafe(nil), &block); end
def children(); end
def create(name, desc); end
def desc(); end
def describe_stack(); end
def it(desc=T.unsafe(nil), &block); end
def let(name, &block); end
def name(); end
def nuke_test_methods!(); end
def register_spec_type(*args, &block); end
def spec_type(desc, *additional); end
def specify(desc=T.unsafe(nil), &block); end
def subject(&block); end
def to_s(); end
TYPES = ::T.let(nil, ::T.untyped)
end
module Minitest::Spec::DSL::InstanceMethods
def _(value=T.unsafe(nil), &block); end
def before_setup(); end
def expect(value=T.unsafe(nil), &block); end
def value(value=T.unsafe(nil), &block); end
end
module Minitest::Spec::DSL::InstanceMethods
end
module Minitest::Spec::DSL
def self.extended(obj); end
end
class Minitest::Spec
extend ::Minitest::Spec::DSL
def self.current(); end
end
class Mktemp
include ::FileUtils::StreamUtils_
end
class MockExpectationError
end
class MockExpectationError
end
class Module
def context(*a, &b); end
@ -6228,8 +6118,6 @@ class Module
def fdescribe(*a, &b); end
def infect_an_assertion(meth, new_name, dont_flip=T.unsafe(nil)); end
def shared_context(name, *args, &block); end
def shared_examples(name, *args, &block); end
@ -6279,8 +6167,9 @@ class MonitorMixin::ConditionVariable
def initialize(monitor); end
end
module Mutex_m
VERSION = ::T.let(nil, ::T.untyped)
class NameError
include ::ErrorHighlight::CoreExt
include ::DidYouMean::Correctable
end
class Net::BufferedIO
@ -6324,8 +6213,6 @@ class Net::HTTP
VERSION = ::T.let(nil, ::T.untyped)
end
Net::HTTP::ProxyMod = Net::HTTP::ProxyDelta
class Net::HTTPAlreadyReported
HAS_BODY = ::T.let(nil, ::T.untyped)
end
@ -6346,13 +6233,9 @@ end
Net::HTTPFatalErrorCode = Net::HTTPClientError
class Net::HTTPInformation
end
Net::HTTPInformation::EXCEPTION_TYPE = Net::HTTPError
Net::HTTPInformationCode::EXCEPTION_TYPE = Net::HTTPError
class Net::HTTPInformation
end
Net::HTTPInformationCode = Net::HTTPInformation
class Net::HTTPLoopDetected
HAS_BODY = ::T.let(nil, ::T.untyped)
@ -6400,8 +6283,6 @@ end
class Net::HTTPRangeNotSatisfiable
end
Net::HTTPRedirection::EXCEPTION_TYPE = Net::HTTPRetriableError
Net::HTTPRedirectionCode = Net::HTTPRedirection
Net::HTTPRequestURITooLarge = Net::HTTPURITooLong
@ -6432,9 +6313,13 @@ Net::HTTPServerErrorCode = Net::HTTPServerError
Net::HTTPSession = Net::HTTP
Net::HTTPSuccess::EXCEPTION_TYPE = Net::HTTPError
class Net::HTTPSuccess
end
Net::HTTPSuccessCode = Net::HTTPSuccess
Net::HTTPSuccessCode::EXCEPTION_TYPE = Net::HTTPError
class Net::HTTPSuccess
end
class Net::HTTPURITooLong
HAS_BODY = ::T.let(nil, ::T.untyped)
@ -6476,7 +6361,6 @@ end
class NilClass
include ::JSON::Ext::Generator::GeneratorMethods::NilClass
def to_d(); end
end
class NoMatchingPatternKeyError
@ -6525,14 +6409,11 @@ end
class Object
include ::JSON::Ext::Generator::GeneratorMethods::Object
include ::Minitest::Expectations
include ::SystemCommand::Mixin
def __send(*arg); end
def __send!(*arg); end
def stub(name, val_or_callable, *block_args, **block_kwargs, &block); end
def to_yaml(options=T.unsafe(nil)); end
ARGF = ::T.let(nil, ::T.untyped)
ARGV = ::T.let(nil, ::T.untyped)
@ -6686,7 +6567,6 @@ class OpenSSL::BN
end
module OpenSSL::Buffering
include ::ActiveSupport::ToJsonWithActiveSupportEncoder
def getbyte(); end
end
@ -8021,7 +7901,9 @@ module RSpec::Core::HashImitatable
def compact_blank(*args, &block); end
def compact_blank!(*args, &block); end
def deep_merge(*args, &block); end
def deep_merge!(*args, &block); end
def deep_stringify_keys(*args, &block); end
@ -8041,39 +7923,9 @@ module RSpec::Core::HashImitatable
def exclude?(*args, &block); end
def excluding(*args, &block); end
def extractable_options?(*args, &block); end
def including(*args, &block); end
def index_by(*args, &block); end
def index_with(*args, &block); end
def many?(*args, &block); end
def pick(*args, &block); end
def pluck(*args, &block); end
def save_plist(*args, &block); end
def stringify_keys(*args, &block); end
def stringify_keys!(*args, &block); end
def symbolize_keys(*args, &block); end
def symbolize_keys!(*args, &block); end
def to_options(*args, &block); end
def to_options!(*args, &block); end
def to_plist(*args, &block); end
def without(*args, &block); end
end
module RSpec::Core::MockingAdapters
@ -8100,8 +7952,6 @@ module RSpec::Core::MockingAdapters
end
class RSpec::Core::OutputWrapper
def as_json(*args, &block); end
def readline_nonblock(*args, &block); end
end
@ -8219,6 +8069,12 @@ module Reline
VERSION = ::T.let(nil, ::T.untyped)
end
class Reline::ANSI
CAPNAME_KEY_BINDINGS = ::T.let(nil, ::T.untyped)
END_BRACKETED_PASTE = ::T.let(nil, ::T.untyped)
START_BRACKETED_PASTE = ::T.let(nil, ::T.untyped)
end
class Reline::Config
KEYSEQ_PATTERN = ::T.let(nil, ::T.untyped)
VARIABLE_NAMES = ::T.let(nil, ::T.untyped)
@ -8229,7 +8085,7 @@ class Reline::Core
ATTR_READER_NAMES = ::T.let(nil, ::T.untyped)
end
Reline::IOGate = Reline::GeneralIO
Reline::IOGate = Reline::ANSI
Reline::Key = Struct::Key
@ -8990,47 +8846,21 @@ end
module RuboCop::AST::CollectionNode
def compact_blank(*args, **arg, &block); end
def compact_blank!(*args, **arg, &block); end
def exclude?(*args, **arg, &block); end
def excluding(*args, **arg, &block); end
def extract_options!(*args, **arg, &block); end
def fifth(*args, **arg, &block); end
def fourth(*args, **arg, &block); end
def including(*args, **arg, &block); end
def index_by(*args, **arg, &block); end
def index_with(*args, **arg, &block); end
def many?(*args, **arg, &block); end
def pick(*args, **arg, &block); end
def pluck(*args, **arg, &block); end
def save_plist(*args, **arg, &block); end
def second(*args, **arg, &block); end
def third(*args, **arg, &block); end
def to_default_s(*args, **arg, &block); end
def to_formatted_s(*args, **arg, &block); end
def to_plist(*args, **arg, &block); end
def to_sentence(*args, **arg, &block); end
def to_xml(*args, **arg, &block); end
def without(*args, **arg, &block); end
end
class RuboCop::AST::Node
@ -9058,16 +8888,12 @@ module RuboCop::AST::NodePattern::Sets
SET_BASH_COMPLETION_ZSH_COMPLETION_FISH_COMPLETION = ::T.let(nil, ::T.untyped)
SET_BUILD_RECOMMENDED_TEST_OPTIONAL = ::T.let(nil, ::T.untyped)
SET_DEPENDS_ON_USES_FROM_MACOS = ::T.let(nil, ::T.untyped)
SET_HTML_HTML5 = ::T.let(nil, ::T.untyped)
SET_INCLUDE_WITH_WITHOUT = ::T.let(nil, ::T.untyped)
SET_MAC_LINUX = ::T.let(nil, ::T.untyped)
SET_MATCH_MATCH_ = ::T.let(nil, ::T.untyped)
SET_ON_ARM_ON_INTEL_ON_SONOMA_ETC = ::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_SEND___SEND__ = ::T.let(nil, ::T.untyped)
SET_SYSTEM_SHELL_OUTPUT_PIPE_OUTPUT = ::T.let(nil, ::T.untyped)
SET_TEXT_EXACT_TEXT = ::T.let(nil, ::T.untyped)
SET_WITH_WITHOUT = ::T.let(nil, ::T.untyped)
SET____ETC_5 = ::T.let(nil, ::T.untyped)
end
@ -9355,10 +9181,38 @@ module RuboCop::Cop::HelperFunctions
extend ::T::Private::Methods::SingletonMethodHooks
end
class RuboCop::Cop::Homebrew::Blank
def nil_or_empty?(param0=T.unsafe(nil)); end
end
class RuboCop::Cop::Homebrew::CompactBlank
def reject_with_block?(param0=T.unsafe(nil)); end
def reject_with_block_pass?(param0=T.unsafe(nil)); end
end
class RuboCop::Cop::Homebrew::MoveToExtendOS
def os_check?(param0=T.unsafe(nil)); end
end
class RuboCop::Cop::Homebrew::NegateInclude
def negate_include_call?(param0=T.unsafe(nil)); end
end
class RuboCop::Cop::Homebrew::Presence
def redundant_negative_receiver_and_other(param0=T.unsafe(nil)); end
def redundant_receiver_and_other(param0=T.unsafe(nil)); end
end
class RuboCop::Cop::Homebrew::Present
def exists_and_not_empty?(param0=T.unsafe(nil)); end
end
class RuboCop::Cop::Homebrew::SafeNavigationWithBlank
def safe_navigation_blank_in_conditional?(param0=T.unsafe(nil)); end
end
module RuboCop::Cop::OnSystemConditionalsHelper
def hardware_cpu_search(param0, method:); end
@ -9506,21 +9360,6 @@ module RubyVM::MJIT
def self.resume(); end
end
module RubyVM::YJIT
end
module RubyVM::YJIT
def self.enabled?(); end
def self.reset_stats!(); end
def self.runtime_stats(); end
def self.simulate_oom!(); end
def self.stats_enabled?(); end
end
class RubyVM
def self.keep_script_lines(); end
@ -9602,6 +9441,7 @@ class Socket
AF_PUP = ::T.let(nil, ::T.untyped)
AF_SIP = ::T.let(nil, ::T.untyped)
AF_SYSTEM = ::T.let(nil, ::T.untyped)
AF_VSOCK = ::T.let(nil, ::T.untyped)
AI_DEFAULT = ::T.let(nil, ::T.untyped)
AI_MASK = ::T.let(nil, ::T.untyped)
AI_V4MAPPED_CFG = ::T.let(nil, ::T.untyped)
@ -9624,6 +9464,7 @@ class Socket
IPV6_PATHMTU = ::T.let(nil, ::T.untyped)
IPV6_RECVPATHMTU = ::T.let(nil, ::T.untyped)
IPV6_USE_MIN_MTU = ::T.let(nil, ::T.untyped)
IP_DONTFRAG = ::T.let(nil, ::T.untyped)
IP_PORTRANGE = ::T.let(nil, ::T.untyped)
IP_RECVDSTADDR = ::T.let(nil, ::T.untyped)
IP_RECVIF = ::T.let(nil, ::T.untyped)
@ -9658,6 +9499,7 @@ class Socket
PF_RTIP = ::T.let(nil, ::T.untyped)
PF_SIP = ::T.let(nil, ::T.untyped)
PF_SYSTEM = ::T.let(nil, ::T.untyped)
PF_VSOCK = ::T.let(nil, ::T.untyped)
PF_XTP = ::T.let(nil, ::T.untyped)
SCM_CREDS = ::T.let(nil, ::T.untyped)
SO_DONTTRUNC = ::T.let(nil, ::T.untyped)
@ -9695,6 +9537,7 @@ module Socket::Constants
AF_PUP = ::T.let(nil, ::T.untyped)
AF_SIP = ::T.let(nil, ::T.untyped)
AF_SYSTEM = ::T.let(nil, ::T.untyped)
AF_VSOCK = ::T.let(nil, ::T.untyped)
AI_DEFAULT = ::T.let(nil, ::T.untyped)
AI_MASK = ::T.let(nil, ::T.untyped)
AI_V4MAPPED_CFG = ::T.let(nil, ::T.untyped)
@ -9717,6 +9560,7 @@ module Socket::Constants
IPV6_PATHMTU = ::T.let(nil, ::T.untyped)
IPV6_RECVPATHMTU = ::T.let(nil, ::T.untyped)
IPV6_USE_MIN_MTU = ::T.let(nil, ::T.untyped)
IP_DONTFRAG = ::T.let(nil, ::T.untyped)
IP_PORTRANGE = ::T.let(nil, ::T.untyped)
IP_RECVDSTADDR = ::T.let(nil, ::T.untyped)
IP_RECVIF = ::T.let(nil, ::T.untyped)
@ -9751,6 +9595,7 @@ module Socket::Constants
PF_RTIP = ::T.let(nil, ::T.untyped)
PF_SIP = ::T.let(nil, ::T.untyped)
PF_SYSTEM = ::T.let(nil, ::T.untyped)
PF_VSOCK = ::T.let(nil, ::T.untyped)
PF_XTP = ::T.let(nil, ::T.untyped)
SCM_CREDS = ::T.let(nil, ::T.untyped)
SO_DONTTRUNC = ::T.let(nil, ::T.untyped)
@ -9871,16 +9716,12 @@ end
class String
include ::JSON::Ext::Generator::GeneratorMethods::String
def ends_with?(*arg); end
def fast_xs(); end
def shellescape(); end
def shellsplit(); end
def starts_with?(*arg); end
def to_nfc(); end
def to_nfd(); end
@ -9931,10 +9772,6 @@ module Superenv
end
class Symbol
def ends_with?(*arg); end
def starts_with?(*arg); end
def to_msgpack_ext(); end
end
@ -9972,22 +9809,6 @@ class Thread
def self.new(*arg); end
end
class Time
def compare_without_coercion(arg); end
def eql_without_coercion(arg); end
def minus_without_duration(arg); end
def plus_without_duration(arg); end
def to_default_s(); end
end
class Time
def self.at_without_coercion(time, subsec=T.unsafe(nil), unit=T.unsafe(nil), in: T.unsafe(nil)); end
end
module Timeout
VERSION = ::T.let(nil, ::T.untyped)
end
@ -10243,12 +10064,6 @@ class Version::Token
extend ::T::Private::Abstract::Hooks
end
class WeakRef
def initialize(orig); end
RUBYGEMS_ACTIVATION_MONITOR = ::T.let(nil, ::T.untyped)
VERSION = ::T.let(nil, ::T.untyped)
end
module YARDSorbet::Directives
extend ::T::Private::Methods::MethodHooks
extend ::T::Private::Methods::SingletonMethodHooks

View File

@ -3,8 +3,7 @@
# This should not be made a constant or Tapioca will think it is part of a gem.
dependency_require_map = {
"activesupport" => "active_support/all",
"ruby-macho" => "macho",
"ruby-macho" => "macho",
}.freeze
# Freeze lockfile

View File

@ -1,8 +1,6 @@
# typed: true
# frozen_string_literal: true
# Disable Rails cops, as we haven't required active_support yet.
# rubocop:disable Rails
homebrew_bootsnap_enabled = ENV["HOMEBREW_NO_BOOTSNAP"].nil? && !ENV["HOMEBREW_BOOTSNAP"].nil?
# we need some development tools to build bootsnap native code
@ -49,4 +47,3 @@ if homebrew_bootsnap_enabled
$stderr.puts "Error: HOMEBREW_BOOTSNAP could not `require \"bootsnap\"`!\n\n"
end
end
# rubocop:enable Rails

View File

@ -7,9 +7,4 @@ describe "brew", :integration_test do
.and not_to_output.to_stderr
.and be_a_success
end
it "does not require i18n" do
# This is a transitive dependency of activesupport, but we don't use it.
expect { I18n }.to raise_error(NameError)
end
end

View File

@ -0,0 +1,106 @@
# frozen_string_literal: true
require "rubocops/blank"
describe RuboCop::Cop::Homebrew::Blank, :config do
shared_examples "offense" do |source, correction, message|
it "registers an offense and corrects" do
expect_offense(<<~RUBY, source: source, message: message)
#{source}
^{source} #{message}
RUBY
expect_correction(<<~RUBY)
#{correction}
RUBY
end
end
it "accepts checking nil?" do
expect_no_offenses("foo.nil?")
end
it "accepts checking empty?" do
expect_no_offenses("foo.empty?")
end
it "accepts checking nil? || empty? on different objects" do
expect_no_offenses("foo.nil? || bar.empty?")
end
# Bug: https://github.com/rubocop/rubocop/issues/4171
it "does not break when RHS of `or` is a naked falsiness check" do
expect_no_offenses("foo.empty? || bar")
end
it "does not break when LHS of `or` is a naked falsiness check" do
expect_no_offenses("bar || foo.empty?")
end
# Bug: https://github.com/rubocop/rubocop/issues/4814
it "does not break when LHS of `or` is a send node with an argument" do
expect_no_offenses("x(1) || something")
end
context "when nil or empty" do
it_behaves_like "offense", "foo.nil? || foo.empty?",
"foo.blank?",
"Use `foo.blank?` instead of `foo.nil? || foo.empty?`."
it_behaves_like "offense", "nil? || empty?", "blank?", "Use `blank?` instead of `nil? || empty?`."
it_behaves_like "offense", "foo == nil || foo.empty?",
"foo.blank?",
"Use `foo.blank?` instead of `foo == nil || foo.empty?`."
it_behaves_like "offense", "nil == foo || foo.empty?",
"foo.blank?",
"Use `foo.blank?` instead of `nil == foo || foo.empty?`."
it_behaves_like "offense", "!foo || foo.empty?", "foo.blank?",
"Use `foo.blank?` instead of `!foo || foo.empty?`."
it_behaves_like "offense", "foo.nil? || !!foo.empty?",
"foo.blank?",
"Use `foo.blank?` instead of `foo.nil? || !!foo.empty?`."
it_behaves_like "offense", "foo == nil || !!foo.empty?",
"foo.blank?",
"Use `foo.blank?` instead of " \
"`foo == nil || !!foo.empty?`."
it_behaves_like "offense", "nil == foo || !!foo.empty?",
"foo.blank?",
"Use `foo.blank?` instead of " \
"`nil == foo || !!foo.empty?`."
end
context "when checking all variable types" do
it_behaves_like "offense", "foo.bar.nil? || foo.bar.empty?",
"foo.bar.blank?",
"Use `foo.bar.blank?` instead of " \
"`foo.bar.nil? || foo.bar.empty?`."
it_behaves_like "offense", "FOO.nil? || FOO.empty?",
"FOO.blank?",
"Use `FOO.blank?` instead of `FOO.nil? || FOO.empty?`."
it_behaves_like "offense", "Foo.nil? || Foo.empty?",
"Foo.blank?",
"Use `Foo.blank?` instead of `Foo.nil? || Foo.empty?`."
it_behaves_like "offense", "Foo::Bar.nil? || Foo::Bar.empty?",
"Foo::Bar.blank?",
"Use `Foo::Bar.blank?` instead of " \
"`Foo::Bar.nil? || Foo::Bar.empty?`."
it_behaves_like "offense", "@foo.nil? || @foo.empty?",
"@foo.blank?",
"Use `@foo.blank?` instead of `@foo.nil? || @foo.empty?`."
it_behaves_like "offense", "$foo.nil? || $foo.empty?",
"$foo.blank?",
"Use `$foo.blank?` instead of `$foo.nil? || $foo.empty?`."
it_behaves_like "offense", "@@foo.nil? || @@foo.empty?",
"@@foo.blank?",
"Use `@@foo.blank?` instead of " \
"`@@foo.nil? || @@foo.empty?`."
it_behaves_like "offense", "foo[bar].nil? || foo[bar].empty?",
"foo[bar].blank?",
"Use `foo[bar].blank?` instead of " \
"`foo[bar].nil? || foo[bar].empty?`."
it_behaves_like "offense", "foo(bar).nil? || foo(bar).empty?",
"foo(bar).blank?",
"Use `foo(bar).blank?` instead of " \
"`foo(bar).nil? || foo(bar).empty?`."
end
end

View File

@ -0,0 +1,114 @@
# frozen_string_literal: true
require "rubocops/compact_blank"
RSpec.describe RuboCop::Cop::Homebrew::CompactBlank, :config do
it "registers and corrects an offense when using `reject { |e| e.blank? }`" do
expect_offense(<<~RUBY)
collection.reject { |e| e.blank? }
^^^^^^^^^^^^^^^^^^^^^^^ Use `compact_blank` instead.
RUBY
expect_correction(<<~RUBY)
collection.compact_blank
RUBY
end
it "registers and corrects an offense when using `reject(&:blank?)`" do
expect_offense(<<~RUBY)
collection.reject(&:blank?)
^^^^^^^^^^^^^^^^ Use `compact_blank` instead.
RUBY
expect_correction(<<~RUBY)
collection.compact_blank
RUBY
end
it "registers and corrects an offense when using `delete_if { |e| e.blank? }`" do
expect_offense(<<~RUBY)
collection.delete_if { |e| e.blank? }
^^^^^^^^^^^^^^^^^^^^^^^^^^ Use `compact_blank!` instead.
RUBY
expect_correction(<<~RUBY)
collection.compact_blank!
RUBY
end
it "registers and corrects an offense when using `delete_if(&:blank?)`" do
expect_offense(<<~RUBY)
collection.delete_if(&:blank?)
^^^^^^^^^^^^^^^^^^^ Use `compact_blank!` instead.
RUBY
expect_correction(<<~RUBY)
collection.compact_blank!
RUBY
end
it "registers and corrects an offense when using `reject! { |e| e.blank? }`" do
expect_offense(<<~RUBY)
collection.reject! { |e| e.blank? }
^^^^^^^^^^^^^^^^^^^^^^^^ Use `compact_blank!` instead.
RUBY
expect_correction(<<~RUBY)
collection.compact_blank!
RUBY
end
it "registers and corrects an offense when using `reject!(&:blank?)`" do
expect_offense(<<~RUBY)
collection.reject!(&:blank?)
^^^^^^^^^^^^^^^^^ Use `compact_blank!` instead.
RUBY
expect_correction(<<~RUBY)
collection.compact_blank!
RUBY
end
it "registers and corrects an offense when using `reject(&:blank?)` in block" do
expect_offense(<<~RUBY)
hash.transform_values { |value| value.reject(&:blank?) }
^^^^^^^^^^^^^^^^ Use `compact_blank` instead.
RUBY
expect_correction(<<~RUBY)
hash.transform_values { |value| value.compact_blank }
RUBY
end
it "does not register an offense when using `compact_blank`" do
expect_no_offenses(<<~RUBY)
collection.compact_blank
RUBY
end
it "does not register an offense when using `compact_blank!`" do
expect_no_offenses(<<~RUBY)
collection.compact_blank!
RUBY
end
it "does not register an offense when using `reject { |k, v| k.blank? }`" do
expect_no_offenses(<<~RUBY)
collection.reject { |k, v| k.blank? }
RUBY
end
it "does not register an offense when using the receiver of `blank?` is not a block variable" do
expect_no_offenses(<<~RUBY)
def foo(arg)
collection.reject { |_| arg.blank? }
end
RUBY
end
it "does not register an offense when using `reject { |e| e.empty? }`" do
expect_no_offenses(<<~RUBY)
collection.reject { |e| e.empty? }
RUBY
end
end

View File

@ -0,0 +1,29 @@
# frozen_string_literal: true
require "rubocops/negate_include"
RSpec.describe RuboCop::Cop::Homebrew::NegateInclude, :config do
it "registers an offense and corrects when using `!include?`" do
expect_offense(<<~RUBY)
!array.include?(2)
^^^^^^^^^^^^^^^^^^ Use `.exclude?` and remove the negation part.
RUBY
expect_correction(<<~RUBY)
array.exclude?(2)
RUBY
end
it "does not register an offense when using `!include?` without receiver" do
expect_no_offenses(<<~RUBY)
!include?(2)
RUBY
end
it "does not register an offense when using `include?` or `exclude?`" do
expect_no_offenses(<<~RUBY)
array.include?(2)
array.exclude?(2)
RUBY
end
end

View File

@ -0,0 +1,446 @@
# frozen_string_literal: true
require "rubocops/presence"
RSpec.describe RuboCop::Cop::Homebrew::Presence, :config do
it "registers an offense and corrects when `a.present? ? a : nil`" do
expect_offense(<<~RUBY)
a.present? ? a : nil
^^^^^^^^^^^^^^^^^^^^ Use `a.presence` instead of `a.present? ? a : nil`.
RUBY
expect_correction(<<~RUBY)
a.presence
RUBY
end
it "registers an offense and corrects when `!a.present? ? nil: a`" do
expect_offense(<<~RUBY)
!a.present? ? nil: a
^^^^^^^^^^^^^^^^^^^^ Use `a.presence` instead of `!a.present? ? nil: a`.
RUBY
expect_correction(<<~RUBY)
a.presence
RUBY
end
it "registers an offense and corrects when `a.blank? ? nil : a`" do
expect_offense(<<~RUBY)
a.blank? ? nil : a
^^^^^^^^^^^^^^^^^^ Use `a.presence` instead of `a.blank? ? nil : a`.
RUBY
expect_correction(<<~RUBY)
a.presence
RUBY
end
it "registers an offense and corrects when `!a.blank? ? a : nil`" do
expect_offense(<<~RUBY)
!a.blank? ? a : nil
^^^^^^^^^^^^^^^^^^^ Use `a.presence` instead of `!a.blank? ? a : nil`.
RUBY
expect_correction(<<~RUBY)
a.presence
RUBY
end
it "registers an offense and corrects when `a.present? ? a : b`" do
expect_offense(<<~RUBY)
a.present? ? a : b
^^^^^^^^^^^^^^^^^^ Use `a.presence || b` instead of `a.present? ? a : b`.
RUBY
expect_correction(<<~RUBY)
a.presence || b
RUBY
end
it "registers an offense and corrects when `!a.present? ? b : a`" do
expect_offense(<<~RUBY)
!a.present? ? b : a
^^^^^^^^^^^^^^^^^^^ Use `a.presence || b` instead of `!a.present? ? b : a`.
RUBY
expect_correction(<<~RUBY)
a.presence || b
RUBY
end
it "registers an offense and corrects when `a.blank? ? b : a`" do
expect_offense(<<~RUBY)
a.blank? ? b : a
^^^^^^^^^^^^^^^^ Use `a.presence || b` instead of `a.blank? ? b : a`.
RUBY
expect_correction(<<~RUBY)
a.presence || b
RUBY
end
it "registers an offense and corrects when `!a.blank? ? a : b`" do
expect_offense(<<~RUBY)
!a.blank? ? a : b
^^^^^^^^^^^^^^^^^ Use `a.presence || b` instead of `!a.blank? ? a : b`.
RUBY
expect_correction(<<~RUBY)
a.presence || b
RUBY
end
it "registers an offense and corrects when `a.present? ? a : 1`" do
expect_offense(<<~RUBY)
a.present? ? a : 1
^^^^^^^^^^^^^^^^^^ Use `a.presence || 1` instead of `a.present? ? a : 1`.
RUBY
expect_correction(<<~RUBY)
a.presence || 1
RUBY
end
it "registers an offense and corrects when `a.blank? ? 1 : a`" do
expect_offense(<<~RUBY)
a.blank? ? 1 : a
^^^^^^^^^^^^^^^^ Use `a.presence || 1` instead of `a.blank? ? 1 : a`.
RUBY
expect_correction(<<~RUBY)
a.presence || 1
RUBY
end
it "registers an offense and corrects when `a(:bar).map(&:baz).present? ? a(:bar).map(&:baz) : nil`" do
expect_offense(<<~RUBY)
a(:bar).map(&:baz).present? ? a(:bar).map(&:baz) : nil
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Use `a(:bar).map(&:baz).presence` instead of `a(:bar).map(&:baz).present? ? a(:bar).map(&:baz) : nil`.
RUBY
expect_correction(<<~RUBY)
a(:bar).map(&:baz).presence
RUBY
end
it "registers an offense and corrects when `a.present? ? a : b[:c]`" do
expect_offense(<<~RUBY)
a.present? ? a : b[:c]
^^^^^^^^^^^^^^^^^^^^^^ Use `a.presence || b[:c]` instead of `a.present? ? a : b[:c]`.
RUBY
expect_correction(<<~RUBY)
a.presence || b[:c]
RUBY
end
it "registers an offense and corrects when multi-line if node" do
expect_offense(<<~RUBY)
if a.present?
^^^^^^^^^^^^^ Use `a.presence` instead of `if a.present? ... end`.
a
else
nil
end
RUBY
expect_correction(<<~RUBY)
a.presence
RUBY
end
it "registers an offense and corrects when multi-line unless node" do
expect_offense(<<~RUBY)
unless a.present?
^^^^^^^^^^^^^^^^^ Use `a.presence` instead of `unless a.present? ... end`.
nil
else
a
end
RUBY
expect_correction(<<~RUBY)
a.presence
RUBY
end
it "registers an offense and corrects when multi-line if node with `+` operators in the else branch" do
expect_offense(<<~RUBY)
if a.present?
^^^^^^^^^^^^^ Use `a.presence || b.to_f + 12.0` instead of `if a.present? ... end`.
a
else
b.to_f + 12.0
end
RUBY
expect_correction(<<~RUBY)
a.presence || b.to_f + 12.0
RUBY
end
it "registers an offense and corrects when multi-line if `*` operators in the else branch" do
expect_offense(<<~RUBY)
if a.present?
^^^^^^^^^^^^^ Use `a.presence || b.to_f * 12.0` instead of `if a.present? ... end`.
a
else
b.to_f * 12.0
end
RUBY
expect_correction(<<~RUBY)
a.presence || b.to_f * 12.0
RUBY
end
it "registers an offense and corrects when `a if a.present?`" do
expect_offense(<<~RUBY)
a if a.present?
^^^^^^^^^^^^^^^ Use `a.presence` instead of `a if a.present?`.
RUBY
expect_correction(<<~RUBY)
a.presence
RUBY
end
it "registers an offense and corrects when `a unless a.blank?`" do
expect_offense(<<~RUBY)
a unless a.blank?
^^^^^^^^^^^^^^^^^ Use `a.presence` instead of `a unless a.blank?`.
RUBY
expect_correction(<<~RUBY)
a.presence
RUBY
end
it "registers an offense and corrects when `.present?` with method chain" do
expect_offense(<<~RUBY)
if [1, 2, 3].map { |num| num + 1 }
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Use `[1, 2, 3].map { |num| num + 1 }.map { |num| num + 2 }.presence || b` instead of `if [1, 2, 3].map { |num| num + 1 }.map { |num| num + 2 }.present? ... end`.
.map { |num| num + 2 }
.present?
[1, 2, 3].map { |num| num + 1 }.map { |num| num + 2 }
else
b
end
RUBY
expect_correction(<<~RUBY)
[1, 2, 3].map { |num| num + 1 }
.map { |num| num + 2 }.presence || b
RUBY
end
context "when multiline ternary can be replaced" do
it "registers an offense and corrects" do
expect_offense(<<~RUBY)
a.present? ?
^^^^^^^^^^^^ Use `a.presence` instead of `a.present? ? a : nil`.
a :
nil
RUBY
expect_correction(<<~RUBY)
a.presence
RUBY
end
end
context "when a method argument of `else` branch is enclosed in parentheses" do
it "registers an offense and corrects" do
expect_offense(<<~RUBY)
if value.present?
^^^^^^^^^^^^^^^^^ Use `value.presence || do_something(value)` instead of `if value.present? ... end`.
value
else
do_something(value)
end
RUBY
expect_correction(<<~RUBY)
value.presence || do_something(value)
RUBY
end
end
context "when a method argument of `else` branch is not enclosed in parentheses" do
it "registers an offense and corrects" do
expect_offense(<<~RUBY)
if value.present?
^^^^^^^^^^^^^^^^^ Use `value.presence || do_something(value)` instead of `if value.present? ... end`.
value
else
do_something value
end
RUBY
expect_correction(<<~RUBY)
value.presence || do_something(value)
RUBY
end
end
context "when multiple method arguments of `else` branch is not enclosed in parentheses" do
it "registers an offense and corrects" do
expect_offense(<<~RUBY)
if value.present?
^^^^^^^^^^^^^^^^^ Use `value.presence || do_something(arg1, arg2)` instead of `if value.present? ... end`.
value
else
do_something arg1, arg2
end
RUBY
expect_correction(<<~RUBY)
value.presence || do_something(arg1, arg2)
RUBY
end
end
context "when a method argument with a receiver of `else` branch is not enclosed in parentheses" do
it "registers an offense and corrects" do
expect_offense(<<~RUBY)
if value.present?
^^^^^^^^^^^^^^^^^ Use `value.presence || foo.do_something(value)` instead of `if value.present? ... end`.
value
else
foo.do_something value
end
RUBY
expect_correction(<<~RUBY)
value.presence || foo.do_something(value)
RUBY
end
end
context "when a right-hand side of the relational operator" do
%w[< > <= >= == !=].each do |operator|
it "registers an offense and corrects when `#{operator}`" do
expect_offense(<<~RUBY, operator: operator)
a #{operator} if b.present?
_{operator} ^^^^^^^^^^^^^ Use `(b.presence || c)` instead of `if b.present? ... end`.
b
else
c
end
RUBY
expect_correction(<<~RUBY)
a #{operator} (b.presence || c)
RUBY
end
end
end
it "does not register an offense when using `#presence`" do
expect_no_offenses(<<~RUBY)
a.presence
RUBY
end
it "does not register an offense when the expression does not return the receiver of `#present?`" do
expect_no_offenses(<<~RUBY)
a.present? ? b : nil
RUBY
expect_no_offenses(<<~RUBY)
puts foo if present?
puts foo if !present?
RUBY
end
it "does not register an offense when the expression does not return the receiver of `#blank?`" do
expect_no_offenses(<<~RUBY)
a.blank? ? nil : b
RUBY
expect_no_offenses(<<~RUBY)
puts foo if blank?
puts foo if !blank?
RUBY
end
it "does not register an offense when if or unless modifier is used" do
[
"a if a.blank?",
"a unless a.present?",
].each { |source| expect_no_offenses(source) }
end
it "does not register an offense when the else block is multiline" do
expect_no_offenses(<<~RUBY)
if a.present?
a
else
something
something
something
end
RUBY
end
it "does not register an offense when the else block has multiple statements" do
expect_no_offenses(<<~RUBY)
if a.present?
a
else
something; something; something
end
RUBY
end
it "does not register an offense when including the elsif block" do
expect_no_offenses(<<~RUBY)
if a.present?
a
elsif b
b
end
RUBY
end
it "does not register an offense when the else block has `if` node" do
expect_no_offenses(<<~RUBY)
if a.present?
a
else
b if c
end
RUBY
end
it "does not register an offense when the else block has `rescue` node" do
expect_no_offenses(<<~RUBY)
if something_method.present?
something_method
else
invalid_method rescue StandardError
end
RUBY
end
it "does not register an offense when the else block has `while` node" do
expect_no_offenses(<<~RUBY)
if a.present?
a
else
fetch_state while waiting?
end
RUBY
end
it "does not register an offense when using #present? with elsif block" do
expect_no_offenses(<<~RUBY)
if something?
a
elsif b.present?
b
end
RUBY
end
end

View File

@ -0,0 +1,92 @@
# frozen_string_literal: true
require "rubocops/present"
describe RuboCop::Cop::Homebrew::Present, :config do
shared_examples "offense" do |source, correction, message|
it "registers an offense and corrects" do
expect_offense(<<~RUBY, source: source, message: message)
#{source}
^{source} #{message}
RUBY
expect_correction(<<~RUBY)
#{correction}
RUBY
end
end
it "accepts checking nil?" do
expect_no_offenses("foo.nil?")
end
it "accepts checking empty?" do
expect_no_offenses("foo.empty?")
end
it "accepts checking nil? || empty? on different objects" do
expect_no_offenses("foo.nil? || bar.empty?")
end
it "accepts checking existence && not empty? on different objects" do
expect_no_offenses("foo && !bar.empty?")
end
it_behaves_like "offense", "foo && !foo.empty?",
"foo.present?",
"Use `foo.present?` instead of `foo && !foo.empty?`."
it_behaves_like "offense", "!foo.nil? && !foo.empty?",
"foo.present?",
"Use `foo.present?` instead of `!foo.nil? && !foo.empty?`."
it_behaves_like "offense", "!nil? && !empty?", "present?",
"Use `present?` instead of `!nil? && !empty?`."
it_behaves_like "offense", "foo != nil && !foo.empty?",
"foo.present?",
"Use `foo.present?` instead of `foo != nil && !foo.empty?`."
it_behaves_like "offense", "!!foo && !foo.empty?",
"foo.present?",
"Use `foo.present?` instead of `!!foo && !foo.empty?`."
context "when checking all variable types" do
it_behaves_like "offense", "!foo.nil? && !foo.empty?",
"foo.present?",
"Use `foo.present?` instead of " \
"`!foo.nil? && !foo.empty?`."
it_behaves_like "offense", "!foo.bar.nil? && !foo.bar.empty?",
"foo.bar.present?",
"Use `foo.bar.present?` instead of " \
"`!foo.bar.nil? && !foo.bar.empty?`."
it_behaves_like "offense", "!FOO.nil? && !FOO.empty?",
"FOO.present?",
"Use `FOO.present?` instead of " \
"`!FOO.nil? && !FOO.empty?`."
it_behaves_like "offense", "!Foo.nil? && !Foo.empty?",
"Foo.present?",
"Use `Foo.present?` instead of " \
"`!Foo.nil? && !Foo.empty?`."
it_behaves_like "offense", "!@foo.nil? && !@foo.empty?",
"@foo.present?",
"Use `@foo.present?` instead of " \
"`!@foo.nil? && !@foo.empty?`."
it_behaves_like "offense", "!$foo.nil? && !$foo.empty?",
"$foo.present?",
"Use `$foo.present?` instead of " \
"`!$foo.nil? && !$foo.empty?`."
it_behaves_like "offense", "!@@foo.nil? && !@@foo.empty?",
"@@foo.present?",
"Use `@@foo.present?` instead of " \
"`!@@foo.nil? && !@@foo.empty?`."
it_behaves_like "offense", "!foo[bar].nil? && !foo[bar].empty?",
"foo[bar].present?",
"Use `foo[bar].present?` instead of " \
"`!foo[bar].nil? && !foo[bar].empty?`."
it_behaves_like "offense", "!Foo::Bar.nil? && !Foo::Bar.empty?",
"Foo::Bar.present?",
"Use `Foo::Bar.present?` instead of " \
"`!Foo::Bar.nil? && !Foo::Bar.empty?`."
it_behaves_like "offense", "!foo(bar).nil? && !foo(bar).empty?",
"foo(bar).present?",
"Use `foo(bar).present?` instead of " \
"`!foo(bar).nil? && !foo(bar).empty?`."
end
end

View File

@ -0,0 +1,43 @@
# frozen_string_literal: true
require "rubocops/safe_navigation_with_blank"
RSpec.describe RuboCop::Cop::Homebrew::SafeNavigationWithBlank, :config do
context "when in a conditional" do
it "registers an offense on a single conditional" do
expect_offense(<<~RUBY)
do_something unless foo&.blank?
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Avoid calling `blank?` with the safe navigation operator in conditionals.
RUBY
expect_correction(<<~RUBY)
do_something unless foo.blank?
RUBY
end
it "registers an offense on chained conditionals" do
expect_offense(<<~RUBY)
do_something unless foo&.bar&.blank?
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Avoid calling `blank?` with the safe navigation operator in conditionals.
RUBY
expect_correction(<<~RUBY)
do_something unless foo&.bar.blank?
RUBY
end
it "does not register an offense on `.blank?`" do
expect_no_offenses(<<~RUBY)
return if foo.blank?
RUBY
end
end
context "when outside a conditional" do
it "registers no offense" do
expect_no_offenses(<<~RUBY)
bar = foo&.blank?
RUBY
end
end
end

View File

@ -14,7 +14,7 @@ module Homebrew
# Bump this whenever a committed vendored gem is later added to or exclusion removed from gitignore.
# This will trigger it to reinstall properly if `brew install-bundler-gems` needs it.
VENDOR_VERSION = 5
VENDOR_VERSION = 6
private_constant :VENDOR_VERSION
RUBY_BUNDLE_VENDOR_DIRECTORY = (HOMEBREW_LIBRARY_PATH/"vendor/bundle/ruby").freeze

View File

@ -27,12 +27,6 @@ else
end
end
end
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/concurrent-ruby-1.2.3/lib/concurrent-ruby")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/i18n-1.14.1/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/minitest-5.21.2/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/tzinfo-2.0.6/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/zeitwerk-2.6.12/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/activesupport-6.1.7.6/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/public_suffix-5.0.4/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/addressable-2.8.6/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/ast-2.4.2/lib")
@ -63,6 +57,7 @@ $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/json_schemer-2.1.1/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/language_server-protocol-3.17.0.3/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/method_source-1.0.0/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/minitest-5.21.2/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/mustache-1.1.1/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/netrc-0.11.0/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/parallel-1.24.0/lib")
@ -79,7 +74,6 @@ $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/extensions/x86_64-darwin-15/#{Gem.extension_api_version}/prism-0.19.0")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/prism-0.19.0/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/pry-0.14.2/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rack-3.0.8/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rbi-0.1.6/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/extensions/x86_64-darwin-15/#{Gem.extension_api_version}/rdiscount-2.2.7.3")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rdiscount-2.2.7.3/lib")
@ -102,7 +96,6 @@ $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-capybara-2.20.0/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-factory_bot-2.25.1/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-performance-1.20.2/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-rails-2.23.1/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-rspec-2.26.1/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-sorbet-0.7.6/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/ruby-macho-4.0.0/lib")