CodeQL Tuning
This commit is contained in:
20
.github/workflows/queries/common/ProductionOnly.qll
vendored
Normal file
20
.github/workflows/queries/common/ProductionOnly.qll
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
import rust
|
||||
|
||||
predicate isTestOnly(Item i) {
|
||||
exists(ConditionalCompilation cc |
|
||||
cc.getItem() = i and
|
||||
cc.getCfg().toString() = "test"
|
||||
)
|
||||
}
|
||||
|
||||
predicate hasTestAttribute(Item i) {
|
||||
exists(Attribute a |
|
||||
a.getItem() = i and
|
||||
a.getName() = "test"
|
||||
)
|
||||
}
|
||||
|
||||
predicate isProductionCode(Item i) {
|
||||
not isTestOnly(i) and
|
||||
not hasTestAttribute(i)
|
||||
}
|
||||
Reference in New Issue
Block a user