brew vendor-gems: commit updates.

This commit is contained in:
BrewTestBot 2021-06-10 07:44:47 +00:00
parent a6119266d3
commit caf82237fa
No known key found for this signature in database
GPG Key ID: 82D7D104050B0F0F
113 changed files with 131 additions and 17 deletions

View File

@ -82,7 +82,7 @@ $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/unicode-display_width
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-1.16.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-performance-1.11.3/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rails-2.10.1/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rspec-2.3.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rspec-2.4.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-sorbet-0.6.2/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ruby-macho-2.5.1/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/simplecov-html-0.12.3/lib"

View File

@ -351,6 +351,12 @@ RSpec/HooksBeforeExamples:
VersionAdded: '1.29'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/HooksBeforeExamples
RSpec/IdenticalEqualityAssertion:
Description: Checks for equality assertions with identical expressions on both sides.
Enabled: pending
VersionAdded: '2.4'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/IdenticalEqualityAssertion
RSpec/ImplicitBlockExpectation:
Description: Check that implicit block expectation syntax is not used.
Enabled: true
@ -753,6 +759,12 @@ RSpec/FactoryBot/FactoryClassName:
VersionChanged: '2.0'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/FactoryClassName
RSpec/Rails/AvoidSetupHook:
Description: Checks that tests use RSpec `before` hook over Rails `setup` method.
Enabled: pending
VersionAdded: '2.4'
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Rails/AvoidSetupHook
RSpec/Rails/HttpStatus:
Description: Enforces use of symbolic or numeric value to describe HTTP status.
Enabled: true

View File

@ -203,7 +203,7 @@ module RuboCop
[name]
elsif namespace.const_type?
[*const_name(namespace), name]
elsif namespace.lvar_type? || namespace.cbase_type?
elsif %i[lvar cbase send].include?(namespace.type)
[nil, name]
end
end

View File

@ -39,7 +39,7 @@ module RuboCop
# @!method expect_change_with_arguments(node)
def_node_matcher :expect_change_with_arguments, <<-PATTERN
(send nil? :change ({const send} nil? $_) (sym $_))
(send nil? :change $_ (sym $_))
PATTERN
# @!method expect_change_with_block(node)
@ -55,9 +55,9 @@ module RuboCop
return unless style == :block
expect_change_with_arguments(node) do |receiver, message|
msg = format(MSG_CALL, obj: receiver, attr: message)
msg = format(MSG_CALL, obj: receiver.source, attr: message)
add_offense(node, message: msg) do |corrector|
replacement = "change { #{receiver}.#{message} }"
replacement = "change { #{receiver.source}.#{message} }"
corrector.replace(node, replacement)
end
end

View File

@ -61,10 +61,10 @@ module RuboCop
MSG = 'Spec path should end with `%<suffix>s`.'
# @!method const_described(node)
def_node_matcher :const_described, <<~PATTERN
# @!method example_group(node)
def_node_matcher :example_group, <<~PATTERN
(block
$(send #rspec? _example_group $(const ...) $...) ...
$(send #rspec? _example_group $_ $...) ...
)
PATTERN
@ -74,17 +74,17 @@ module RuboCop
def on_top_level_example_group(node)
return unless top_level_groups.one?
const_described(node) do |send_node, described_class, arguments|
example_group(node) do |send_node, example_group, arguments|
next if routing_spec?(arguments)
ensure_correct_file_path(send_node, described_class, arguments)
ensure_correct_file_path(send_node, example_group, arguments)
end
end
private
def ensure_correct_file_path(send_node, described_class, arguments)
pattern = pattern_for(described_class, arguments.first)
def ensure_correct_file_path(send_node, example_group, arguments)
pattern = pattern_for(example_group, arguments.first)
return if filename_ends_with?(pattern)
# For the suffix shown in the offense message, modify the regular
@ -99,11 +99,13 @@ module RuboCop
args.any?(&method(:routing_metadata?))
end
def pattern_for(described_class, method_name)
return pattern_for_spec_suffix_only? if spec_suffix_only?
def pattern_for(example_group, method_name)
if spec_suffix_only? || !example_group.const_type?
return pattern_for_spec_suffix_only?
end
[
expected_path(described_class),
expected_path(example_group),
name_pattern(method_name),
'[^/]*_spec\.rb'
].join

View File

@ -0,0 +1,38 @@
# frozen_string_literal: true
module RuboCop
module Cop
module RSpec
# Checks for equality assertions with identical expressions on both sides.
#
# @example
#
# # bad
# expect(foo.bar).to eq(foo.bar)
# expect(foo.bar).to eql(foo.bar)
#
# # good
# expect(foo.bar).to eq(2)
# expect(foo.bar).to eql(2)
#
class IdenticalEqualityAssertion < Base
MSG = 'Identical expressions on both sides of the equality ' \
'may indicate a flawed test.'
RESTRICT_ON_SEND = %i[to].freeze
# @!method equality_check?(node)
def_node_matcher :equality_check?, <<~PATTERN
(send (send nil? :expect $_) :to
{(send nil? {:eql :eq :be} $_)
(send (send nil? :be) :== $_)})
PATTERN
def on_send(node)
equality_check?(node) do |left, right|
add_offense(node) if left == right
end
end
end
end
end
end

View File

@ -7,7 +7,7 @@ module RuboCop
#
# This cop can be configured using the `EnforcedStyle` option
#
# @example `EnforcedStyle: single_line_only`
# @example `EnforcedStyle: single_line_only` (default)
# # bad
# it do
# is_expected.to be_truthy
@ -19,6 +19,22 @@ module RuboCop
# expect(subject).to be_truthy
# end
#
# @example `EnforcedStyle: single_statement_only`
# # bad
# it do
# foo = 1
# is_expected.to be_truthy
# end
#
# # good
# it do
# foo = 1
# expect(subject).to be_truthy
# end
# it do
# is_expected.to be_truthy
# end
#
# @example `EnforcedStyle: disallow`
# # bad
# it { is_expected.to be_truthy }

View File

@ -0,0 +1,44 @@
# frozen_string_literal: true
module RuboCop
module Cop
module RSpec
module Rails
# Checks that tests use RSpec `before` hook over Rails `setup` method.
#
# @example
#
# # bad
# setup do
# allow(foo).to receive(:bar)
# end
#
# # good
# before do
# allow(foo).to receive(:bar)
# end
#
class AvoidSetupHook < Base
extend AutoCorrector
MSG = 'Use `before` instead of `setup`.'
# @!method setup_call(node)
def_node_matcher :setup_call, <<-PATTERN
(block
$(send nil? :setup)
(args) _)
PATTERN
def on_block(node)
setup_call(node) do |setup|
add_offense(node) do |corrector|
corrector.replace setup, 'before'
end
end
end
end
end
end
end
end

View File

@ -8,6 +8,7 @@ require_relative 'rspec/factory_bot/attribute_defined_statically'
require_relative 'rspec/factory_bot/create_list'
require_relative 'rspec/factory_bot/factory_class_name'
require_relative 'rspec/rails/avoid_setup_hook'
begin
require_relative 'rspec/rails/http_status'
rescue LoadError
@ -47,6 +48,7 @@ require_relative 'rspec/file_path'
require_relative 'rspec/focus'
require_relative 'rspec/hook_argument'
require_relative 'rspec/hooks_before_examples'
require_relative 'rspec/identical_equality_assertion'
require_relative 'rspec/implicit_block_expectation'
require_relative 'rspec/implicit_expect'
require_relative 'rspec/implicit_subject'

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