@@ -28,7 +28,7 @@ private import codeql.rust.security.WeakSensitiveDataHashingExtensions
2828/**
2929 * Gets a count of the total number of lines of code in the database.
3030 */
31- int getLinesOfCode ( ) { result = sum ( File f | | f .getNumberOfLinesOfCode ( ) ) }
31+ int getLinesOfCode ( ) { result = sum ( File f | f . fromSource ( ) | f .getNumberOfLinesOfCode ( ) ) }
3232
3333/**
3434 * Gets a count of the total number of lines of code from the source code directory in the database.
@@ -109,9 +109,11 @@ predicate elementStats(string key, int value) {
109109 * Gets summary statistics about extraction.
110110 */
111111predicate extractionStats ( string key , int value ) {
112- key = "Extraction errors" and value = count ( ExtractionError e )
112+ key = "Extraction errors" and
113+ value = count ( ExtractionError e | not exists ( e .getLocation ( ) ) or e .getLocation ( ) .fromSource ( ) )
113114 or
114- key = "Extraction warnings" and value = count ( ExtractionWarning w )
115+ key = "Extraction warnings" and
116+ value = count ( ExtractionWarning w | not exists ( w .getLocation ( ) ) or w .getLocation ( ) .fromSource ( ) )
115117 or
116118 key = "Files extracted - total" and value = count ( ExtractedFile f | exists ( f .getRelativePath ( ) ) )
117119 or
@@ -133,11 +135,13 @@ predicate extractionStats(string key, int value) {
133135 or
134136 key = "Lines of user code extracted" and value = getLinesOfUserCode ( )
135137 or
136- key = "Macro calls - total" and value = count ( MacroCall mc )
138+ key = "Macro calls - total" and value = count ( MacroCall mc | mc . fromSource ( ) )
137139 or
138- key = "Macro calls - resolved" and value = count ( MacroCall mc | mc .hasMacroCallExpansion ( ) )
140+ key = "Macro calls - resolved" and
141+ value = count ( MacroCall mc | mc .fromSource ( ) and mc .hasMacroCallExpansion ( ) )
139142 or
140- key = "Macro calls - unresolved" and value = count ( MacroCall mc | not mc .hasMacroCallExpansion ( ) )
143+ key = "Macro calls - unresolved" and
144+ value = count ( MacroCall mc | mc .fromSource ( ) and not mc .hasMacroCallExpansion ( ) )
141145}
142146
143147/**
0 commit comments