@@ -60,6 +60,29 @@ predicate extractorDiagnostics(string key, int value) {
6060 )
6161}
6262
63+ /*
64+ * Just counting the diagnostics doesn't give the full picture, as
65+ * CODEQL_EXTRACTOR_KOTLIN_DIAGNOSTIC_LIMIT means that some diagnostics
66+ * will be suppressed. In that case, we need to look for the
67+ * suppression message, uncount those that did get emitted, uncount the
68+ * suppression message itself, and then add on the full count.
69+ */
70+
71+ predicate extractorTotalDiagnostics ( string key , int value ) {
72+ exists ( string extractor , string limitRegex |
73+ limitRegex = "Total of ([0-9]+) diagnostics \\(reached limit of ([0-9]+)\\).*" and
74+ key = "Total number of diagnostics from " + extractor and
75+ value =
76+ strictcount ( Diagnostic d | d .getGeneratedBy ( ) = extractor ) +
77+ sum ( Diagnostic d |
78+ d .getGeneratedBy ( ) = extractor
79+ |
80+ d .getMessage ( ) .regexpCapture ( limitRegex , 1 ) .toInt ( ) -
81+ d .getMessage ( ) .regexpCapture ( limitRegex , 2 ) .toInt ( ) - 1
82+ )
83+ )
84+ }
85+
6386from string key , int value
6487where
6588 compilationInfo ( key , value ) or
6992 numberOfLinesOfCode ( key , value ) or
7093 totalNumberOfLinesByExtension ( key , value ) or
7194 numberOfLinesOfCodeByExtension ( key , value ) or
72- extractorDiagnostics ( key , value )
95+ extractorDiagnostics ( key , value ) or
96+ extractorTotalDiagnostics ( key , value )
7397select key , value
0 commit comments