Class: Shirobai::Cop::RSpec::MetadataStyle
- Inherits:
-
RuboCop::Cop::Base
- Object
- RuboCop::Cop::Base
- Shirobai::Cop::RSpec::MetadataStyle
show all
- Extended by:
- RuboCop::Cop::AutoCorrector
- Includes:
- RuboCop::Cop::ConfigurableEnforcedStyle, RuboCop::Cop::RangeHelp, RuboCop::RSpec::Language, MetadataSupport
- Defined in:
- lib/shirobai/cop/rspec/metadata_style.rb
Overview
Drop-in Rust reimplementation of RSpec/MetadataStyle
(rubocop-rspec 3.10.2).
Rust supplies the shared metadata-anchor block ranges; this wrapper
relocates each parser block node and runs stock's on_metadata plus the
full bidirectional autocorrect VERBATIM. EnforcedStyle is read here
(ConfigurableEnforcedStyle) — Rust never needs it, since the anchor set
is style-independent. The intricate insert/remove logic (siblings,
braces, empty/non-empty hash, ambiguous trailing metadata) runs on the
real parser AST, so it matches byte for byte.
Class Method Summary
collapse
Instance Method Summary
collapse
#metadata_in_block, #on_new_investigation, #rspec_configure, #rspec_metadata
Class Method Details
.badge ⇒ Object
25
|
# File 'lib/shirobai/cop/rspec/metadata_style.rb', line 25
def self.badge = RuboCop::Cop::Badge.parse(cop_name)
|
.bundle_args(_config) ⇒ Object
27
28
29
|
# File 'lib/shirobai/cop/rspec/metadata_style.rb', line 27
def self.bundle_args(_config)
[]
end
|
.cop_name ⇒ Object
24
|
# File 'lib/shirobai/cop/rspec/metadata_style.rb', line 24
def self.cop_name = "RSpec/MetadataStyle"
|
Instance Method Details
34
35
36
|
# File 'lib/shirobai/cop/rspec/metadata_style.rb', line 34
def_node_matcher :extract_metadata_hash, <<~PATTERN
(send _ _ _ ... $hash)
PATTERN
|
44
45
46
|
# File 'lib/shirobai/cop/rspec/metadata_style.rb', line 44
def_node_matcher :match_ambiguous_trailing_metadata?, <<~PATTERN
(send _ _ _ ... !{hash sym})
PATTERN
|
39
40
41
|
# File 'lib/shirobai/cop/rspec/metadata_style.rb', line 39
def_node_matcher :match_boolean_metadata_pair?, <<~PATTERN
(pair sym true)
PATTERN
|
31
|
# File 'lib/shirobai/cop/rspec/metadata_style.rb', line 31
def metadata_slot = :rspec_metadata_style
|
--- stock's methods, copied verbatim (rubocop-rspec 3.10.2) ---
50
51
52
53
54
55
56
57
58
59
60
|
# File 'lib/shirobai/cop/rspec/metadata_style.rb', line 50
def on_metadata(symbols, hash)
symbols.each do |symbol|
on_metadata_symbol(symbol) if symbol.sym_type?
end
return unless hash
hash.pairs.each do |pair|
on_metadata_pair(pair)
end
end
|