MCPcopy Create free account
hub / github.com/csskit/csskit / diagnostics

Method diagnostics

crates/csskit_ast/src/collector/mod.rs:524–537  ·  view source on GitHub ↗

Get all diagnostics from matched rules. This method should be called after `collect()` to retrieve diagnostics for all rules that had diagnostic templates and matched nodes.

(&'b self, css_source: &'b str)

Source from the content-addressed store, hash-verified

522 /// This method should be called after `collect()` to retrieve diagnostics
523 /// for all rules that had diagnostic templates and matched nodes.
524 pub fn diagnostics<'b>(&'b self, css_source: &'b str) -> impl Iterator<Item = CollectorDiagnostic> + 'b {
525 self.collection_rules.iter().flat_map(move |rule| {
526 let Some((severity, components)) = &rule.diagnostic else {
527 return vec![in self.allocator].into_iter();
528 };
529
530 let mut diagnostics = vec![in self.allocator];
531 for match_output in rule.matches.iter() {
532 let message = self.resolve_diagnostic_message(components, match_output, css_source);
533 diagnostics.push(CollectorDiagnostic::new(*severity, match_output.span, message));
534 }
535 diagnostics.into_iter()
536 })
537 }
538
539 /// Get the collected statistics.
540 ///

Callers 2

collectorFunction · 0.45
runFunction · 0.45

Calls 3

iterMethod · 0.80
into_iterMethod · 0.80

Tested by 1

runFunction · 0.36