github / github/codeql

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

Abierto
#20,771 2 comentarios 0 reacciones 0 asignados Ver en GitHub
question Rust
Lenguaje dominante
CodeQL
Estrellas
10.1k
Forks
2.1k
Merge medio
2 d 15 h
PR fusionados (30 d)
141

Descripción

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()
}
```

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
rust
Área
devtools
Tipo de issue
Documentación
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Estancado
Claridad
Necesita aclaración
Aptitud para principiantes
25/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.