Class: Shirobai::Cop::RSpec::PendingWithoutReason
- Inherits:
-
RuboCop::Cop::Base
- Object
- RuboCop::Cop::Base
- Shirobai::Cop::RSpec::PendingWithoutReason
- Includes:
- RuboCop::RSpec::Language, SendCandidateSupport
- Defined in:
- lib/shirobai/cop/rspec/pending_without_reason.rb
Overview
Drop-in Rust reimplementation of RSpec/PendingWithoutReason
(rubocop-rspec 3.10.2). No autocorrect (stock has none).
Rust supplies candidate SEND ranges (skipped/pending example or skipped
example-group names, plus any send carrying :skip / :pending
metadata); this wrapper relocates each parser send node and runs stock's
on_send VERBATIM. All parent-relationship logic (spec_group? /
example? / block detection) runs on the real parser AST.
Constant Summary collapse
- MSG =
"Give the reason for pending or skip."
Class Method Summary collapse
Instance Method Summary collapse
- #metadata_without_reason?(node) ⇒ Object
- #skipped_by_example_group_method?(node) ⇒ Object
- #skipped_by_example_method?(node) ⇒ Object
- #skipped_by_example_method_with_block?(node) ⇒ Object
- #skipped_in_example?(node) ⇒ Object
Methods included from SendCandidateSupport
Class Method Details
.badge ⇒ Object
21 |
# File 'lib/shirobai/cop/rspec/pending_without_reason.rb', line 21 def self.badge = RuboCop::Cop::Badge.parse(cop_name) |
.bundle_args(_config) ⇒ Object
23 24 25 |
# File 'lib/shirobai/cop/rspec/pending_without_reason.rb', line 23 def self.bundle_args(_config) [] end |
.cop_name ⇒ Object
20 |
# File 'lib/shirobai/cop/rspec/pending_without_reason.rb', line 20 def self.cop_name = "RSpec/PendingWithoutReason" |
Instance Method Details
#metadata_without_reason?(node) ⇒ Object
46 47 48 49 50 51 52 53 54 |
# File 'lib/shirobai/cop/rspec/pending_without_reason.rb', line 46 def_node_matcher :metadata_without_reason?, <<~PATTERN (send #rspec? {#ExampleGroups.all #Examples.all} ... { <(sym ${:pending :skip}) ...> (hash <(pair (sym ${:pending :skip}) true) ...>) } ) PATTERN |
#skipped_by_example_group_method?(node) ⇒ Object
57 58 59 |
# File 'lib/shirobai/cop/rspec/pending_without_reason.rb', line 57 def_node_matcher :skipped_by_example_group_method?, <<~PATTERN (send #rspec? ${#ExampleGroups.skipped} ...) PATTERN |
#skipped_by_example_method?(node) ⇒ Object
36 37 38 |
# File 'lib/shirobai/cop/rspec/pending_without_reason.rb', line 36 def_node_matcher :skipped_by_example_method?, <<~PATTERN (send nil? ${#Examples.skipped #Examples.pending}) PATTERN |
#skipped_by_example_method_with_block?(node) ⇒ Object
41 42 43 |
# File 'lib/shirobai/cop/rspec/pending_without_reason.rb', line 41 def_node_matcher :skipped_by_example_method_with_block?, <<~PATTERN (any_block (send nil? ${#Examples.skipped #Examples.pending} ...) ...) PATTERN |
#skipped_in_example?(node) ⇒ Object
28 29 30 31 32 33 |
# File 'lib/shirobai/cop/rspec/pending_without_reason.rb', line 28 def_node_matcher :skipped_in_example?, <<~PATTERN { (send nil? ${#Examples.skipped #Examples.pending}) (any_block (send nil? ${#Examples.skipped}) ...) } PATTERN |