MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / has_attribute

Function has_attribute

atomic-audit/src/substantive/rust.rs:97–108  ·  view source on GitHub ↗
(node: Node<'_>, context: &Context<'_>, expected: &str)

Source from the content-addressed store, hash-verified

95}
96
97fn has_attribute(node: Node<'_>, context: &Context<'_>, expected: &str) -> bool {
98 attributes(node).into_iter().any(|attribute| {
99 tokens::named(attribute)
100 .into_iter()
101 .filter(|node| node.kind() == "attribute")
102 .any(|attribute| {
103 code_children(attribute).first().is_some_and(|path| {
104 tokens::text(*path, context.source).rsplit("::").next() == Some(expected)
105 })
106 })
107 })
108}
109
110fn is_test(node: Node<'_>, context: &Context<'_>) -> bool {
111 has_attribute(node, context, "test")

Callers 2

inspectFunction · 0.85
is_testFunction · 0.85

Calls 7

attributesFunction · 0.85
code_childrenFunction · 0.85
namedFunction · 0.50
textFunction · 0.50
into_iterMethod · 0.45
kindMethod · 0.45
nextMethod · 0.45

Tested by

no test coverage detected