Class: Shirobai::Cop::RSpec::Focus
- Inherits:
-
RuboCop::Cop::Base
- Object
- RuboCop::Cop::Base
- Shirobai::Cop::RSpec::Focus
- Extended by:
- RuboCop::Cop::AutoCorrector
- Includes:
- RuboCop::Cop::RangeHelp, RuboCop::RSpec::Language, SendCandidateSupport
- Defined in:
- lib/shirobai/cop/rspec/focus.rb
Overview
Drop-in Rust reimplementation of RSpec/Focus (rubocop-rspec 3.10.2).
Rust supplies candidate SEND ranges (focused aliases + focusable
selectors carrying :focus / focus: true); this wrapper relocates
each parser send node and runs stock's on_send plus autocorrect
VERBATIM. The chained / inside-def guards, the exact matchers, and the
two correction modes (remove metadata / rename selector, with the
non-correctable bare-alias case) match byte for byte.
Constant Summary collapse
- MSG =
"Focused spec found."
Class Method Summary collapse
Instance Method Summary collapse
Methods included from SendCandidateSupport
Class Method Details
.badge ⇒ Object
24 |
# File 'lib/shirobai/cop/rspec/focus.rb', line 24 def self.badge = RuboCop::Cop::Badge.parse(cop_name) |
.bundle_args(_config) ⇒ Object
26 27 28 |
# File 'lib/shirobai/cop/rspec/focus.rb', line 26 def self.bundle_args(_config) [] end |
.cop_name ⇒ Object
23 |
# File 'lib/shirobai/cop/rspec/focus.rb', line 23 def self.cop_name = "RSpec/Focus" |
Instance Method Details
#focusable_selector?(node) ⇒ Object
31 32 33 34 35 36 37 38 39 40 |
# File 'lib/shirobai/cop/rspec/focus.rb', line 31 def_node_matcher :focusable_selector?, <<~PATTERN { #ExampleGroups.regular #ExampleGroups.skipped #Examples.regular #Examples.skipped #Examples.pending #SharedGroups.all } PATTERN |
#focused_block?(node) ⇒ Object
49 50 51 |
# File 'lib/shirobai/cop/rspec/focus.rb', line 49 def_node_matcher :focused_block?, <<~PATTERN (send #rspec? {#ExampleGroups.focused #Examples.focused} ...) PATTERN |
#metadata(node) ⇒ Object
43 44 45 46 |
# File 'lib/shirobai/cop/rspec/focus.rb', line 43 def_node_matcher :metadata, <<~PATTERN {(send #rspec? #focusable_selector? <$(sym :focus) ...>) (send #rspec? #focusable_selector? ... (hash <$(pair (sym :focus) true) ...>))} PATTERN |