|
| 1 | +/** |
| 2 | + * @name Summary Statistics |
| 3 | + * @description A table of summary statistics about a database. |
| 4 | + * @kind metric |
| 5 | + * @id rust/summary/summary-statistics |
| 6 | + * @tags summary |
| 7 | + */ |
| 8 | + |
| 9 | +import rust |
| 10 | +import codeql.rust.Concepts |
| 11 | +import codeql.rust.Diagnostics |
| 12 | +import Stats |
| 13 | + |
| 14 | +from string key, int value |
| 15 | +where |
| 16 | + key = "Elements extracted" and value = count(Element e | not e instanceof Unextracted) |
| 17 | + or |
| 18 | + key = "Elements unextracted" and value = count(Unextracted e) |
| 19 | + or |
| 20 | + key = "Extraction errors" and value = count(ExtractionError e) |
| 21 | + or |
| 22 | + key = "Extraction warnings" and value = count(ExtractionWarning w) |
| 23 | + or |
| 24 | + key = "Files extracted - total" and value = count(ExtractedFile f | exists(f.getRelativePath())) |
| 25 | + or |
| 26 | + key = "Files extracted - with errors" and |
| 27 | + value = |
| 28 | + count(ExtractedFile f | |
| 29 | + exists(f.getRelativePath()) and not f instanceof SuccessfullyExtractedFile |
| 30 | + ) |
| 31 | + or |
| 32 | + key = "Files extracted - without errors" and |
| 33 | + value = count(SuccessfullyExtractedFile f | exists(f.getRelativePath())) |
| 34 | + or |
| 35 | + key = "Lines of code extracted" and value = getLinesOfCode() |
| 36 | + or |
| 37 | + key = "Lines of user code extracted" and value = getLinesOfUserCode() |
| 38 | + or |
| 39 | + key = "Inconsistencies - AST" and value = getTotalAstInconsistencies() |
| 40 | + or |
| 41 | + key = "Inconsistencies - CFG" and value = getTotalCfgInconsistencies() |
| 42 | + or |
| 43 | + key = "Inconsistencies - data flow" and value = getTotalDataFlowInconsistencies() |
| 44 | + or |
| 45 | + key = "Macro calls - total" and value = count(MacroCall mc) |
| 46 | + or |
| 47 | + key = "Macro calls - resolved" and value = count(MacroCall mc | mc.hasExpanded()) |
| 48 | + or |
| 49 | + key = "Macro calls - unresolved" and value = count(MacroCall mc | not mc.hasExpanded()) |
| 50 | + or |
| 51 | + key = "Taint sources - total" and value = count(ThreatModelSource s) |
| 52 | + or |
| 53 | + key = "Taint sources - active" and value = count(ActiveThreatModelSource s) |
| 54 | +select key, value order by key |
0 commit comments