brew vendor-gems: commit updates.
This commit is contained in:
parent
f7c3f66eb1
commit
30121165d9
21
Library/Homebrew/vendor/bundle/bundler/setup.rb
vendored
21
Library/Homebrew/vendor/bundle/bundler/setup.rb
vendored
@ -14,18 +14,15 @@ $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ast-2.4.1/lib"
|
||||
$:.unshift "#{path}/"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/extensions/universal-darwin-19/2.6.0/byebug-11.1.3"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/byebug-11.1.3/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/connection_pool-2.2.3/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/extensions/universal-darwin-19/2.6.0/json-2.3.0"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/json-2.3.0/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/extensions/universal-darwin-19/2.6.0/json-2.3.1"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/json-2.3.1/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/docile-1.3.2/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/simplecov-html-0.10.2/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/simplecov-0.16.1/lib"
|
||||
$:.unshift "#{path}/../../../../../../../../Library/Ruby/Gems/2.6.0/gems/sync-0.5.0/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/tins-1.25.0/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/term-ansicolor-1.7.1/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/thor-1.0.1/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/coveralls-0.8.23/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/diff-lcs-1.4.2/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/simplecov-html-0.12.2/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/simplecov-0.18.5/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/url-0.3.2/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/codecov-0.1.17/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/connection_pool-2.2.3/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/diff-lcs-1.4.4/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/extensions/universal-darwin-19/2.6.0/unf_ext-0.0.7.7"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/unf_ext-0.0.7.7/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/unf-0.1.4/lib"
|
||||
@ -67,5 +64,5 @@ $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ruby-progressbar-1.10
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/unicode-display_width-1.7.0/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-0.86.0/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-performance-1.6.1/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rspec-1.40.0/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rspec-1.41.0/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ruby-macho-2.2.0/lib"
|
||||
|
||||
@ -1,87 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module RuboCop
|
||||
module RSpec
|
||||
# Wrapper for RSpec example groups
|
||||
class ExampleGroup < Concept
|
||||
# @!method scope_change?(node)
|
||||
#
|
||||
# Detect if the node is an example group or shared example
|
||||
#
|
||||
# Selectors which indicate that we should stop searching
|
||||
#
|
||||
def_node_matcher :scope_change?, (
|
||||
ExampleGroups::ALL + SharedGroups::ALL + Includes::ALL
|
||||
).block_pattern
|
||||
|
||||
def subjects
|
||||
subjects_in_scope(node)
|
||||
end
|
||||
|
||||
def examples
|
||||
examples_in_scope(node).map(&Example.public_method(:new))
|
||||
end
|
||||
|
||||
def hooks
|
||||
hooks_in_scope(node).map(&Hook.public_method(:new))
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def subjects_in_scope(node)
|
||||
node.each_child_node.flat_map do |child|
|
||||
find_subjects(child)
|
||||
end
|
||||
end
|
||||
|
||||
def find_subjects(node)
|
||||
return [] if scope_change?(node)
|
||||
|
||||
if subject?(node)
|
||||
[node]
|
||||
else
|
||||
subjects_in_scope(node)
|
||||
end
|
||||
end
|
||||
|
||||
def hooks_in_scope(node)
|
||||
node.each_child_node.flat_map do |child|
|
||||
find_hooks(child)
|
||||
end
|
||||
end
|
||||
|
||||
def find_hooks(node)
|
||||
return [] if scope_change?(node) || example?(node)
|
||||
|
||||
if hook?(node)
|
||||
[node]
|
||||
else
|
||||
hooks_in_scope(node)
|
||||
end
|
||||
end
|
||||
|
||||
def examples_in_scope(node, &blk)
|
||||
node.each_child_node.flat_map do |child|
|
||||
find_examples(child, &blk)
|
||||
end
|
||||
end
|
||||
|
||||
# Recursively search for examples within the current scope
|
||||
#
|
||||
# Searches node for examples and halts when a scope change is detected
|
||||
#
|
||||
# @param node [RuboCop::Node] node to recursively search for examples
|
||||
#
|
||||
# @return [Array<RuboCop::Node>] discovered example nodes
|
||||
def find_examples(node)
|
||||
return [] if scope_change?(node)
|
||||
|
||||
if example?(node)
|
||||
[node]
|
||||
else
|
||||
examples_in_scope(node)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -13,6 +13,7 @@ require_relative 'rubocop/rspec/top_level_describe'
|
||||
require_relative 'rubocop/rspec/wording'
|
||||
require_relative 'rubocop/rspec/language'
|
||||
require_relative 'rubocop/rspec/language/node_pattern'
|
||||
require_relative 'rubocop/rspec/top_level_group'
|
||||
require_relative 'rubocop/rspec/concept'
|
||||
require_relative 'rubocop/rspec/example_group'
|
||||
require_relative 'rubocop/rspec/example'
|
||||
@ -43,12 +43,14 @@ module RuboCop
|
||||
def_node_matcher :rails_metadata?, <<-PATTERN
|
||||
(pair
|
||||
(sym :type)
|
||||
(sym {:request :feature :system :routing :view})
|
||||
(sym {
|
||||
:channel :controller :helper :job :mailer :model :request
|
||||
:routing :view :feature :system :mailbox
|
||||
}
|
||||
)
|
||||
)
|
||||
PATTERN
|
||||
|
||||
def_node_matcher :shared_group?, SharedGroups::ALL.block_pattern
|
||||
|
||||
def on_top_level_describe(node, (described_value, _))
|
||||
return if shared_group?(root_node)
|
||||
return if valid_describe?(node)
|
||||
@ -31,12 +31,15 @@ module RuboCop
|
||||
(send _ !#reserved_method? $...)
|
||||
PATTERN
|
||||
|
||||
def_node_search :factory_attributes, <<-PATTERN
|
||||
def_node_matcher :factory_attributes, <<-PATTERN
|
||||
(block (send _ #attribute_defining_method? ...) _ { (begin $...) $(send ...) } )
|
||||
PATTERN
|
||||
|
||||
def on_block(node)
|
||||
factory_attributes(node).to_a.flatten.each do |attribute|
|
||||
attributes = factory_attributes(node) || []
|
||||
attributes = [attributes] unless attributes.is_a?(Array)
|
||||
|
||||
attributes.each do |attribute|
|
||||
next unless offensive_receiver?(attribute.receiver, node)
|
||||
next if proc?(attribute) || association?(attribute.first_argument)
|
||||
|
||||
@ -47,13 +47,11 @@ module RuboCop
|
||||
# end
|
||||
#
|
||||
class InstanceVariable < Cop
|
||||
include RuboCop::RSpec::TopLevelGroup
|
||||
|
||||
MSG = 'Avoid instance variables – use let, ' \
|
||||
'a method call, or a local variable (if possible).'
|
||||
|
||||
EXAMPLE_GROUP_METHODS = ExampleGroups::ALL + SharedGroups::ALL
|
||||
|
||||
def_node_matcher :spec_group?, EXAMPLE_GROUP_METHODS.block_pattern
|
||||
|
||||
def_node_matcher :dynamic_class?, <<-PATTERN
|
||||
(block (send (const nil? :Class) :new ...) ...)
|
||||
PATTERN
|
||||
@ -69,9 +67,7 @@ module RuboCop
|
||||
|
||||
def_node_search :ivar_assigned?, '(ivasgn % ...)'
|
||||
|
||||
def on_block(node)
|
||||
return unless spec_group?(node)
|
||||
|
||||
def on_top_level_group(node)
|
||||
ivar_usage(node) do |ivar, name|
|
||||
next if valid_usage?(ivar)
|
||||
next if assignment_only? && !ivar_assigned?(node, name)
|
||||
@ -119,11 +119,8 @@ module RuboCop
|
||||
private
|
||||
|
||||
def inside_describe_block?(node)
|
||||
node.each_ancestor(:block).any?(&method(:in_example_or_shared_group?))
|
||||
end
|
||||
|
||||
def_node_matcher :in_example_or_shared_group?,
|
||||
(ExampleGroups::ALL + SharedGroups::ALL).block_pattern
|
||||
node.each_ancestor(:block).any?(&method(:spec_group?))
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -28,14 +28,20 @@ module RuboCop
|
||||
class LetSetup < Cop
|
||||
MSG = 'Do not use `let!` to setup objects not referenced in tests.'
|
||||
|
||||
def_node_search :let_bang, <<-PATTERN
|
||||
def_node_matcher :example_or_shared_group_or_including?,
|
||||
(
|
||||
ExampleGroups::ALL + SharedGroups::ALL +
|
||||
Includes::ALL
|
||||
).block_pattern
|
||||
|
||||
def_node_matcher :let_bang, <<-PATTERN
|
||||
(block $(send nil? :let! (sym $_)) args ...)
|
||||
PATTERN
|
||||
|
||||
def_node_search :method_called?, '(send nil? %)'
|
||||
|
||||
def on_block(node)
|
||||
return unless example_group?(node)
|
||||
return unless example_or_shared_group_or_including?(node)
|
||||
|
||||
unused_let_bang(node) do |let|
|
||||
add_offense(let)
|
||||
@ -45,10 +51,16 @@ module RuboCop
|
||||
private
|
||||
|
||||
def unused_let_bang(node)
|
||||
let_bang(node) do |method_send, method_name|
|
||||
child_let_bang(node) do |method_send, method_name|
|
||||
yield(method_send) unless method_called?(node, method_name)
|
||||
end
|
||||
end
|
||||
|
||||
def child_let_bang(node, &block)
|
||||
RuboCop::RSpec::ExampleGroup.new(node).lets.each do |let|
|
||||
let_bang(let, &block)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -97,13 +97,11 @@ module RuboCop
|
||||
"Configuration key `#{DEPRECATED_MAX_KEY}` for #{cop_name} is " \
|
||||
'deprecated in favor of `Max`. Please use that instead.'
|
||||
|
||||
def_node_search :find_contexts, ExampleGroups::ALL.block_pattern
|
||||
|
||||
def on_top_level_describe(node, _args)
|
||||
find_nested_contexts(node.parent) do |context, nesting|
|
||||
find_nested_example_groups(node.parent) do |example_group, nesting|
|
||||
self.max = nesting
|
||||
add_offense(
|
||||
context.send_node,
|
||||
example_group.send_node,
|
||||
message: message(nesting)
|
||||
)
|
||||
end
|
||||
@ -111,13 +109,14 @@ module RuboCop
|
||||
|
||||
private
|
||||
|
||||
def find_nested_contexts(node, nesting: 1, &block)
|
||||
find_contexts(node) do |nested_context|
|
||||
yield(nested_context, nesting) if nesting > max_nesting
|
||||
def find_nested_example_groups(node, nesting: 1, &block)
|
||||
example_group = example_group?(node)
|
||||
yield node, nesting if example_group && nesting > max_nesting
|
||||
|
||||
nested_context.each_child_node do |child|
|
||||
find_nested_contexts(child, nesting: nesting + 1, &block)
|
||||
end
|
||||
next_nesting = example_group ? nesting + 1 : nesting
|
||||
|
||||
node.each_child_node(:block, :begin) do |child|
|
||||
find_nested_example_groups(child, nesting: next_nesting, &block)
|
||||
end
|
||||
end
|
||||
|
||||
@ -277,12 +277,12 @@ module RuboCop
|
||||
# expect(foo).to be_something
|
||||
#
|
||||
# # also good - It checks "true" strictly.
|
||||
# expect(foo).to be(true)
|
||||
# expect(foo.something?).to be(true)
|
||||
#
|
||||
# @example Strict: false, EnforcedStyle: inflected
|
||||
# # bad
|
||||
# expect(foo.something?).to be_truthy
|
||||
# expect(foo).to be(true)
|
||||
# expect(foo.something?).to be(true)
|
||||
#
|
||||
# # good
|
||||
# expect(foo).to be_something
|
||||
@ -40,20 +40,21 @@ module RuboCop
|
||||
MSG_BLOCK = 'Use block for static values.'
|
||||
|
||||
def_node_search :contains_stub?, '(send nil? :receive (...))'
|
||||
def_node_matcher :stub_with_block?, '(block #contains_stub? ...)'
|
||||
def_node_search :and_return_value, <<-PATTERN
|
||||
$(send _ :and_return $(...))
|
||||
PATTERN
|
||||
|
||||
def on_send(node)
|
||||
return unless contains_stub?(node)
|
||||
return unless style == :block
|
||||
return unless contains_stub?(node)
|
||||
|
||||
check_and_return_call(node)
|
||||
end
|
||||
|
||||
def on_block(node)
|
||||
return unless contains_stub?(node)
|
||||
return unless style == :and_return
|
||||
return unless stub_with_block?(node)
|
||||
|
||||
check_block_body(node)
|
||||
end
|
||||
@ -22,6 +22,8 @@ module RuboCop
|
||||
# end
|
||||
#
|
||||
class SubjectStub < Cop
|
||||
include RuboCop::RSpec::TopLevelGroup
|
||||
|
||||
MSG = 'Do not stub methods of the object under test.'
|
||||
|
||||
# @!method subject(node)
|
||||
@ -75,11 +77,7 @@ module RuboCop
|
||||
} ...)
|
||||
PATTERN
|
||||
|
||||
def on_block(node)
|
||||
return unless example_group?(node)
|
||||
return if (processed_example_groups & node.ancestors).any?
|
||||
|
||||
processed_example_groups << node
|
||||
def on_top_level_group(node)
|
||||
@explicit_subjects = find_all_explicit_subjects(node)
|
||||
|
||||
find_subject_expectations(node) do |stub|
|
||||
@ -89,10 +87,6 @@ module RuboCop
|
||||
|
||||
private
|
||||
|
||||
def processed_example_groups
|
||||
@processed_example_groups ||= Set.new
|
||||
end
|
||||
|
||||
def find_all_explicit_subjects(node)
|
||||
node.each_descendant(:block).with_object({}) do |child, h|
|
||||
name = subject(child)
|
||||
@ -0,0 +1,59 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module RuboCop
|
||||
module RSpec
|
||||
# Wrapper for RSpec example groups
|
||||
class ExampleGroup < Concept
|
||||
# @!method scope_change?(node)
|
||||
#
|
||||
# Detect if the node is an example group or shared example
|
||||
#
|
||||
# Selectors which indicate that we should stop searching
|
||||
#
|
||||
def_node_matcher :scope_change?, (
|
||||
ExampleGroups::ALL + SharedGroups::ALL + Includes::ALL
|
||||
).block_pattern
|
||||
|
||||
def lets
|
||||
find_all_in_scope(node, :let?)
|
||||
end
|
||||
|
||||
def subjects
|
||||
find_all_in_scope(node, :subject?)
|
||||
end
|
||||
|
||||
def examples
|
||||
find_all_in_scope(node, :example?).map(&Example.public_method(:new))
|
||||
end
|
||||
|
||||
def hooks
|
||||
find_all_in_scope(node, :hook?).map(&Hook.public_method(:new))
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
# Recursively search for predicate within the current scope
|
||||
#
|
||||
# Searches node and halts when a scope change is detected
|
||||
#
|
||||
# @param node [RuboCop::Node] node to recursively search
|
||||
#
|
||||
# @return [Array<RuboCop::Node>] discovered nodes
|
||||
def find_all_in_scope(node, predicate)
|
||||
node.each_child_node.flat_map do |child|
|
||||
find_all(child, predicate)
|
||||
end
|
||||
end
|
||||
|
||||
def find_all(node, predicate)
|
||||
if public_send(predicate, node)
|
||||
[node]
|
||||
elsif scope_change?(node) || example?(node)
|
||||
[]
|
||||
else
|
||||
find_all_in_scope(node, predicate)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -4,7 +4,13 @@ module RuboCop
|
||||
module RSpec
|
||||
# RuboCop FactoryBot project namespace
|
||||
module FactoryBot
|
||||
ATTRIBUTE_DEFINING_METHODS = %i[factory trait transient ignore].freeze
|
||||
ATTRIBUTE_DEFINING_METHODS = %i[
|
||||
factory
|
||||
ignore
|
||||
trait
|
||||
traits_for_enum
|
||||
transient
|
||||
].freeze
|
||||
|
||||
UNPROXIED_METHODS = %i[
|
||||
__send__
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user