mirror of
https://github.com/github/codeql.git
synced 2026-04-24 08:15:14 +02:00
Merge pull request #17589 from geoffw0/missing2
Rust: Repair rust/diagnostics/unextracted-elements
This commit is contained in:
24
rust/ql/src/queries/diagnostics/UnextractedElements.ql
Normal file
24
rust/ql/src/queries/diagnostics/UnextractedElements.ql
Normal file
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* @name Unextracted Elements
|
||||
* @description List all elements that weren't extracted due to unimplemented features or parse errors.
|
||||
* @id rust/diagnostics/unextracted-elements
|
||||
*/
|
||||
|
||||
import rust
|
||||
|
||||
/**
|
||||
* Gets a string along the lines of " (x2)", corresponding to the number `i`.
|
||||
* For `i = 1`, the result is the empty string.
|
||||
*/
|
||||
bindingset[i]
|
||||
string multipleString(int i) {
|
||||
i = 1 and result = ""
|
||||
or
|
||||
i > 1 and result = " (x" + i.toString() + ")"
|
||||
}
|
||||
|
||||
from string name, int c
|
||||
where c = strictcount(Unextracted e | e.toString() = name)
|
||||
// we don't have locations, so just list the number of each type of
|
||||
// `Unextracted` element.
|
||||
select name + multipleString(c)
|
||||
@@ -0,0 +1 @@
|
||||
queries/diagnostics/UnextractedElements.ql
|
||||
Reference in New Issue
Block a user