github / github/codeql

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

オープン
#20,771 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る
question Rust
主要言語
CodeQL
スター
10.1k
フォーク
2.1k
平均マージ
2日 15時間
マージ済み PR(30日)
141

説明

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

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
rust
領域
devtools
issue の種類
ドキュメント
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。