Java: Allow keys to be omitted from ExtractorInformation.ql

This is useful in tests, as some keys contain unstable information.
This commit is contained in:
Ian Lynagh
2023-03-28 15:16:27 +01:00
parent 889dcfe2b2
commit 4fa1bbf018
3 changed files with 21 additions and 9 deletions

View File

@@ -9,6 +9,8 @@
import java
import semmle.code.java.Diagnostics
extensible predicate extractorInformationSkipKey(string key);
predicate compilationInfo(string key, int value) {
exists(Compilation c, string infoKey |
key = infoKey + ": " + c.getInfo(infoKey) and
@@ -85,13 +87,16 @@ predicate extractorTotalDiagnostics(string key, int value) {
from string key, int value
where
compilationInfo(key, value) or
fileCount(key, value) or
fileCountByExtension(key, value) or
totalNumberOfLines(key, value) or
numberOfLinesOfCode(key, value) or
totalNumberOfLinesByExtension(key, value) or
numberOfLinesOfCodeByExtension(key, value) or
extractorDiagnostics(key, value) or
extractorTotalDiagnostics(key, value)
not extractorInformationSkipKey(key) and
(
compilationInfo(key, value) or
fileCount(key, value) or
fileCountByExtension(key, value) or
totalNumberOfLines(key, value) or
numberOfLinesOfCode(key, value) or
totalNumberOfLinesByExtension(key, value) or
numberOfLinesOfCodeByExtension(key, value) or
extractorDiagnostics(key, value) or
extractorTotalDiagnostics(key, value)
)
select key, value

View File

@@ -0,0 +1,5 @@
extensions:
- addsTo:
pack: codeql/java-queries
extensible: extractorInformationSkipKey
data: []