brew vendor-gems: commit updates.

This commit is contained in:
BrewTestBot 2021-02-03 09:06:34 +00:00
parent c15d625d32
commit 023999a103
111 changed files with 83 additions and 31 deletions

View File

@ -84,7 +84,7 @@ $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/unicode-display_width
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-1.9.1/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-1.9.1/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-performance-1.9.2/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-performance-1.9.2/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rails-2.9.1/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rails-2.9.1/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rspec-2.1.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rspec-2.2.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-sorbet-0.5.1/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-sorbet-0.5.1/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ruby-macho-2.5.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ruby-macho-2.5.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/sorbet-runtime-stub-0.2.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/sorbet-runtime-stub-0.2.0/lib"

View File

@ -1,5 +1,6 @@
--- ---
RSpec: RSpec:
Enabled: true
Include: Include:
- "**/*_spec.rb" - "**/*_spec.rb"
- "**/spec/**/*" - "**/spec/**/*"

View File

@ -15,6 +15,7 @@ require_relative 'rubocop/rspec/language'
require_relative 'rubocop/cop/rspec/mixin/top_level_group' require_relative 'rubocop/cop/rspec/mixin/top_level_group'
require_relative 'rubocop/cop/rspec/mixin/variable' require_relative 'rubocop/cop/rspec/mixin/variable'
require_relative 'rubocop/cop/rspec/mixin/final_end_location' require_relative 'rubocop/cop/rspec/mixin/final_end_location'
require_relative 'rubocop/cop/rspec/mixin/comments_help'
require_relative 'rubocop/cop/rspec/mixin/empty_line_separation' require_relative 'rubocop/cop/rspec/mixin/empty_line_separation'
require_relative 'rubocop/rspec/concept' require_relative 'rubocop/rspec/concept'

View File

@ -24,18 +24,14 @@ module RuboCop
# end # end
class AnyInstance < Base class AnyInstance < Base
MSG = 'Avoid stubbing using `%<method>s`.' MSG = 'Avoid stubbing using `%<method>s`.'
RESTRICT_ON_SEND = %i[
def_node_matcher :disallowed_stub, <<-PATTERN any_instance
(send _ ${:any_instance :allow_any_instance_of :expect_any_instance_of} ...) allow_any_instance_of
PATTERN expect_any_instance_of
].freeze
def on_send(node) def on_send(node)
disallowed_stub(node) do |method| add_offense(node, message: format(MSG, method: node.method_name))
add_offense(
node,
message: format(MSG, method: method)
)
end
end end
end end
end end

View File

@ -39,6 +39,7 @@ module RuboCop
extend AutoCorrector extend AutoCorrector
MSG = 'Prefer `be` over `eql`.' MSG = 'Prefer `be` over `eql`.'
RESTRICT_ON_SEND = %i[to].freeze
def_node_matcher :eql_type_with_identity, <<-PATTERN def_node_matcher :eql_type_with_identity, <<-PATTERN
(send _ :to $(send nil? :eql {true false int float sym nil_type?})) (send _ :to $(send nil? :eql {true false int float sym nil_type?}))

View File

@ -29,6 +29,8 @@ module RuboCop
'`use_transactional_fixtures` is enabled, then records created ' \ '`use_transactional_fixtures` is enabled, then records created ' \
'in `%<hook>s` are not automatically rolled back.' 'in `%<hook>s` are not automatically rolled back.'
RESTRICT_ON_SEND = %i[before after].freeze
def_node_matcher :before_or_after_all, <<-PATTERN def_node_matcher :before_or_after_all, <<-PATTERN
$(send _ {:before :after} (sym {:all :context})) $(send _ {:before :after} (sym {:all :context}))
PATTERN PATTERN

View File

@ -30,6 +30,8 @@ module RuboCop
'Capybara feature specs - instead, use the ' \ 'Capybara feature specs - instead, use the ' \
'`have_current_path` matcher on `page`' '`have_current_path` matcher on `page`'
RESTRICT_ON_SEND = %i[expect].freeze
def_node_matcher :expectation_set_on_current_path, <<-PATTERN def_node_matcher :expectation_set_on_current_path, <<-PATTERN
(send nil? :expect (send {(send nil? :page) nil?} :current_path)) (send nil? :expect (send {(send nil? :page) nil?} :current_path))
PATTERN PATTERN

View File

@ -44,6 +44,8 @@ module RuboCop
have_content have_content
].freeze ].freeze
RESTRICT_ON_SEND = CAPYBARA_MATCHER_METHODS
def_node_matcher :visible_true?, <<~PATTERN def_node_matcher :visible_true?, <<~PATTERN
(send nil? #capybara_matcher? ... (hash <$(pair (sym :visible) true) ...>)) (send nil? #capybara_matcher? ... (hash <$(pair (sym :visible) true) ...>))
PATTERN PATTERN

View File

@ -19,6 +19,7 @@ module RuboCop
# @see https://github.com/rspec/rspec-core/issues/1610 # @see https://github.com/rspec/rspec-core/issues/1610
class DescribeSymbol < Base class DescribeSymbol < Base
MSG = 'Avoid describing symbols.' MSG = 'Avoid describing symbols.'
RESTRICT_ON_SEND = %i[describe].freeze
def_node_matcher :describe_symbol?, <<-PATTERN def_node_matcher :describe_symbol?, <<-PATTERN
(send #rspec? :describe $sym ...) (send #rspec? :describe $sym ...)

View File

@ -35,6 +35,7 @@ module RuboCop
MSG_BLOCK = 'Prefer `change(%<obj>s, :%<attr>s)`.' MSG_BLOCK = 'Prefer `change(%<obj>s, :%<attr>s)`.'
MSG_CALL = 'Prefer `change { %<obj>s.%<attr>s }`.' MSG_CALL = 'Prefer `change { %<obj>s.%<attr>s }`.'
RESTRICT_ON_SEND = %i[change].freeze
def_node_matcher :expect_change_with_arguments, <<-PATTERN def_node_matcher :expect_change_with_arguments, <<-PATTERN
(send nil? :change ({const send} nil? $_) (sym $_)) (send nil? :change ({const send} nil? $_) (sym $_))

View File

@ -30,6 +30,7 @@ module RuboCop
MSG_CREATE_LIST = 'Prefer create_list.' MSG_CREATE_LIST = 'Prefer create_list.'
MSG_N_TIMES = 'Prefer %<number>s.times.' MSG_N_TIMES = 'Prefer %<number>s.times.'
RESTRICT_ON_SEND = %i[create_list].freeze
def_node_matcher :n_times_block_without_arg?, <<-PATTERN def_node_matcher :n_times_block_without_arg?, <<-PATTERN
(block (block

View File

@ -25,6 +25,7 @@ module RuboCop
MSG = "Pass '%<class_name>s' string instead of `%<class_name>s` " \ MSG = "Pass '%<class_name>s' string instead of `%<class_name>s` " \
'constant.' 'constant.'
ALLOWED_CONSTANTS = %w[Hash OpenStruct].freeze ALLOWED_CONSTANTS = %w[Hash OpenStruct].freeze
RESTRICT_ON_SEND = %i[factory].freeze
def_node_matcher :class_name, <<~PATTERN def_node_matcher :class_name, <<~PATTERN
(send _ :factory _ (hash <(pair (sym :class) $(const ...)) ...>)) (send _ :factory _ (hash <(pair (sym :class) $(const ...)) ...>))

View File

@ -18,6 +18,7 @@ module RuboCop
# end # end
class ImplicitBlockExpectation < Base class ImplicitBlockExpectation < Base
MSG = 'Avoid implicit block expectations.' MSG = 'Avoid implicit block expectations.'
RESTRICT_ON_SEND = %i[is_expected should should_not].freeze
def_node_matcher :lambda?, <<-PATTERN def_node_matcher :lambda?, <<-PATTERN
{ {

View File

@ -31,6 +31,7 @@ module RuboCop
include ConfigurableEnforcedStyle include ConfigurableEnforcedStyle
MSG = "Don't use implicit subject." MSG = "Don't use implicit subject."
RESTRICT_ON_SEND = %i[is_expected should should_not].freeze
def_node_matcher :implicit_subject?, <<-PATTERN def_node_matcher :implicit_subject?, <<-PATTERN
(send nil? {:should :should_not :is_expected} ...) (send nil? {:should :should_not :is_expected} ...)

View File

@ -24,6 +24,7 @@ module RuboCop
MSG = 'Prefer `%<replacement>s` over `%<original>s` when including ' \ MSG = 'Prefer `%<replacement>s` over `%<original>s` when including ' \
'examples in a nested context.' 'examples in a nested context.'
RESTRICT_ON_SEND = %i[it_behaves_like it_should_behave_like].freeze
def_node_matcher :example_inclusion_offense, '(send _ % ...)' def_node_matcher :example_inclusion_offense, '(send _ % ...)'

View File

@ -15,18 +15,12 @@ module RuboCop
# #
class MessageChain < Base class MessageChain < Base
MSG = 'Avoid stubbing using `%<method>s`.' MSG = 'Avoid stubbing using `%<method>s`.'
RESTRICT_ON_SEND = %i[receive_message_chain stub_chain].freeze
def_node_matcher :message_chain, <<-PATTERN
(send _ {:receive_message_chain :stub_chain} ...)
PATTERN
def on_send(node) def on_send(node)
message_chain(node) do add_offense(
add_offense( node.loc.selector, message: format(MSG, method: node.method_name)
node.loc.selector, )
message: format(MSG, method: node.method_name)
)
end
end end
end end
end end

View File

@ -30,6 +30,7 @@ module RuboCop
MSG = 'Prefer `%<style>s` for setting message expectations.' MSG = 'Prefer `%<style>s` for setting message expectations.'
SUPPORTED_STYLES = %w[allow expect].freeze SUPPORTED_STYLES = %w[allow expect].freeze
RESTRICT_ON_SEND = %i[to].freeze
def_node_matcher :message_expectation, <<-PATTERN def_node_matcher :message_expectation, <<-PATTERN
(send $(send nil? {:expect :allow} ...) :to #receive_message?) (send $(send nil? {:expect :allow} ...) :to #receive_message?)

View File

@ -0,0 +1,38 @@
# frozen_string_literal: true
module RuboCop
module Cop
module RSpec
# Help methods for working with nodes containing comments.
module CommentsHelp
include FinalEndLocation
def source_range_with_comment(node)
begin_pos = begin_pos_with_comment(node).begin_pos
end_pos = end_line_position(node).end_pos
Parser::Source::Range.new(buffer, begin_pos, end_pos)
end
def begin_pos_with_comment(node)
first_comment = processed_source.ast_with_comments[node].first
start_line_position(first_comment || node)
end
def start_line_position(node)
buffer.line_range(node.loc.line)
end
def end_line_position(node)
end_line = buffer.line_for_position(final_end_location(node).end_pos)
buffer.line_range(end_line)
end
def buffer
processed_source.buffer
end
end
end
end
end

View File

@ -20,6 +20,7 @@ module RuboCop
include ConfigurableEnforcedStyle include ConfigurableEnforcedStyle
MSG = 'Prefer `%<replacement>s` over `%<original>s`.' MSG = 'Prefer `%<replacement>s` over `%<original>s`.'
RESTRICT_ON_SEND = %i[not_to to_not].freeze
def_node_matcher :not_to_not_offense, '(send _ % ...)' def_node_matcher :not_to_not_offense, '(send _ % ...)'

View File

@ -33,6 +33,7 @@ module RuboCop
class HttpStatus < Base class HttpStatus < Base
extend AutoCorrector extend AutoCorrector
include ConfigurableEnforcedStyle include ConfigurableEnforcedStyle
RESTRICT_ON_SEND = %i[have_http_status].freeze
def_node_matcher :http_status, <<-PATTERN def_node_matcher :http_status, <<-PATTERN
(send nil? :have_http_status ${int sym}) (send nil? :have_http_status ${int sym})

View File

@ -28,6 +28,8 @@ module RuboCop
MSG = 'Use `%<alternative>s` instead of `%<original>s`.' MSG = 'Use `%<alternative>s` instead of `%<original>s`.'
RESTRICT_ON_SEND = %i[times].freeze
def_node_matcher :receive_counts, <<-PATTERN def_node_matcher :receive_counts, <<-PATTERN
(send $(send _ {:exactly :at_least :at_most} (int {1 2})) :times) (send $(send _ {:exactly :at_least :at_most} (int {1 2})) :times)
PATTERN PATTERN

View File

@ -16,6 +16,7 @@ module RuboCop
class ReceiveNever < Base class ReceiveNever < Base
extend AutoCorrector extend AutoCorrector
MSG = 'Use `not_to receive` instead of `never`.' MSG = 'Use `not_to receive` instead of `never`.'
RESTRICT_ON_SEND = %i[never].freeze
def_node_search :method_on_stub?, '(send nil? :receive ...)' def_node_search :method_on_stub?, '(send nil? :receive ...)'

View File

@ -39,6 +39,7 @@ module RuboCop
MSG_AND_RETURN = 'Use `and_return` for static values.' MSG_AND_RETURN = 'Use `and_return` for static values.'
MSG_BLOCK = 'Use block for static values.' MSG_BLOCK = 'Use block for static values.'
RESTRICT_ON_SEND = %i[and_return].freeze
def_node_search :contains_stub?, '(send nil? :receive (...))' def_node_search :contains_stub?, '(send nil? :receive (...))'
def_node_matcher :stub_with_block?, '(block #contains_stub? ...)' def_node_matcher :stub_with_block?, '(block #contains_stub? ...)'

View File

@ -21,6 +21,7 @@ module RuboCop
MSG = 'Use `%<recommended>s` instead of calling ' \ MSG = 'Use `%<recommended>s` instead of calling ' \
'`%<called>s` with a single argument.' '`%<called>s` with a single argument.'
RESTRICT_ON_SEND = %i[receive_message_chain stub_chain].freeze
def_node_matcher :message_chain, <<-PATTERN def_node_matcher :message_chain, <<-PATTERN
(send _ {:receive_message_chain :stub_chain} $_) (send _ {:receive_message_chain :stub_chain} $_)

View File

@ -32,6 +32,7 @@ module RuboCop
# expect { do_something }.not_to raise_error # expect { do_something }.not_to raise_error
class UnspecifiedException < Base class UnspecifiedException < Base
MSG = 'Specify the exception being captured' MSG = 'Specify the exception being captured'
RESTRICT_ON_SEND = %i[to].freeze
def_node_matcher :empty_raise_error_or_exception, <<-PATTERN def_node_matcher :empty_raise_error_or_exception, <<-PATTERN
(send (send

View File

@ -24,6 +24,7 @@ module RuboCop
# end # end
class VerifiedDoubles < Base class VerifiedDoubles < Base
MSG = 'Prefer using verifying doubles over normal doubles.' MSG = 'Prefer using verifying doubles over normal doubles.'
RESTRICT_ON_SEND = %i[double spy].freeze
def_node_matcher :unverified_double, <<-PATTERN def_node_matcher :unverified_double, <<-PATTERN
{(send nil? {:double :spy} $...)} {(send nil? {:double :spy} $...)}

View File

@ -14,6 +14,7 @@ module RuboCop
class VoidExpect < Base class VoidExpect < Base
MSG = 'Do not use `expect()` without `.to` or `.not_to`. ' \ MSG = 'Do not use `expect()` without `.to` or `.not_to`. ' \
'Chain the methods or remove it.' 'Chain the methods or remove it.'
RESTRICT_ON_SEND = %i[expect].freeze
def_node_matcher :expect?, <<-PATTERN def_node_matcher :expect?, <<-PATTERN
(send nil? :expect ...) (send nil? :expect ...)

View File

@ -6,6 +6,7 @@ module RuboCop
# Helper methods to move a node # Helper methods to move a node
class MoveNode class MoveNode
include RuboCop::Cop::RangeHelp include RuboCop::Cop::RangeHelp
include RuboCop::Cop::RSpec::CommentsHelp
include RuboCop::Cop::RSpec::FinalEndLocation include RuboCop::Cop::RSpec::FinalEndLocation
attr_reader :original, :corrector, :processed_source attr_reader :original, :corrector, :processed_source
@ -17,20 +18,16 @@ module RuboCop
end end
def move_before(other) def move_before(other)
position = other.loc.expression position = start_line_position(other)
indent = ' ' * other.loc.column
newline_indent = "\n#{indent}"
corrector.insert_before(position, source(original) + newline_indent) corrector.insert_before(position, "#{source(original)}\n")
corrector.remove(node_range_with_surrounding_space(original)) corrector.remove(node_range_with_surrounding_space(original))
end end
def move_after(other) def move_after(other)
position = final_end_location(other) position = end_line_position(other)
indent = ' ' * other.loc.column
newline_indent = "\n#{indent}"
corrector.insert_after(position, newline_indent + source(original)) corrector.insert_after(position, "\n#{source(original)}")
corrector.remove(node_range_with_surrounding_space(original)) corrector.remove(node_range_with_surrounding_space(original))
end end
@ -41,7 +38,7 @@ module RuboCop
end end
def node_range(node) def node_range(node)
node.loc.expression.with(end_pos: final_end_location(node).end_pos) source_range_with_comment(node)
end end
def node_range_with_surrounding_space(node) def node_range_with_surrounding_space(node)

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