Merge pull request #13163 from Homebrew/dependabot/bundler/Library/Homebrew/rubocop-rspec-2.10.0

build(deps): bump rubocop-rspec from 2.9.0 to 2.10.0 in /Library/Homebrew
This commit is contained in:
Mike McQuaid 2022-04-21 15:33:54 +01:00 committed by GitHub
commit c1a9ce62aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
124 changed files with 260 additions and 94 deletions

View File

@ -141,7 +141,7 @@ GEM
activesupport (>= 4.2.0)
rack (>= 1.1)
rubocop (>= 1.7.0, < 2.0)
rubocop-rspec (2.9.0)
rubocop-rspec (2.10.0)
rubocop (~> 1.19)
rubocop-sorbet (0.6.7)
rubocop (>= 0.90.0)

View File

@ -6,39 +6,6 @@
module RuboCop; end
module RuboCop::Cop; end
module RuboCop::Cop::Layout; end
class RuboCop::Cop::Layout::ExtraSpacing < ::RuboCop::Cop::Base
include ::RuboCop::Cop::PrecedingFollowingAlignment
include ::RuboCop::Cop::RangeHelp
extend ::RuboCop::Cop::AutoCorrector
def on_new_investigation; end
private
def align_column(asgn_token); end
def align_equal_sign(corrector, token, align_to); end
def align_equal_signs(range, corrector); end
def aligned_locations(locs); end
def aligned_tok?(token); end
def all_relevant_assignment_lines(line_number); end
def allow_for_trailing_comments?; end
def check_assignment(token); end
def check_other(token1, token2, ast); end
def check_tokens(ast, token1, token2); end
def extra_space_range(token1, token2); end
def force_equal_sign_alignment?; end
def ignored_range?(ast, start_pos); end
def ignored_ranges(ast); end
class << self
def autocorrect_incompatible_with; end
end
end
RuboCop::Cop::Layout::ExtraSpacing::MSG_UNALIGNED_ASGN = T.let(T.unsafe(nil), String)
RuboCop::Cop::Layout::ExtraSpacing::MSG_UNNECESSARY = T.let(T.unsafe(nil), String)
module RuboCop::Cop::RSpec; end
class RuboCop::Cop::RSpec::AlignLeftLetBrace < ::RuboCop::Cop::RSpec::Base
@ -133,13 +100,21 @@ RuboCop::Cop::RSpec::BeEql::MSG = T.let(T.unsafe(nil), String)
RuboCop::Cop::RSpec::BeEql::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
class RuboCop::Cop::RSpec::BeNil < ::RuboCop::Cop::RSpec::Base
include ::RuboCop::Cop::ConfigurableEnforcedStyle
extend ::RuboCop::Cop::AutoCorrector
def be_nil_matcher?(param0 = T.unsafe(nil)); end
def nil_value_expectation?(param0 = T.unsafe(nil)); end
def on_send(node); end
private
def check_be_nil_style(node); end
def check_be_style(node); end
end
RuboCop::Cop::RSpec::BeNil::MSG = T.let(T.unsafe(nil), String)
RuboCop::Cop::RSpec::BeNil::BE_MSG = T.let(T.unsafe(nil), String)
RuboCop::Cop::RSpec::BeNil::BE_NIL_MSG = T.let(T.unsafe(nil), String)
RuboCop::Cop::RSpec::BeNil::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
class RuboCop::Cop::RSpec::BeforeAfterAll < ::RuboCop::Cop::RSpec::Base
@ -165,6 +140,10 @@ class RuboCop::Cop::RSpec::Capybara::CurrentPathExpectation < ::RuboCop::Cop::RS
def autocorrect(corrector, node); end
def convert_regexp_str_to_literal(corrector, matcher_node, regexp_str); end
def rewrite_expectation(corrector, node, to_symbol, matcher_node); end
class << self
def autocorrect_incompatible_with; end
end
end
RuboCop::Cop::RSpec::Capybara::CurrentPathExpectation::MSG = T.let(T.unsafe(nil), String)
@ -332,7 +311,7 @@ class RuboCop::Cop::RSpec::EmptyExampleGroup < ::RuboCop::Cop::RSpec::Base
private
def conditionals_with_examples?(body); end
def examples_in_branches?(if_node); end
def examples_in_branches?(condition_node); end
def offensive?(body); end
end
@ -1576,6 +1555,23 @@ end
RuboCop::Cop::RSpec::VariableName::MSG = T.let(T.unsafe(nil), String)
class RuboCop::Cop::RSpec::VerifiedDoubleReference < ::RuboCop::Cop::RSpec::Base
include ::RuboCop::Cop::ConfigurableEnforcedStyle
extend ::RuboCop::Cop::AutoCorrector
def on_send(node); end
def verified_double(param0 = T.unsafe(nil)); end
private
def correct_style(violation); end
def opposing_style?(class_reference); end
end
RuboCop::Cop::RSpec::VerifiedDoubleReference::MSG = T.let(T.unsafe(nil), String)
RuboCop::Cop::RSpec::VerifiedDoubleReference::REFERENCE_TYPE_STYLES = T.let(T.unsafe(nil), Hash)
RuboCop::Cop::RSpec::VerifiedDoubleReference::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Set)
class RuboCop::Cop::RSpec::VerifiedDoubles < ::RuboCop::Cop::RSpec::Base
def on_send(node); end
def unverified_double(param0 = T.unsafe(nil)); end

View File

@ -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"

View File

@ -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

View File

@ -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
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
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)

View File

@ -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

View File

@ -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|

View File

@ -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