Merge pull request #14367 from Homebrew/dependabot/bundler/Library/Homebrew/rubocop-rspec-2.17.0
build(deps): bump rubocop-rspec from 2.16.0 to 2.17.0 in /Library/Homebrew
This commit is contained in:
commit
3e257890da
@ -151,7 +151,7 @@ GEM
|
|||||||
activesupport (>= 4.2.0)
|
activesupport (>= 4.2.0)
|
||||||
rack (>= 1.1)
|
rack (>= 1.1)
|
||||||
rubocop (>= 1.33.0, < 2.0)
|
rubocop (>= 1.33.0, < 2.0)
|
||||||
rubocop-rspec (2.16.0)
|
rubocop-rspec (2.17.0)
|
||||||
rubocop (~> 1.33)
|
rubocop (~> 1.33)
|
||||||
rubocop-sorbet (0.6.11)
|
rubocop-sorbet (0.6.11)
|
||||||
rubocop (>= 0.90.0)
|
rubocop (>= 0.90.0)
|
||||||
|
@ -173,6 +173,20 @@ end
|
|||||||
RuboCop::Cop::RSpec::Capybara::FeatureMethods::MAP = T.let(T.unsafe(nil), Hash)
|
RuboCop::Cop::RSpec::Capybara::FeatureMethods::MAP = T.let(T.unsafe(nil), Hash)
|
||||||
RuboCop::Cop::RSpec::Capybara::FeatureMethods::MSG = T.let(T.unsafe(nil), String)
|
RuboCop::Cop::RSpec::Capybara::FeatureMethods::MSG = T.let(T.unsafe(nil), String)
|
||||||
|
|
||||||
|
class RuboCop::Cop::RSpec::Capybara::MatchStyle < ::RuboCop::Cop::RSpec::Base
|
||||||
|
extend ::RuboCop::Cop::AutoCorrector
|
||||||
|
|
||||||
|
def on_send(node); end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def message(node); end
|
||||||
|
end
|
||||||
|
|
||||||
|
RuboCop::Cop::RSpec::Capybara::MatchStyle::MSG = T.let(T.unsafe(nil), String)
|
||||||
|
RuboCop::Cop::RSpec::Capybara::MatchStyle::PREFERRED_METHOD = T.let(T.unsafe(nil), Hash)
|
||||||
|
RuboCop::Cop::RSpec::Capybara::MatchStyle::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
||||||
|
|
||||||
class RuboCop::Cop::RSpec::Capybara::NegationMatcher < ::RuboCop::Cop::Base
|
class RuboCop::Cop::RSpec::Capybara::NegationMatcher < ::RuboCop::Cop::Base
|
||||||
include ::RuboCop::Cop::ConfigurableEnforcedStyle
|
include ::RuboCop::Cop::ConfigurableEnforcedStyle
|
||||||
extend ::RuboCop::Cop::AutoCorrector
|
extend ::RuboCop::Cop::AutoCorrector
|
||||||
@ -1465,12 +1479,11 @@ class RuboCop::Cop::RSpec::PendingWithoutReason < ::RuboCop::Cop::RSpec::Base
|
|||||||
def skipped_by_example_group_method?(param0 = T.unsafe(nil)); end
|
def skipped_by_example_group_method?(param0 = T.unsafe(nil)); end
|
||||||
def skipped_by_example_method?(param0 = T.unsafe(nil)); end
|
def skipped_by_example_method?(param0 = T.unsafe(nil)); end
|
||||||
def skipped_by_metadata_without_reason?(param0 = T.unsafe(nil)); end
|
def skipped_by_metadata_without_reason?(param0 = T.unsafe(nil)); end
|
||||||
|
def without_reason?(param0 = T.unsafe(nil)); end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def pending_by_pending_step_without_reason?(node); end
|
|
||||||
def pending_without_reason?(node); end
|
def pending_without_reason?(node); end
|
||||||
def skipped_by_skip_step_without_reason?(node); end
|
|
||||||
def skipped_without_reason?(node); end
|
def skipped_without_reason?(node); end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1582,6 +1595,21 @@ end
|
|||||||
|
|
||||||
RuboCop::Cop::RSpec::Rails::InferredSpecType::MSG = T.let(T.unsafe(nil), String)
|
RuboCop::Cop::RSpec::Rails::InferredSpecType::MSG = T.let(T.unsafe(nil), String)
|
||||||
|
|
||||||
|
class RuboCop::Cop::RSpec::Rails::MinitestAssertions < ::RuboCop::Cop::RSpec::Base
|
||||||
|
extend ::RuboCop::Cop::AutoCorrector
|
||||||
|
|
||||||
|
def minitest_assertion(param0 = T.unsafe(nil)); end
|
||||||
|
def on_send(node); end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def message(prefer); end
|
||||||
|
def replacement(node, expected, actual, failure_message); end
|
||||||
|
end
|
||||||
|
|
||||||
|
RuboCop::Cop::RSpec::Rails::MinitestAssertions::MSG = T.let(T.unsafe(nil), String)
|
||||||
|
RuboCop::Cop::RSpec::Rails::MinitestAssertions::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
||||||
|
|
||||||
class RuboCop::Cop::RSpec::ReceiveCounts < ::RuboCop::Cop::RSpec::Base
|
class RuboCop::Cop::RSpec::ReceiveCounts < ::RuboCop::Cop::RSpec::Base
|
||||||
extend ::RuboCop::Cop::AutoCorrector
|
extend ::RuboCop::Cop::AutoCorrector
|
||||||
|
|
@ -6755,6 +6755,7 @@ end
|
|||||||
|
|
||||||
module RuboCop::AST::NodePattern::Sets
|
module RuboCop::AST::NodePattern::Sets
|
||||||
SET_ARM_INTEL = ::T.let(nil, ::T.untyped)
|
SET_ARM_INTEL = ::T.let(nil, ::T.untyped)
|
||||||
|
SET_ASSERT_EQUAL_REFUTE_EQUAL = ::T.let(nil, ::T.untyped)
|
||||||
SET_BASH_COMPLETION_ZSH_COMPLETION_FISH_COMPLETION = ::T.let(nil, ::T.untyped)
|
SET_BASH_COMPLETION_ZSH_COMPLETION_FISH_COMPLETION = ::T.let(nil, ::T.untyped)
|
||||||
SET_BUILD_RECOMMENDED_TEST_OPTIONAL = ::T.let(nil, ::T.untyped)
|
SET_BUILD_RECOMMENDED_TEST_OPTIONAL = ::T.let(nil, ::T.untyped)
|
||||||
SET_DEPENDS_ON_USES_FROM_MACOS = ::T.let(nil, ::T.untyped)
|
SET_DEPENDS_ON_USES_FROM_MACOS = ::T.let(nil, ::T.untyped)
|
||||||
|
@ -107,7 +107,7 @@ $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version
|
|||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-1.43.0/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-1.43.0/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-performance-1.15.2/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-performance-1.15.2/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-rails-2.17.4/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-rails-2.17.4/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-rspec-2.16.0/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-rspec-2.17.0/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-sorbet-0.6.11/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-sorbet-0.6.11/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/ruby-macho-3.0.0/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/ruby-macho-3.0.0/lib")
|
||||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/simplecov-html-0.12.3/lib")
|
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/simplecov-html-0.12.3/lib")
|
||||||
|
@ -887,6 +887,12 @@ RSpec/Capybara/FeatureMethods:
|
|||||||
VersionChanged: '2.0'
|
VersionChanged: '2.0'
|
||||||
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/FeatureMethods
|
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/FeatureMethods
|
||||||
|
|
||||||
|
RSpec/Capybara/MatchStyle:
|
||||||
|
Description: Checks for usage of deprecated style methods.
|
||||||
|
Enabled: pending
|
||||||
|
VersionAdded: '2.17'
|
||||||
|
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/MatchStyle
|
||||||
|
|
||||||
RSpec/Capybara/NegationMatcher:
|
RSpec/Capybara/NegationMatcher:
|
||||||
Description: Enforces use of `have_no_*` or `not_to` for negated expectations.
|
Description: Enforces use of `have_no_*` or `not_to` for negated expectations.
|
||||||
Enabled: pending
|
Enabled: pending
|
||||||
@ -1044,3 +1050,9 @@ RSpec/Rails/InferredSpecType:
|
|||||||
routing: routing
|
routing: routing
|
||||||
system: system
|
system: system
|
||||||
views: view
|
views: view
|
||||||
|
|
||||||
|
RSpec/Rails/MinitestAssertions:
|
||||||
|
Description: Check if using Minitest matchers.
|
||||||
|
Enabled: pending
|
||||||
|
VersionAdded: '2.17'
|
||||||
|
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Rails/MinitestAssertions
|
@ -0,0 +1,60 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module RuboCop
|
||||||
|
module Cop
|
||||||
|
module RSpec
|
||||||
|
module Capybara
|
||||||
|
# Checks for usage of deprecated style methods.
|
||||||
|
#
|
||||||
|
# @example when using `assert_style`
|
||||||
|
# # bad
|
||||||
|
# page.find(:css, '#first').assert_style(display: 'block')
|
||||||
|
#
|
||||||
|
# # good
|
||||||
|
# page.find(:css, '#first').assert_matches_style(display: 'block')
|
||||||
|
#
|
||||||
|
# @example when using `has_style?`
|
||||||
|
# # bad
|
||||||
|
# expect(page.find(:css, 'first')
|
||||||
|
# .has_style?(display: 'block')).to be true
|
||||||
|
#
|
||||||
|
# # good
|
||||||
|
# expect(page.find(:css, 'first')
|
||||||
|
# .matches_style?(display: 'block')).to be true
|
||||||
|
#
|
||||||
|
# @example when using `have_style`
|
||||||
|
# # bad
|
||||||
|
# expect(page).to have_style(display: 'block')
|
||||||
|
#
|
||||||
|
# # good
|
||||||
|
# expect(page).to match_style(display: 'block')
|
||||||
|
#
|
||||||
|
class MatchStyle < Base
|
||||||
|
extend AutoCorrector
|
||||||
|
|
||||||
|
MSG = 'Use `%<good>s` instead of `%<bad>s`.'
|
||||||
|
RESTRICT_ON_SEND = %i[assert_style has_style? have_style].freeze
|
||||||
|
PREFERRED_METHOD = {
|
||||||
|
'assert_style' => 'assert_matches_style',
|
||||||
|
'has_style?' => 'matches_style?',
|
||||||
|
'have_style' => 'match_style'
|
||||||
|
}.freeze
|
||||||
|
|
||||||
|
def on_send(node)
|
||||||
|
method_node = node.loc.selector
|
||||||
|
add_offense(method_node) do |corrector|
|
||||||
|
corrector.replace(method_node,
|
||||||
|
PREFERRED_METHOD[method_node.source])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def message(node)
|
||||||
|
format(MSG, good: PREFERRED_METHOD[node.source], bad: node.source)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -10,7 +10,6 @@ module RuboCop
|
|||||||
# include `if`, `unless`, `for`, `before`, `after`, or `during`.
|
# include `if`, `unless`, `for`, `before`, `after`, or `during`.
|
||||||
# They may consist of multiple words if desired.
|
# They may consist of multiple words if desired.
|
||||||
#
|
#
|
||||||
# @see https://rspec.rubystyle.guide/#context-descriptions
|
|
||||||
# @see http://www.betterspecs.org/#contexts
|
# @see http://www.betterspecs.org/#contexts
|
||||||
#
|
#
|
||||||
# @example `Prefixes` configuration
|
# @example `Prefixes` configuration
|
@ -87,35 +87,33 @@ module RuboCop
|
|||||||
(send #rspec? {#ExampleGroups.all #Examples.all} ... {<(sym :skip) ...> (hash <(pair (sym :skip) true) ...>)})
|
(send #rspec? {#ExampleGroups.all #Examples.all} ... {<(sym :skip) ...> (hash <(pair (sym :skip) true) ...>)})
|
||||||
PATTERN
|
PATTERN
|
||||||
|
|
||||||
|
# @!method without_reason?(node)
|
||||||
|
def_node_matcher :without_reason?, <<~PATTERN
|
||||||
|
(send nil? ${:pending :skip})
|
||||||
|
PATTERN
|
||||||
|
|
||||||
def on_send(node)
|
def on_send(node)
|
||||||
if pending_without_reason?(node)
|
if pending_without_reason?(node)
|
||||||
add_offense(node, message: 'Give the reason for pending.')
|
add_offense(node, message: 'Give the reason for pending.')
|
||||||
elsif skipped_without_reason?(node)
|
elsif skipped_without_reason?(node)
|
||||||
add_offense(node, message: 'Give the reason for skip.')
|
add_offense(node, message: 'Give the reason for skip.')
|
||||||
|
elsif without_reason?(node) && example?(node.parent)
|
||||||
|
add_offense(node,
|
||||||
|
message: "Give the reason for #{node.method_name}.")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def pending_by_pending_step_without_reason?(node)
|
|
||||||
node.method?(:pending) && node.first_argument.nil?
|
|
||||||
end
|
|
||||||
|
|
||||||
def pending_without_reason?(node)
|
def pending_without_reason?(node)
|
||||||
pending_by_example_method?(node.block_node) ||
|
pending_by_example_method?(node.block_node) ||
|
||||||
pending_by_metadata_without_reason?(node) ||
|
pending_by_metadata_without_reason?(node)
|
||||||
pending_by_pending_step_without_reason?(node)
|
|
||||||
end
|
|
||||||
|
|
||||||
def skipped_by_skip_step_without_reason?(node)
|
|
||||||
node.method?(:skip) && node.first_argument.nil?
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def skipped_without_reason?(node)
|
def skipped_without_reason?(node)
|
||||||
skipped_by_example_group_method?(node.block_node) ||
|
skipped_by_example_group_method?(node.block_node) ||
|
||||||
skipped_by_example_method?(node.block_node) ||
|
skipped_by_example_method?(node.block_node) ||
|
||||||
skipped_by_metadata_without_reason?(node) ||
|
skipped_by_metadata_without_reason?(node)
|
||||||
skipped_by_skip_step_without_reason?(node)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
@ -179,7 +179,8 @@ module RuboCop
|
|||||||
|
|
||||||
return false if allowed_explicit_matchers.include?(name)
|
return false if allowed_explicit_matchers.include?(name)
|
||||||
|
|
||||||
name.start_with?('be_', 'have_') && !name.end_with?('?')
|
name.start_with?('be_', 'have_') && !name.end_with?('?') ||
|
||||||
|
%w[include respond_to].include?(name)
|
||||||
end
|
end
|
||||||
|
|
||||||
def message_explicit(matcher)
|
def message_explicit(matcher)
|
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