github / github/codeql

[Rust] How do I query function and module attributes?

Aperta
#20,771 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub
question Rust
Lingua principale
CodeQL
Stelle
10.1k
Fork
2.1k
Merge medio
2g 15h
PR unite (30g)
141

Descrizione

I wanted to filter out tests from my results, based on if they either had a #[test] attribute or #[cfg(test)].

Currently tried something similar to this but cant figure out how to properly filter this from the docs

```ql
predicate doesntWork(Module mod, Attr a, Meta m) {
a = mod.getAnAttr() and
m = a.getMeta() and
m.hasPath() and
m.getPath().toString() = "cfg" and
m.hasTokenTree()
}
```

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Start by locating the Rust CodeQL library definitions for Module, Attr, and Meta, then compare how the #[test] and #[cfg(test)] attributes are represented. Done means providing a documented query pattern that filters tests using these attributes.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
rust
Ambito
devtools
Tipo di issue
Documentazione
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
25/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.