Merge pull request #14248 from Homebrew/dependabot/bundler/Library/Homebrew/rubocop-rspec-2.16.0
build(deps): bump rubocop-rspec from 2.15.0 to 2.16.0 in /Library/Homebrew
This commit is contained in:
commit
85db0abf18
@ -37,3 +37,10 @@ RSpec/MultipleMemoizedHelpers:
|
||||
# Annoying to have these autoremoved.
|
||||
RSpec/Focus:
|
||||
AutoCorrect: false
|
||||
|
||||
# Gets confused on these tests for a `skip` DSL
|
||||
RSpec/PendingWithoutReason:
|
||||
Exclude:
|
||||
- "**/dependency_expansion_spec.rb"
|
||||
- "**/livecheck/skip_conditions_spec.rb"
|
||||
- "**/livecheck_spec.rb"
|
||||
|
||||
@ -151,7 +151,7 @@ GEM
|
||||
activesupport (>= 4.2.0)
|
||||
rack (>= 1.1)
|
||||
rubocop (>= 1.33.0, < 2.0)
|
||||
rubocop-rspec (2.15.0)
|
||||
rubocop-rspec (2.16.0)
|
||||
rubocop (~> 1.33)
|
||||
rubocop-sorbet (0.6.11)
|
||||
rubocop (>= 0.90.0)
|
||||
|
||||
@ -83,6 +83,7 @@ class RuboCop::Cop::RSpec::Be < ::RuboCop::Cop::RSpec::Base
|
||||
end
|
||||
|
||||
RuboCop::Cop::RSpec::Be::MSG = T.let(T.unsafe(nil), String)
|
||||
RuboCop::Cop::RSpec::Be::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
||||
|
||||
class RuboCop::Cop::RSpec::BeEq < ::RuboCop::Cop::RSpec::Base
|
||||
extend ::RuboCop::Cop::AutoCorrector
|
||||
@ -131,7 +132,7 @@ RuboCop::Cop::RSpec::BeforeAfterAll::MSG = T.let(T.unsafe(nil), String)
|
||||
RuboCop::Cop::RSpec::BeforeAfterAll::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
||||
module RuboCop::Cop::RSpec::Capybara; end
|
||||
|
||||
class RuboCop::Cop::RSpec::Capybara::CurrentPathExpectation < ::RuboCop::Cop::RSpec::Base
|
||||
class RuboCop::Cop::RSpec::Capybara::CurrentPathExpectation < ::RuboCop::Cop::Base
|
||||
extend ::RuboCop::Cop::AutoCorrector
|
||||
|
||||
def as_is_matcher(param0 = T.unsafe(nil)); end
|
||||
@ -172,7 +173,7 @@ end
|
||||
RuboCop::Cop::RSpec::Capybara::FeatureMethods::MAP = T.let(T.unsafe(nil), Hash)
|
||||
RuboCop::Cop::RSpec::Capybara::FeatureMethods::MSG = T.let(T.unsafe(nil), String)
|
||||
|
||||
class RuboCop::Cop::RSpec::Capybara::NegationMatcher < ::RuboCop::Cop::RSpec::Base
|
||||
class RuboCop::Cop::RSpec::Capybara::NegationMatcher < ::RuboCop::Cop::Base
|
||||
include ::RuboCop::Cop::ConfigurableEnforcedStyle
|
||||
extend ::RuboCop::Cop::AutoCorrector
|
||||
|
||||
@ -195,7 +196,7 @@ RuboCop::Cop::RSpec::Capybara::NegationMatcher::NEGATIVE_MATCHERS = T.let(T.unsa
|
||||
RuboCop::Cop::RSpec::Capybara::NegationMatcher::POSITIVE_MATCHERS = T.let(T.unsafe(nil), Set)
|
||||
RuboCop::Cop::RSpec::Capybara::NegationMatcher::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Set)
|
||||
|
||||
class RuboCop::Cop::RSpec::Capybara::SpecificActions < ::RuboCop::Cop::RSpec::Base
|
||||
class RuboCop::Cop::RSpec::Capybara::SpecificActions < ::RuboCop::Cop::Base
|
||||
def click_on_selector(param0 = T.unsafe(nil)); end
|
||||
def on_send(node); end
|
||||
|
||||
@ -213,7 +214,7 @@ RuboCop::Cop::RSpec::Capybara::SpecificActions::MSG = T.let(T.unsafe(nil), Strin
|
||||
RuboCop::Cop::RSpec::Capybara::SpecificActions::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
||||
RuboCop::Cop::RSpec::Capybara::SpecificActions::SPECIFIC_ACTION = T.let(T.unsafe(nil), Hash)
|
||||
|
||||
class RuboCop::Cop::RSpec::Capybara::SpecificFinders < ::RuboCop::Cop::RSpec::Base
|
||||
class RuboCop::Cop::RSpec::Capybara::SpecificFinders < ::RuboCop::Cop::Base
|
||||
include ::RuboCop::Cop::RangeHelp
|
||||
extend ::RuboCop::Cop::AutoCorrector
|
||||
|
||||
@ -235,9 +236,7 @@ end
|
||||
RuboCop::Cop::RSpec::Capybara::SpecificFinders::MSG = T.let(T.unsafe(nil), String)
|
||||
RuboCop::Cop::RSpec::Capybara::SpecificFinders::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
||||
|
||||
class RuboCop::Cop::RSpec::Capybara::SpecificMatcher < ::RuboCop::Cop::RSpec::Base
|
||||
include ::RuboCop::Cop::RSpec::CapybaraHelp
|
||||
|
||||
class RuboCop::Cop::RSpec::Capybara::SpecificMatcher < ::RuboCop::Cop::Base
|
||||
def first_argument(param0 = T.unsafe(nil)); end
|
||||
def on_send(node); end
|
||||
|
||||
@ -252,7 +251,7 @@ RuboCop::Cop::RSpec::Capybara::SpecificMatcher::MSG = T.let(T.unsafe(nil), Strin
|
||||
RuboCop::Cop::RSpec::Capybara::SpecificMatcher::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
||||
RuboCop::Cop::RSpec::Capybara::SpecificMatcher::SPECIFIC_MATCHER = T.let(T.unsafe(nil), Hash)
|
||||
|
||||
class RuboCop::Cop::RSpec::Capybara::VisibilityMatcher < ::RuboCop::Cop::RSpec::Base
|
||||
class RuboCop::Cop::RSpec::Capybara::VisibilityMatcher < ::RuboCop::Cop::Base
|
||||
def on_send(node); end
|
||||
def visible_false?(param0 = T.unsafe(nil)); end
|
||||
def visible_true?(param0 = T.unsafe(nil)); end
|
||||
@ -484,6 +483,22 @@ end
|
||||
|
||||
RuboCop::Cop::RSpec::Dialect::MSG = T.let(T.unsafe(nil), String)
|
||||
|
||||
class RuboCop::Cop::RSpec::DuplicatedMetadata < ::RuboCop::Cop::RSpec::Base
|
||||
include ::RuboCop::Cop::RSpec::Metadata
|
||||
include ::RuboCop::Cop::RangeHelp
|
||||
extend ::RuboCop::Cop::AutoCorrector
|
||||
|
||||
def on_metadata(symbols, _pairs); end
|
||||
|
||||
private
|
||||
|
||||
def autocorrect(corrector, node); end
|
||||
def duplicated?(node); end
|
||||
def on_metadata_symbol(node); end
|
||||
end
|
||||
|
||||
RuboCop::Cop::RSpec::DuplicatedMetadata::MSG = T.let(T.unsafe(nil), String)
|
||||
|
||||
class RuboCop::Cop::RSpec::EmptyExampleGroup < ::RuboCop::Cop::RSpec::Base
|
||||
include ::RuboCop::Cop::RangeHelp
|
||||
extend ::RuboCop::Cop::AutoCorrector
|
||||
@ -521,11 +536,14 @@ class RuboCop::Cop::RSpec::EmptyLineAfterExample < ::RuboCop::Cop::RSpec::Base
|
||||
include ::RuboCop::Cop::RSpec::EmptyLineSeparation
|
||||
extend ::RuboCop::Cop::AutoCorrector
|
||||
|
||||
def on_block(node); end
|
||||
|
||||
private
|
||||
|
||||
def allow_consecutive_one_liners?; end
|
||||
def allowed_one_liner?(node); end
|
||||
def consecutive_one_liner?(node); end
|
||||
def next_one_line_example?(node); end
|
||||
def on_block(node); end
|
||||
end
|
||||
|
||||
RuboCop::Cop::RSpec::EmptyLineAfterExample::MSG = T.let(T.unsafe(nil), String)
|
||||
@ -676,6 +694,7 @@ end
|
||||
|
||||
RuboCop::Cop::RSpec::ExpectActual::COMPLEX_LITERALS = T.let(T.unsafe(nil), Array)
|
||||
RuboCop::Cop::RSpec::ExpectActual::MSG = T.let(T.unsafe(nil), String)
|
||||
RuboCop::Cop::RSpec::ExpectActual::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
||||
RuboCop::Cop::RSpec::ExpectActual::SIMPLE_LITERALS = T.let(T.unsafe(nil), Array)
|
||||
RuboCop::Cop::RSpec::ExpectActual::SUPPORTED_MATCHERS = T.let(T.unsafe(nil), Array)
|
||||
|
||||
@ -738,7 +757,7 @@ RuboCop::Cop::RSpec::ExplicitHelper::BUILT_IN_MATCHERS = T.let(T.unsafe(nil), Ar
|
||||
RuboCop::Cop::RSpec::ExplicitHelper::MSG_EXPLICIT = T.let(T.unsafe(nil), String)
|
||||
module RuboCop::Cop::RSpec::FactoryBot; end
|
||||
|
||||
class RuboCop::Cop::RSpec::FactoryBot::AttributeDefinedStatically < ::RuboCop::Cop::RSpec::Base
|
||||
class RuboCop::Cop::RSpec::FactoryBot::AttributeDefinedStatically < ::RuboCop::Cop::Base
|
||||
extend ::RuboCop::Cop::AutoCorrector
|
||||
|
||||
def association?(param0 = T.unsafe(nil)); end
|
||||
@ -762,19 +781,19 @@ end
|
||||
|
||||
RuboCop::Cop::RSpec::FactoryBot::AttributeDefinedStatically::MSG = T.let(T.unsafe(nil), String)
|
||||
|
||||
class RuboCop::Cop::RSpec::FactoryBot::ConsistentParenthesesStyle < ::RuboCop::Cop::RSpec::Base
|
||||
class RuboCop::Cop::RSpec::FactoryBot::ConsistentParenthesesStyle < ::RuboCop::Cop::Base
|
||||
include ::RuboCop::Cop::ConfigurableEnforcedStyle
|
||||
include ::RuboCop::RSpec::FactoryBot::Language
|
||||
extend ::RuboCop::Cop::AutoCorrector
|
||||
|
||||
def ambiguous_without_parentheses?(node); end
|
||||
def factory_call(param0 = T.unsafe(nil)); end
|
||||
def on_send(node); end
|
||||
def process_with_parentheses(node); end
|
||||
def process_without_parentheses(node); end
|
||||
|
||||
private
|
||||
|
||||
def ambiguous_without_parentheses?(node); end
|
||||
def process_with_parentheses(node); end
|
||||
def process_without_parentheses(node); end
|
||||
def remove_parentheses(corrector, node); end
|
||||
|
||||
class << self
|
||||
@ -787,7 +806,7 @@ RuboCop::Cop::RSpec::FactoryBot::ConsistentParenthesesStyle::MSG_OMIT_PARENS = T
|
||||
RuboCop::Cop::RSpec::FactoryBot::ConsistentParenthesesStyle::MSG_REQUIRE_PARENS = T.let(T.unsafe(nil), String)
|
||||
RuboCop::Cop::RSpec::FactoryBot::ConsistentParenthesesStyle::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Set)
|
||||
|
||||
class RuboCop::Cop::RSpec::FactoryBot::CreateList < ::RuboCop::Cop::RSpec::Base
|
||||
class RuboCop::Cop::RSpec::FactoryBot::CreateList < ::RuboCop::Cop::Base
|
||||
include ::RuboCop::Cop::ConfigurableEnforcedStyle
|
||||
include ::RuboCop::RSpec::FactoryBot::Language
|
||||
extend ::RuboCop::Cop::AutoCorrector
|
||||
@ -845,11 +864,12 @@ class RuboCop::Cop::RSpec::FactoryBot::CreateList::TimesCorrector
|
||||
|
||||
private
|
||||
|
||||
def factory_call_block_source; end
|
||||
def generate_n_times_block(node); end
|
||||
def node; end
|
||||
end
|
||||
|
||||
class RuboCop::Cop::RSpec::FactoryBot::FactoryClassName < ::RuboCop::Cop::RSpec::Base
|
||||
class RuboCop::Cop::RSpec::FactoryBot::FactoryClassName < ::RuboCop::Cop::Base
|
||||
extend ::RuboCop::Cop::AutoCorrector
|
||||
|
||||
def class_name(param0 = T.unsafe(nil)); end
|
||||
@ -864,6 +884,25 @@ RuboCop::Cop::RSpec::FactoryBot::FactoryClassName::ALLOWED_CONSTANTS = T.let(T.u
|
||||
RuboCop::Cop::RSpec::FactoryBot::FactoryClassName::MSG = T.let(T.unsafe(nil), String)
|
||||
RuboCop::Cop::RSpec::FactoryBot::FactoryClassName::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
||||
|
||||
class RuboCop::Cop::RSpec::FactoryBot::FactoryNameStyle < ::RuboCop::Cop::Base
|
||||
include ::RuboCop::Cop::ConfigurableEnforcedStyle
|
||||
include ::RuboCop::RSpec::FactoryBot::Language
|
||||
extend ::RuboCop::Cop::AutoCorrector
|
||||
|
||||
def factory_call(param0 = T.unsafe(nil)); end
|
||||
def on_send(node); end
|
||||
|
||||
private
|
||||
|
||||
def offense_for_string_style?(name); end
|
||||
def offense_for_symbol_style?(name); end
|
||||
def register_offense(name, prefer); end
|
||||
end
|
||||
|
||||
RuboCop::Cop::RSpec::FactoryBot::FactoryNameStyle::FACTORY_CALLS = T.let(T.unsafe(nil), Set)
|
||||
RuboCop::Cop::RSpec::FactoryBot::FactoryNameStyle::MSG = T.let(T.unsafe(nil), String)
|
||||
RuboCop::Cop::RSpec::FactoryBot::FactoryNameStyle::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Set)
|
||||
|
||||
class RuboCop::Cop::RSpec::FactoryBot::SyntaxMethods < ::RuboCop::Cop::RSpec::Base
|
||||
include ::RuboCop::Cop::RSpec::InsideExampleGroup
|
||||
include ::RuboCop::Cop::RangeHelp
|
||||
@ -1010,6 +1049,7 @@ end
|
||||
|
||||
RuboCop::Cop::RSpec::ImplicitExpect::ENFORCED_REPLACEMENTS = T.let(T.unsafe(nil), Hash)
|
||||
RuboCop::Cop::RSpec::ImplicitExpect::MSG = T.let(T.unsafe(nil), String)
|
||||
RuboCop::Cop::RSpec::ImplicitExpect::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
||||
|
||||
class RuboCop::Cop::RSpec::ImplicitSubject < ::RuboCop::Cop::RSpec::Base
|
||||
include ::RuboCop::Cop::ConfigurableEnforcedStyle
|
||||
@ -1132,12 +1172,12 @@ class RuboCop::Cop::RSpec::LeadingSubject < ::RuboCop::Cop::RSpec::Base
|
||||
include ::RuboCop::Cop::RSpec::InsideExampleGroup
|
||||
extend ::RuboCop::Cop::AutoCorrector
|
||||
|
||||
def check_previous_nodes(node); end
|
||||
def on_block(node); end
|
||||
|
||||
private
|
||||
|
||||
def autocorrect(corrector, node, sibling); end
|
||||
def check_previous_nodes(node); end
|
||||
def offending?(node); end
|
||||
def offending_node(node); end
|
||||
def parent(node); end
|
||||
@ -1230,8 +1270,21 @@ end
|
||||
|
||||
RuboCop::Cop::RSpec::MessageSpies::MSG_HAVE_RECEIVED = T.let(T.unsafe(nil), String)
|
||||
RuboCop::Cop::RSpec::MessageSpies::MSG_RECEIVE = T.let(T.unsafe(nil), String)
|
||||
RuboCop::Cop::RSpec::MessageSpies::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
||||
RuboCop::Cop::RSpec::MessageSpies::SUPPORTED_STYLES = T.let(T.unsafe(nil), Array)
|
||||
|
||||
module RuboCop::Cop::RSpec::Metadata
|
||||
include ::RuboCop::RSpec::Language
|
||||
extend ::RuboCop::AST::NodePattern::Macros
|
||||
|
||||
def metadata_in_block(param0, param1); end
|
||||
def on_block(node); end
|
||||
def on_metadata(_symbols, _pairs); end
|
||||
def on_numblock(node); end
|
||||
def rspec_configure(param0 = T.unsafe(nil)); end
|
||||
def rspec_metadata(param0 = T.unsafe(nil)); end
|
||||
end
|
||||
|
||||
class RuboCop::Cop::RSpec::MissingExampleGroupArgument < ::RuboCop::Cop::RSpec::Base
|
||||
def on_block(node); end
|
||||
end
|
||||
@ -1405,6 +1458,24 @@ end
|
||||
|
||||
RuboCop::Cop::RSpec::Pending::MSG = T.let(T.unsafe(nil), String)
|
||||
|
||||
class RuboCop::Cop::RSpec::PendingWithoutReason < ::RuboCop::Cop::RSpec::Base
|
||||
def on_send(node); end
|
||||
def pending_by_example_method?(param0 = T.unsafe(nil)); end
|
||||
def pending_by_metadata_without_reason?(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_metadata_without_reason?(param0 = T.unsafe(nil)); end
|
||||
|
||||
private
|
||||
|
||||
def pending_by_pending_step_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
|
||||
end
|
||||
|
||||
RuboCop::Cop::RSpec::PendingWithoutReason::MSG = T.let(T.unsafe(nil), String)
|
||||
|
||||
class RuboCop::Cop::RSpec::PredicateMatcher < ::RuboCop::Cop::RSpec::Base
|
||||
include ::RuboCop::Cop::ConfigurableEnforcedStyle
|
||||
include ::RuboCop::Cop::RSpec::InflectedHelper
|
||||
@ -1420,6 +1491,7 @@ class RuboCop::Cop::RSpec::PredicateMatcher < ::RuboCop::Cop::RSpec::Base
|
||||
def block_loc(send_node); end
|
||||
end
|
||||
|
||||
RuboCop::Cop::RSpec::PredicateMatcher::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
||||
module RuboCop::Cop::RSpec::Rails; end
|
||||
|
||||
class RuboCop::Cop::RSpec::Rails::AvoidSetupHook < ::RuboCop::Cop::RSpec::Base
|
||||
@ -1431,7 +1503,7 @@ end
|
||||
|
||||
RuboCop::Cop::RSpec::Rails::AvoidSetupHook::MSG = T.let(T.unsafe(nil), String)
|
||||
|
||||
class RuboCop::Cop::RSpec::Rails::HaveHttpStatus < ::RuboCop::Cop::RSpec::Base
|
||||
class RuboCop::Cop::RSpec::Rails::HaveHttpStatus < ::RuboCop::Cop::Base
|
||||
extend ::RuboCop::Cop::AutoCorrector
|
||||
|
||||
def match_status(param0 = T.unsafe(nil)); end
|
||||
@ -1439,6 +1511,8 @@ class RuboCop::Cop::RSpec::Rails::HaveHttpStatus < ::RuboCop::Cop::RSpec::Base
|
||||
end
|
||||
|
||||
RuboCop::Cop::RSpec::Rails::HaveHttpStatus::MSG = T.let(T.unsafe(nil), String)
|
||||
RuboCop::Cop::RSpec::Rails::HaveHttpStatus::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Set)
|
||||
RuboCop::Cop::RSpec::Rails::HaveHttpStatus::RUNNERS = T.let(T.unsafe(nil), Set)
|
||||
|
||||
class RuboCop::Cop::RSpec::Rails::HttpStatus < ::RuboCop::Cop::RSpec::Base
|
||||
include ::RuboCop::Cop::ConfigurableEnforcedStyle
|
||||
@ -1679,8 +1753,11 @@ end
|
||||
RuboCop::Cop::RSpec::ScatteredLet::MSG = T.let(T.unsafe(nil), String)
|
||||
|
||||
class RuboCop::Cop::RSpec::ScatteredSetup < ::RuboCop::Cop::RSpec::Base
|
||||
def lines_msg(numbers); end
|
||||
def on_block(node); end
|
||||
|
||||
private
|
||||
|
||||
def lines_msg(numbers); end
|
||||
def repeated_hooks(node); end
|
||||
end
|
||||
|
||||
@ -1755,19 +1832,15 @@ module RuboCop::Cop::RSpec::SkipOrPending
|
||||
end
|
||||
|
||||
class RuboCop::Cop::RSpec::SortMetadata < ::RuboCop::Cop::RSpec::Base
|
||||
include ::RuboCop::Cop::RSpec::Metadata
|
||||
include ::RuboCop::Cop::RangeHelp
|
||||
extend ::RuboCop::Cop::AutoCorrector
|
||||
|
||||
def metadata_in_block(param0, param1); end
|
||||
def on_block(node); end
|
||||
def on_numblock(node); end
|
||||
def rspec_configure(param0 = T.unsafe(nil)); end
|
||||
def rspec_metadata(param0 = T.unsafe(nil)); end
|
||||
def on_metadata(symbols, pairs); end
|
||||
|
||||
private
|
||||
|
||||
def crime_scene(symbols, pairs); end
|
||||
def investigate(symbols, pairs); end
|
||||
def replacement(symbols, pairs); end
|
||||
def sort_pairs(pairs); end
|
||||
def sort_symbols(symbols); end
|
||||
@ -1794,6 +1867,7 @@ class RuboCop::Cop::RSpec::StubbedMock < ::RuboCop::Cop::RSpec::Base
|
||||
end
|
||||
|
||||
RuboCop::Cop::RSpec::StubbedMock::MSG = T.let(T.unsafe(nil), String)
|
||||
RuboCop::Cop::RSpec::StubbedMock::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
||||
|
||||
class RuboCop::Cop::RSpec::SubjectDeclaration < ::RuboCop::Cop::RSpec::Base
|
||||
def offensive_subject_declaration?(param0 = T.unsafe(nil)); end
|
||||
@ -1840,10 +1914,13 @@ module RuboCop::Cop::RSpec::TopLevelGroup
|
||||
end
|
||||
|
||||
class RuboCop::Cop::RSpec::UnspecifiedException < ::RuboCop::Cop::RSpec::Base
|
||||
def block_with_args?(node); end
|
||||
def empty_exception_matcher?(node); end
|
||||
def empty_raise_error_or_exception(param0 = T.unsafe(nil)); end
|
||||
def on_send(node); end
|
||||
|
||||
private
|
||||
|
||||
def block_with_args?(node); end
|
||||
def empty_exception_matcher?(node); end
|
||||
end
|
||||
|
||||
RuboCop::Cop::RSpec::UnspecifiedException::MSG = T.let(T.unsafe(nil), String)
|
||||
@ -2174,7 +2251,7 @@ end
|
||||
|
||||
module RuboCop::RSpec::Language::Runners
|
||||
class << self
|
||||
def all(element); end
|
||||
def all(element = T.unsafe(nil)); end
|
||||
end
|
||||
end
|
||||
|
||||
@ -6785,6 +6785,7 @@ module RuboCop::AST::NodePattern::Sets
|
||||
SET_ON_INTEL_ON_ARM = ::T.let(nil, ::T.untyped)
|
||||
SET_OR_NEWER_OR_OLDER = ::T.let(nil, ::T.untyped)
|
||||
SET_SYSTEM_SHELL_OUTPUT_PIPE_OUTPUT = ::T.let(nil, ::T.untyped)
|
||||
SET_TO_TO_NOT_NOT_TO = ::T.let(nil, ::T.untyped)
|
||||
SET_WITH_WITHOUT = ::T.let(nil, ::T.untyped)
|
||||
SET____ETC_4 = ::T.let(nil, ::T.untyped)
|
||||
end
|
||||
|
||||
@ -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.35.1/lib")
|
||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-performance-1.15.1/lib")
|
||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-rails-2.17.3/lib")
|
||||
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-rspec-2.15.0/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-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/simplecov-html-0.12.3/lib")
|
||||
|
||||
@ -147,13 +147,17 @@ RSpec/Be:
|
||||
RSpec/BeEq:
|
||||
Description: Check for expectations where `be(...)` can replace `eq(...)`.
|
||||
Enabled: pending
|
||||
Safe: false
|
||||
VersionAdded: 2.9.0
|
||||
VersionChanged: '2.16'
|
||||
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/BeEq
|
||||
|
||||
RSpec/BeEql:
|
||||
Description: Check for expectations where `be(...)` can replace `eql(...)`.
|
||||
Enabled: true
|
||||
Safe: false
|
||||
VersionAdded: '1.7'
|
||||
VersionChanged: '2.16'
|
||||
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/BeEql
|
||||
|
||||
RSpec/BeNil:
|
||||
@ -284,6 +288,12 @@ RSpec/Dialect:
|
||||
VersionAdded: '1.33'
|
||||
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Dialect
|
||||
|
||||
RSpec/DuplicatedMetadata:
|
||||
Description: Avoid duplicated metadata.
|
||||
Enabled: pending
|
||||
VersionAdded: '2.16'
|
||||
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DuplicatedMetadata
|
||||
|
||||
RSpec/EmptyExampleGroup:
|
||||
Description: Checks if an example group does not include any tests.
|
||||
Enabled: true
|
||||
@ -356,12 +366,6 @@ RSpec/ExampleWithoutDescription:
|
||||
VersionAdded: '1.22'
|
||||
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExampleWithoutDescription
|
||||
|
||||
RSpec/ExcessiveDocstringSpacing:
|
||||
Description: Checks for excessive whitespace in example descriptions.
|
||||
Enabled: pending
|
||||
VersionAdded: '2.5'
|
||||
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExcessiveDocstringSpacing
|
||||
|
||||
RSpec/ExampleWording:
|
||||
Description: Checks for common mistakes in example descriptions.
|
||||
Enabled: true
|
||||
@ -378,6 +382,12 @@ RSpec/ExampleWording:
|
||||
StyleGuide: https://rspec.rubystyle.guide/#should-in-example-docstrings
|
||||
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExampleWording
|
||||
|
||||
RSpec/ExcessiveDocstringSpacing:
|
||||
Description: Checks for excessive whitespace in example descriptions.
|
||||
Enabled: pending
|
||||
VersionAdded: '2.5'
|
||||
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExcessiveDocstringSpacing
|
||||
|
||||
RSpec/ExpectActual:
|
||||
Description: Checks for `expect(...)` calls containing literal values.
|
||||
Enabled: true
|
||||
@ -664,6 +674,12 @@ RSpec/Pending:
|
||||
VersionAdded: '1.25'
|
||||
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Pending
|
||||
|
||||
RSpec/PendingWithoutReason:
|
||||
Description: Checks for pending or skipped examples without reason.
|
||||
Enabled: pending
|
||||
VersionAdded: '2.16'
|
||||
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/PendingWithoutReason
|
||||
|
||||
RSpec/PredicateMatcher:
|
||||
Description: Prefer using predicate matcher over using predicate method directly.
|
||||
Enabled: true
|
||||
@ -960,6 +976,16 @@ RSpec/FactoryBot/FactoryClassName:
|
||||
VersionChanged: '2.0'
|
||||
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/FactoryClassName
|
||||
|
||||
RSpec/FactoryBot/FactoryNameStyle:
|
||||
Description: Checks for name style for argument of FactoryBot::Syntax::Methods.
|
||||
Enabled: pending
|
||||
VersionAdded: '2.16'
|
||||
EnforcedStyle: symbol
|
||||
SupportedStyles:
|
||||
- symbol
|
||||
- string
|
||||
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/FactoryNameStyle
|
||||
|
||||
RSpec/FactoryBot/SyntaxMethods:
|
||||
Description: Use shorthands from `FactoryBot::Syntax::Methods` in your specs.
|
||||
Enabled: pending
|
||||
@ -985,6 +1011,17 @@ RSpec/Rails/HaveHttpStatus:
|
||||
VersionAdded: '2.12'
|
||||
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Rails/HaveHttpStatus
|
||||
|
||||
RSpec/Rails/HttpStatus:
|
||||
Description: Enforces use of symbolic or numeric value to describe HTTP status.
|
||||
Enabled: true
|
||||
EnforcedStyle: symbolic
|
||||
SupportedStyles:
|
||||
- numeric
|
||||
- symbolic
|
||||
VersionAdded: '1.23'
|
||||
VersionChanged: '2.0'
|
||||
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Rails/HttpStatus
|
||||
|
||||
RSpec/Rails/InferredSpecType:
|
||||
Description: Identifies redundant spec type.
|
||||
Enabled: pending
|
||||
@ -1007,14 +1044,3 @@ RSpec/Rails/InferredSpecType:
|
||||
routing: routing
|
||||
system: system
|
||||
views: view
|
||||
|
||||
RSpec/Rails/HttpStatus:
|
||||
Description: Enforces use of symbolic or numeric value to describe HTTP status.
|
||||
Enabled: true
|
||||
EnforcedStyle: symbolic
|
||||
SupportedStyles:
|
||||
- numeric
|
||||
- symbolic
|
||||
VersionAdded: '1.23'
|
||||
VersionChanged: '2.0'
|
||||
Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Rails/HttpStatus
|
||||
@ -6,34 +6,39 @@ require 'yaml'
|
||||
require 'rubocop'
|
||||
|
||||
require_relative 'rubocop/rspec'
|
||||
require_relative 'rubocop/rspec/version'
|
||||
require_relative 'rubocop/rspec/inject'
|
||||
require_relative 'rubocop/rspec/node'
|
||||
require_relative 'rubocop/rspec/wording'
|
||||
require_relative 'rubocop/rspec/language/node_pattern'
|
||||
require_relative 'rubocop/rspec/node'
|
||||
require_relative 'rubocop/rspec/version'
|
||||
require_relative 'rubocop/rspec/wording'
|
||||
|
||||
# Dependent on `RuboCop::RSpec::Language::NodePattern`.
|
||||
require_relative 'rubocop/rspec/language'
|
||||
|
||||
require_relative 'rubocop/rspec/factory_bot/language'
|
||||
|
||||
require_relative 'rubocop/cop/rspec/mixin/capybara_help'
|
||||
require_relative 'rubocop/cop/rspec/mixin/css_selector'
|
||||
require_relative 'rubocop/cop/rspec/mixin/final_end_location'
|
||||
require_relative 'rubocop/cop/rspec/mixin/inside_example_group'
|
||||
require_relative 'rubocop/cop/rspec/mixin/metadata'
|
||||
require_relative 'rubocop/cop/rspec/mixin/namespace'
|
||||
require_relative 'rubocop/cop/rspec/mixin/skip_or_pending'
|
||||
require_relative 'rubocop/cop/rspec/mixin/top_level_group'
|
||||
require_relative 'rubocop/cop/rspec/mixin/variable'
|
||||
require_relative 'rubocop/cop/rspec/mixin/final_end_location'
|
||||
|
||||
# Dependent on `RuboCop::Cop::RSpec::FinalEndLocation`.
|
||||
require_relative 'rubocop/cop/rspec/mixin/comments_help'
|
||||
require_relative 'rubocop/cop/rspec/mixin/empty_line_separation'
|
||||
require_relative 'rubocop/cop/rspec/mixin/inside_example_group'
|
||||
require_relative 'rubocop/cop/rspec/mixin/namespace'
|
||||
require_relative 'rubocop/cop/rspec/mixin/css_selector'
|
||||
require_relative 'rubocop/cop/rspec/mixin/skip_or_pending'
|
||||
require_relative 'rubocop/cop/rspec/mixin/capybara_help'
|
||||
|
||||
require_relative 'rubocop/rspec/concept'
|
||||
require_relative 'rubocop/rspec/example_group'
|
||||
require_relative 'rubocop/rspec/example'
|
||||
require_relative 'rubocop/rspec/hook'
|
||||
require_relative 'rubocop/cop/rspec/base'
|
||||
require_relative 'rubocop/rspec/align_let_brace'
|
||||
require_relative 'rubocop/rspec/factory_bot'
|
||||
require_relative 'rubocop/rspec/concept'
|
||||
require_relative 'rubocop/rspec/corrector/move_node'
|
||||
require_relative 'rubocop/rspec/example'
|
||||
require_relative 'rubocop/rspec/example_group'
|
||||
require_relative 'rubocop/rspec/factory_bot'
|
||||
require_relative 'rubocop/rspec/hook'
|
||||
|
||||
RuboCop::RSpec::Inject.defaults!
|
||||
|
||||
@ -21,6 +21,8 @@ module RuboCop
|
||||
class Be < Base
|
||||
MSG = "Don't use `be` without an argument."
|
||||
|
||||
RESTRICT_ON_SEND = Runners.all
|
||||
|
||||
# @!method be_without_args(node)
|
||||
def_node_matcher :be_without_args, <<-PATTERN
|
||||
(send _ #Runners.all $(send nil? :be))
|
||||
@ -9,6 +9,9 @@ module RuboCop
|
||||
# using `==`. Booleans and nil can be compared by identity and therefore
|
||||
# the `be` matcher is preferable as it is a more strict test.
|
||||
#
|
||||
# @safety
|
||||
# This cop is unsafe because it changes how values are compared.
|
||||
#
|
||||
# @example
|
||||
# # bad
|
||||
# expect(foo).to eq(true)
|
||||
@ -10,6 +10,9 @@ module RuboCop
|
||||
# can be compared by identity and therefore the `be` matcher is
|
||||
# preferable as it is a more strict test.
|
||||
#
|
||||
# @safety
|
||||
# This cop is unsafe because it changes how values are compared.
|
||||
#
|
||||
# @example
|
||||
# # bad
|
||||
# expect(foo).to eql(1)
|
||||
@ -29,7 +29,7 @@ module RuboCop
|
||||
# # good
|
||||
# expect(page).to have_current_path('/callback')
|
||||
#
|
||||
class CurrentPathExpectation < Base
|
||||
class CurrentPathExpectation < ::RuboCop::Cop::Base
|
||||
extend AutoCorrector
|
||||
|
||||
MSG = 'Do not set an RSpec expectation on `current_path` in ' \
|
||||
@ -47,14 +47,14 @@ module RuboCop
|
||||
# @!method as_is_matcher(node)
|
||||
def_node_matcher :as_is_matcher, <<-PATTERN
|
||||
(send
|
||||
#expectation_set_on_current_path $#Runners.all
|
||||
#expectation_set_on_current_path ${:to :to_not :not_to}
|
||||
${(send nil? :eq ...) (send nil? :match (regexp ...))})
|
||||
PATTERN
|
||||
|
||||
# @!method regexp_str_matcher(node)
|
||||
def_node_matcher :regexp_str_matcher, <<-PATTERN
|
||||
(send
|
||||
#expectation_set_on_current_path $#Runners.all
|
||||
#expectation_set_on_current_path ${:to :to_not :not_to}
|
||||
$(send nil? :match (str $_)))
|
||||
PATTERN
|
||||
|
||||
@ -24,7 +24,7 @@ module RuboCop
|
||||
# expect(page).to have_no_selector
|
||||
# expect(page).to have_no_css('a')
|
||||
#
|
||||
class NegationMatcher < Base
|
||||
class NegationMatcher < ::RuboCop::Cop::Base
|
||||
extend AutoCorrector
|
||||
include ConfigurableEnforcedStyle
|
||||
|
||||
@ -20,7 +20,7 @@ module RuboCop
|
||||
# click_link(exact_text: 'foo')
|
||||
# find('div').click_button
|
||||
#
|
||||
class SpecificActions < Base
|
||||
class SpecificActions < ::RuboCop::Cop::Base
|
||||
MSG = "Prefer `%<good_action>s` over `find('%<selector>s').click`."
|
||||
RESTRICT_ON_SEND = %i[click].freeze
|
||||
SPECIFIC_ACTION = {
|
||||
@ -15,7 +15,7 @@ module RuboCop
|
||||
# find_by_id('some-id')
|
||||
# find_by_id('some-id', visible: true)
|
||||
#
|
||||
class SpecificFinders < Base
|
||||
class SpecificFinders < ::RuboCop::Cop::Base
|
||||
extend AutoCorrector
|
||||
|
||||
include RangeHelp
|
||||
@ -26,9 +26,7 @@ module RuboCop
|
||||
# expect(page).to have_select
|
||||
# expect(page).to have_field('foo')
|
||||
#
|
||||
class SpecificMatcher < Base
|
||||
include CapybaraHelp
|
||||
|
||||
class SpecificMatcher < ::RuboCop::Cop::Base
|
||||
MSG = 'Prefer `%<good_matcher>s` over `%<bad_matcher>s`.'
|
||||
RESTRICT_ON_SEND = %i[have_selector have_no_selector have_css
|
||||
have_no_css].freeze
|
||||
@ -49,8 +47,8 @@ module RuboCop
|
||||
first_argument(node) do |arg|
|
||||
next unless (matcher = specific_matcher(arg))
|
||||
next if CssSelector.multiple_selectors?(arg)
|
||||
next unless specific_option?(node, arg, matcher)
|
||||
next unless specific_pseudo_classes?(arg)
|
||||
next unless CapybaraHelp.specific_option?(node, arg, matcher)
|
||||
next unless CapybaraHelp.specific_pseudo_classes?(arg)
|
||||
|
||||
add_offense(node, message: message(node, matcher))
|
||||
end
|
||||
@ -26,7 +26,7 @@ module RuboCop
|
||||
# expect(page).to have_css('.foo', visible: :all)
|
||||
# expect(page).to have_link('my link', visible: :hidden)
|
||||
#
|
||||
class VisibilityMatcher < Base
|
||||
class VisibilityMatcher < ::RuboCop::Cop::Base
|
||||
MSG_FALSE = 'Use `:all` or `:hidden` instead of `false`.'
|
||||
MSG_TRUE = 'Use `:visible` instead of `true`.'
|
||||
CAPYBARA_MATCHER_METHODS = %w[
|
||||
@ -0,0 +1,58 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module RuboCop
|
||||
module Cop
|
||||
module RSpec
|
||||
# Avoid duplicated metadata.
|
||||
#
|
||||
# @example
|
||||
# # bad
|
||||
# describe 'Something', :a, :a
|
||||
#
|
||||
# # good
|
||||
# describe 'Something', :a
|
||||
class DuplicatedMetadata < Base
|
||||
extend AutoCorrector
|
||||
|
||||
include Metadata
|
||||
include RangeHelp
|
||||
|
||||
MSG = 'Avoid duplicated metadata.'
|
||||
|
||||
def on_metadata(symbols, _pairs)
|
||||
symbols.each do |symbol|
|
||||
on_metadata_symbol(symbol)
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def on_metadata_symbol(node)
|
||||
return unless duplicated?(node)
|
||||
|
||||
add_offense(node) do |corrector|
|
||||
autocorrect(corrector, node)
|
||||
end
|
||||
end
|
||||
|
||||
def autocorrect(corrector, node)
|
||||
corrector.remove(
|
||||
range_with_surrounding_comma(
|
||||
range_with_surrounding_space(
|
||||
node.location.expression,
|
||||
side: :left
|
||||
),
|
||||
:left
|
||||
)
|
||||
)
|
||||
end
|
||||
|
||||
def duplicated?(node)
|
||||
node.left_siblings.any? do |sibling|
|
||||
sibling.eql?(node)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -55,6 +55,8 @@ module RuboCop
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def allowed_one_liner?(node)
|
||||
consecutive_one_liner?(node) && allow_consecutive_one_liners?
|
||||
end
|
||||
@ -26,6 +26,8 @@ module RuboCop
|
||||
|
||||
MSG = 'Provide the actual you are testing to `expect(...)`.'
|
||||
|
||||
RESTRICT_ON_SEND = Runners.all
|
||||
|
||||
SIMPLE_LITERALS = %i[
|
||||
true
|
||||
false
|
||||
@ -25,7 +25,7 @@ module RuboCop
|
||||
# # good
|
||||
# count { 1 }
|
||||
#
|
||||
class AttributeDefinedStatically < Base
|
||||
class AttributeDefinedStatically < ::RuboCop::Cop::Base
|
||||
extend AutoCorrector
|
||||
|
||||
MSG = 'Use a block to declare attribute values.'
|
||||
@ -40,7 +40,7 @@ module RuboCop
|
||||
# name: 'foo'
|
||||
# )
|
||||
#
|
||||
class ConsistentParenthesesStyle < Base
|
||||
class ConsistentParenthesesStyle < ::RuboCop::Cop::Base
|
||||
extend AutoCorrector
|
||||
include ConfigurableEnforcedStyle
|
||||
include RuboCop::RSpec::FactoryBot::Language
|
||||
@ -69,6 +69,8 @@ module RuboCop
|
||||
return if ambiguous_without_parentheses?(node)
|
||||
|
||||
factory_call(node) do
|
||||
return if node.method?(:generate) && node.arguments.count > 1
|
||||
|
||||
if node.parenthesized?
|
||||
process_with_parentheses(node)
|
||||
else
|
||||
@ -77,6 +79,8 @@ module RuboCop
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def process_with_parentheses(node)
|
||||
return unless style == :omit_parentheses
|
||||
return unless same_line?(node, node.first_argument)
|
||||
@ -102,8 +106,6 @@ module RuboCop
|
||||
node.parent&.array_type?
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def remove_parentheses(corrector, node)
|
||||
corrector.replace(node.location.begin, ' ')
|
||||
corrector.remove(node.location.end)
|
||||
@ -31,7 +31,7 @@ module RuboCop
|
||||
# # good
|
||||
# 3.times { create :user }
|
||||
#
|
||||
class CreateList < Base
|
||||
class CreateList < ::RuboCop::Cop::Base
|
||||
extend AutoCorrector
|
||||
include ConfigurableEnforcedStyle
|
||||
include RuboCop::RSpec::FactoryBot::Language
|
||||
@ -143,7 +143,7 @@ module RuboCop
|
||||
|
||||
def call(corrector)
|
||||
replacement = generate_n_times_block(node)
|
||||
corrector.replace(node, replacement)
|
||||
corrector.replace(node.block_node || node, replacement)
|
||||
end
|
||||
|
||||
private
|
||||
@ -159,8 +159,15 @@ module RuboCop
|
||||
|
||||
replacement = format_receiver(node.receiver)
|
||||
replacement += format_method_call(node, 'create', arguments)
|
||||
replacement += " #{factory_call_block_source}" if node.block_node
|
||||
"#{count.source}.times { #{replacement} }"
|
||||
end
|
||||
|
||||
def factory_call_block_source
|
||||
node.block_node.location.begin.with(
|
||||
end_pos: node.block_node.location.end.end_pos
|
||||
).source
|
||||
end
|
||||
end
|
||||
|
||||
# :nodoc:
|
||||
@ -20,7 +20,7 @@ module RuboCop
|
||||
# factory :foo, class: 'Foo' do
|
||||
# end
|
||||
#
|
||||
class FactoryClassName < Base
|
||||
class FactoryClassName < ::RuboCop::Cop::Base
|
||||
extend AutoCorrector
|
||||
|
||||
MSG = "Pass '%<class_name>s' string instead of `%<class_name>s` " \
|
||||
@ -0,0 +1,74 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module RuboCop
|
||||
module Cop
|
||||
module RSpec
|
||||
module FactoryBot
|
||||
# Checks for name style for argument of FactoryBot::Syntax::Methods.
|
||||
#
|
||||
# @example EnforcedStyle: symbol (default)
|
||||
# # bad
|
||||
# create('user')
|
||||
# build "user", username: "NAME"
|
||||
#
|
||||
# # good
|
||||
# create(:user)
|
||||
# build :user, username: "NAME"
|
||||
#
|
||||
# @example EnforcedStyle: string
|
||||
# # bad
|
||||
# create(:user)
|
||||
# build :user, username: "NAME"
|
||||
#
|
||||
# # good
|
||||
# create('user')
|
||||
# build "user", username: "NAME"
|
||||
#
|
||||
class FactoryNameStyle < ::RuboCop::Cop::Base
|
||||
extend AutoCorrector
|
||||
include ConfigurableEnforcedStyle
|
||||
include RuboCop::RSpec::FactoryBot::Language
|
||||
|
||||
MSG = 'Use %<prefer>s to refer to a factory.'
|
||||
FACTORY_CALLS = RuboCop::RSpec::FactoryBot::Language::METHODS
|
||||
RESTRICT_ON_SEND = FACTORY_CALLS
|
||||
|
||||
# @!method factory_call(node)
|
||||
def_node_matcher :factory_call, <<-PATTERN
|
||||
(send
|
||||
{#factory_bot? nil?} %FACTORY_CALLS
|
||||
${str sym} ...
|
||||
)
|
||||
PATTERN
|
||||
|
||||
def on_send(node)
|
||||
factory_call(node) do |name|
|
||||
if offense_for_symbol_style?(name)
|
||||
register_offense(name, name.value.to_sym.inspect)
|
||||
elsif offense_for_string_style?(name)
|
||||
register_offense(name, name.value.to_s.inspect)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def offense_for_symbol_style?(name)
|
||||
name.str_type? && style == :symbol
|
||||
end
|
||||
|
||||
def offense_for_string_style?(name)
|
||||
name.sym_type? && style == :string
|
||||
end
|
||||
|
||||
def register_offense(name, prefer)
|
||||
add_offense(name,
|
||||
message: format(MSG, prefer: style.to_s)) do |corrector|
|
||||
corrector.replace(name, prefer)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -28,6 +28,8 @@ module RuboCop
|
||||
|
||||
MSG = 'Prefer `%<good>s` over `%<bad>s`.'
|
||||
|
||||
RESTRICT_ON_SEND = Runners.all + %i[should should_not]
|
||||
|
||||
# @!method implicit_expect(node)
|
||||
def_node_matcher :implicit_expect, <<-PATTERN
|
||||
{
|
||||
@ -44,6 +44,8 @@ module RuboCop
|
||||
check_previous_nodes(node)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def check_previous_nodes(node)
|
||||
offending_node(node) do |offender|
|
||||
msg = format(MSG, offending: offender.method_name)
|
||||
@ -53,8 +55,6 @@ module RuboCop
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def offending_node(node)
|
||||
parent(node).each_child_node.find do |sibling|
|
||||
break if sibling.equal?(node)
|
||||
@ -41,6 +41,8 @@ module RuboCop
|
||||
|
||||
SUPPORTED_STYLES = %w[have_received receive].freeze
|
||||
|
||||
RESTRICT_ON_SEND = Runners.all
|
||||
|
||||
# @!method message_expectation(node)
|
||||
def_node_matcher :message_expectation, %(
|
||||
(send (send nil? :expect $_) #Runners.all ...)
|
||||
@ -0,0 +1,49 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module RuboCop
|
||||
module Cop
|
||||
module RSpec
|
||||
# Helper methods to find RSpec metadata.
|
||||
module Metadata
|
||||
extend RuboCop::NodePattern::Macros
|
||||
|
||||
include RuboCop::RSpec::Language
|
||||
|
||||
# @!method rspec_metadata(node)
|
||||
def_node_matcher :rspec_metadata, <<~PATTERN
|
||||
(block
|
||||
(send
|
||||
#rspec? {#Examples.all #ExampleGroups.all #SharedGroups.all #Hooks.all} _ ${send str sym}* (hash $...)?)
|
||||
...)
|
||||
PATTERN
|
||||
|
||||
# @!method rspec_configure(node)
|
||||
def_node_matcher :rspec_configure, <<~PATTERN
|
||||
(block (send #rspec? :configure) (args (arg $_)) ...)
|
||||
PATTERN
|
||||
|
||||
# @!method metadata_in_block(node)
|
||||
def_node_search :metadata_in_block, <<~PATTERN
|
||||
(send (lvar %) #Hooks.all _ ${send str sym}* (hash $...)?)
|
||||
PATTERN
|
||||
|
||||
def on_block(node)
|
||||
rspec_configure(node) do |block_var|
|
||||
metadata_in_block(node, block_var) do |symbols, pairs|
|
||||
on_metadata(symbols, pairs.flatten)
|
||||
end
|
||||
end
|
||||
|
||||
rspec_metadata(node) do |symbols, pairs|
|
||||
on_metadata(symbols, pairs.flatten)
|
||||
end
|
||||
end
|
||||
alias on_numblock on_block
|
||||
|
||||
def on_metadata(_symbols, _pairs)
|
||||
raise ::NotImplementedError
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -0,0 +1,123 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module RuboCop
|
||||
module Cop
|
||||
module RSpec
|
||||
# Checks for pending or skipped examples without reason.
|
||||
#
|
||||
# @example
|
||||
# # bad
|
||||
# pending 'does something' do
|
||||
# end
|
||||
#
|
||||
# # bad
|
||||
# it 'does something', :pending do
|
||||
# end
|
||||
#
|
||||
# # bad
|
||||
# it 'does something' do
|
||||
# pending
|
||||
# end
|
||||
#
|
||||
# # bad
|
||||
# xdescribe 'something' do
|
||||
# end
|
||||
#
|
||||
# # bad
|
||||
# skip 'does something' do
|
||||
# end
|
||||
#
|
||||
# # bad
|
||||
# it 'does something', :skip do
|
||||
# end
|
||||
#
|
||||
# # bad
|
||||
# it 'does something' do
|
||||
# skip
|
||||
# end
|
||||
#
|
||||
# # bad
|
||||
# it 'does something'
|
||||
#
|
||||
# # good
|
||||
# it 'does something' do
|
||||
# pending 'reason'
|
||||
# end
|
||||
#
|
||||
# # good
|
||||
# it 'does something' do
|
||||
# skip 'reason'
|
||||
# end
|
||||
#
|
||||
# # good
|
||||
# it 'does something', pending: 'reason' do
|
||||
# end
|
||||
#
|
||||
# # good
|
||||
# it 'does something', skip: 'reason' do
|
||||
# end
|
||||
class PendingWithoutReason < Base
|
||||
MSG = 'Give the reason for pending or skip.'
|
||||
|
||||
# @!method pending_by_example_method?(node)
|
||||
def_node_matcher :pending_by_example_method?, block_pattern(<<~PATTERN)
|
||||
#Examples.pending
|
||||
PATTERN
|
||||
|
||||
# @!method pending_by_metadata_without_reason?(node)
|
||||
def_node_matcher :pending_by_metadata_without_reason?, <<~PATTERN
|
||||
(send #rspec? {#ExampleGroups.all #Examples.all} ... {<(sym :pending) ...> (hash <(pair (sym :pending) true) ...>)})
|
||||
PATTERN
|
||||
|
||||
# @!method skipped_by_example_method?(node)
|
||||
def_node_matcher :skipped_by_example_method?, block_pattern(<<~PATTERN)
|
||||
#Examples.skipped
|
||||
PATTERN
|
||||
|
||||
# @!method skipped_by_example_group_method?(node)
|
||||
def_node_matcher(
|
||||
:skipped_by_example_group_method?,
|
||||
block_pattern(<<~PATTERN)
|
||||
#ExampleGroups.skipped
|
||||
PATTERN
|
||||
)
|
||||
|
||||
# @!method skipped_by_metadata_without_reason?(node)
|
||||
def_node_matcher :skipped_by_metadata_without_reason?, <<~PATTERN
|
||||
(send #rspec? {#ExampleGroups.all #Examples.all} ... {<(sym :skip) ...> (hash <(pair (sym :skip) true) ...>)})
|
||||
PATTERN
|
||||
|
||||
def on_send(node)
|
||||
if pending_without_reason?(node)
|
||||
add_offense(node, message: 'Give the reason for pending.')
|
||||
elsif skipped_without_reason?(node)
|
||||
add_offense(node, message: 'Give the reason for skip.')
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def pending_by_pending_step_without_reason?(node)
|
||||
node.method?(:pending) && node.first_argument.nil?
|
||||
end
|
||||
|
||||
def pending_without_reason?(node)
|
||||
pending_by_example_method?(node.block_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
|
||||
|
||||
def skipped_without_reason?(node)
|
||||
skipped_by_example_group_method?(node.block_node) ||
|
||||
skipped_by_example_method?(node.block_node) ||
|
||||
skipped_by_metadata_without_reason?(node) ||
|
||||
skipped_by_skip_step_without_reason?(node)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -283,6 +283,8 @@ module RuboCop
|
||||
include InflectedHelper
|
||||
include ExplicitHelper
|
||||
|
||||
RESTRICT_ON_SEND = Runners.all
|
||||
|
||||
def on_send(node)
|
||||
case style
|
||||
when :inflected
|
||||
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