brew vendor-gems: commit updates.
This commit is contained in:
parent
99af12597b
commit
5e64a50464
@ -87,7 +87,7 @@ $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/unicode-display_width
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-1.27.0/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-performance-1.13.3/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rails-2.14.2/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rspec-2.9.0/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rspec-2.10.0/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-sorbet-0.6.7/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ruby-macho-3.0.0/lib"
|
||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/simplecov-html-0.12.3/lib"
|
||||
|
||||
@ -155,9 +155,14 @@ RSpec/BeEql:
|
||||
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/BeEql
|
||||
|
||||
RSpec/BeNil:
|
||||
Description: Check that `be_nil` is used instead of `be(nil)`.
|
||||
Description: Ensures a consistent style is used when matching `nil`.
|
||||
Enabled: pending
|
||||
EnforcedStyle: be_nil
|
||||
SupportedStyles:
|
||||
- be
|
||||
- be_nil
|
||||
VersionAdded: 2.9.0
|
||||
VersionChanged: 2.10.0
|
||||
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/BeNil
|
||||
|
||||
RSpec/BeforeAfterAll:
|
||||
@ -761,6 +766,16 @@ RSpec/VariableName:
|
||||
VersionChanged: '1.43'
|
||||
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/VariableName
|
||||
|
||||
RSpec/VerifiedDoubleReference:
|
||||
Description: Checks for consistent verified double reference style.
|
||||
Enabled: pending
|
||||
EnforcedStyle: constant
|
||||
SupportedStyles:
|
||||
- constant
|
||||
- string
|
||||
VersionAdded: 2.10.0
|
||||
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/VerifiedDoubleReference
|
||||
|
||||
RSpec/VerifiedDoubles:
|
||||
Description: Prefer using verifying doubles over normal doubles.
|
||||
Enabled: true
|
||||
@ -37,16 +37,21 @@ require_relative 'rubocop/cop/rspec_cops'
|
||||
# We have to register our autocorrect incompatibilities in RuboCop's cops
|
||||
# as well so we do not hit infinite loops
|
||||
|
||||
module RuboCop
|
||||
module Cop
|
||||
module Layout
|
||||
class ExtraSpacing # rubocop:disable Style/Documentation
|
||||
def self.autocorrect_incompatible_with
|
||||
[RSpec::AlignLeftLetBrace, RSpec::AlignRightLetBrace]
|
||||
end
|
||||
RuboCop::Cop::Layout::ExtraSpacing.singleton_class.prepend(
|
||||
Module.new do
|
||||
def autocorrect_incompatible_with
|
||||
super.push(RuboCop::Cop::RSpec::AlignLeftLetBrace)
|
||||
.push(RuboCop::Cop::RSpec::AlignRightLetBrace)
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
RuboCop::Cop::Style::TrailingCommaInArguments.singleton_class.prepend(
|
||||
Module.new do
|
||||
def autocorrect_incompatible_with
|
||||
super.push(RuboCop::Cop::RSpec::Capybara::CurrentPathExpectation)
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
RuboCop::AST::Node.include(RuboCop::RSpec::Node)
|
||||
@ -0,0 +1,74 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module RuboCop
|
||||
module Cop
|
||||
module RSpec
|
||||
# Ensures a consistent style is used when matching `nil`.
|
||||
#
|
||||
# You can either use the more specific `be_nil` matcher, or the more
|
||||
# generic `be` matcher with a `nil` argument.
|
||||
#
|
||||
# This cop can be configured using the `EnforcedStyle` option
|
||||
#
|
||||
# @example `EnforcedStyle: be_nil` (default)
|
||||
# # bad
|
||||
# expect(foo).to be(nil)
|
||||
#
|
||||
# # good
|
||||
# expect(foo).to be_nil
|
||||
#
|
||||
# @example `EnforcedStyle: be`
|
||||
# # bad
|
||||
# expect(foo).to be_nil
|
||||
#
|
||||
# # good
|
||||
# expect(foo).to be(nil)
|
||||
#
|
||||
class BeNil < Base
|
||||
extend AutoCorrector
|
||||
include ConfigurableEnforcedStyle
|
||||
|
||||
BE_MSG = 'Prefer `be(nil)` over `be_nil`.'
|
||||
BE_NIL_MSG = 'Prefer `be_nil` over `be(nil)`.'
|
||||
RESTRICT_ON_SEND = %i[be be_nil].freeze
|
||||
|
||||
# @!method be_nil_matcher?(node)
|
||||
def_node_matcher :be_nil_matcher?, <<-PATTERN
|
||||
(send nil? :be_nil)
|
||||
PATTERN
|
||||
|
||||
# @!method nil_value_expectation?(node)
|
||||
def_node_matcher :nil_value_expectation?, <<-PATTERN
|
||||
(send nil? :be nil)
|
||||
PATTERN
|
||||
|
||||
def on_send(node)
|
||||
case style
|
||||
when :be
|
||||
check_be_style(node)
|
||||
when :be_nil
|
||||
check_be_nil_style(node)
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def check_be_style(node)
|
||||
return unless be_nil_matcher?(node)
|
||||
|
||||
add_offense(node, message: BE_MSG) do |corrector|
|
||||
corrector.replace(node.loc.expression, 'be(nil)')
|
||||
end
|
||||
end
|
||||
|
||||
def check_be_nil_style(node)
|
||||
return unless nil_value_expectation?(node)
|
||||
|
||||
add_offense(node, message: BE_NIL_MSG) do |corrector|
|
||||
corrector.replace(node.loc.expression, 'be_nil')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -52,6 +52,10 @@ module RuboCop
|
||||
$(send nil? :match (str $_)))
|
||||
PATTERN
|
||||
|
||||
def self.autocorrect_incompatible_with
|
||||
[Style::TrailingCommaInArguments]
|
||||
end
|
||||
|
||||
def on_send(node)
|
||||
expectation_set_on_current_path(node) do
|
||||
add_offense(node.loc.selector) do |corrector|
|
||||
@ -145,7 +145,7 @@ module RuboCop
|
||||
return true unless body
|
||||
return false if conditionals_with_examples?(body)
|
||||
|
||||
if body.if_type?
|
||||
if body.if_type? || body.case_type?
|
||||
!examples_in_branches?(body)
|
||||
else
|
||||
!examples?(body)
|
||||
@ -153,15 +153,15 @@ module RuboCop
|
||||
end
|
||||
|
||||
def conditionals_with_examples?(body)
|
||||
return unless body.begin_type?
|
||||
return unless body.begin_type? || body.case_type?
|
||||
|
||||
body.each_descendant(:if).any? do |if_node|
|
||||
examples_in_branches?(if_node)
|
||||
body.each_descendant(:if, :case).any? do |condition_node|
|
||||
examples_in_branches?(condition_node)
|
||||
end
|
||||
end
|
||||
|
||||
def examples_in_branches?(if_node)
|
||||
if_node.branches.any? { |branch| examples?(branch) }
|
||||
def examples_in_branches?(condition_node)
|
||||
condition_node.branches.any? { |branch| examples?(branch) }
|
||||
end
|
||||
end
|
||||
end
|
||||
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