@@ -380,15 +380,11 @@ export interface UploadResult {
380380 sarifID : string ;
381381}
382382
383- export const qualityIsSarif = ( name : string ) => name . endsWith ( ".quality.sarif" ) ;
384- export const defaultIsSarif = ( name : string ) =>
385- name . endsWith ( ".sarif" ) && ! qualityIsSarif ( name ) ;
386-
387383// Recursively walks a directory and returns all SARIF files it finds.
388384// Does not follow symlinks.
389385export function findSarifFilesInDir (
390386 sarifPath : string ,
391- isSarif : ( name : string ) => boolean = defaultIsSarif ,
387+ isSarif : ( name : string ) => boolean = CodeScanningTarget . sarifPredicate ,
392388) : string [ ] {
393389 const sarifFiles : string [ ] = [ ] ;
394390 const walkSarifFiles = ( dir : string ) => {
@@ -407,7 +403,7 @@ export function findSarifFilesInDir(
407403
408404export function getSarifFilePaths (
409405 sarifPath : string ,
410- isSarif : ( name : string ) => boolean = defaultIsSarif ,
406+ isSarif : ( name : string ) => boolean = CodeScanningTarget . sarifPredicate ,
411407) {
412408 if ( ! fs . existsSync ( sarifPath ) ) {
413409 // This is always a configuration error, even for first-party runs.
@@ -585,23 +581,23 @@ export function buildPayload(
585581export interface UploadTarget {
586582 name : string ;
587583 target : SARIF_UPLOAD_ENDPOINT ;
588- sarifFilter : ( name : string ) => boolean ;
584+ sarifPredicate : ( name : string ) => boolean ;
589585 sentinelPrefix : string ;
590586}
591587
592588// Represents the Code Scanning upload target.
593589export const CodeScanningTarget : UploadTarget = {
594590 name : "code scanning" ,
595591 target : SARIF_UPLOAD_ENDPOINT . CODE_SCANNING_UPLOAD_TARGET ,
596- sarifFilter : defaultIsSarif ,
592+ sarifPredicate : ( name ) => name . endsWith ( ".sarif" ) && ! CodeQualityTarget . sarifPredicate ( name ) ,
597593 sentinelPrefix : "CODEQL_UPLOAD_SARIF_" ,
598594} ;
599595
600596// Represents the Code Quality upload target.
601597export const CodeQualityTarget : UploadTarget = {
602598 name : "code quality" ,
603599 target : SARIF_UPLOAD_ENDPOINT . CODE_QUALITY_UPLOAD_TARGET ,
604- sarifFilter : qualityIsSarif ,
600+ sarifPredicate : ( name ) => name . endsWith ( ".quality.sarif" ) ,
605601 sentinelPrefix : "CODEQL_UPLOAD_QUALITY_SARIF_" ,
606602} ;
607603
@@ -619,7 +615,7 @@ export async function uploadFiles(
619615) : Promise < UploadResult > {
620616 const sarifPaths = getSarifFilePaths (
621617 inputSarifPath ,
622- uploadTarget . sarifFilter ,
618+ uploadTarget . sarifPredicate ,
623619 ) ;
624620
625621 return uploadSpecifiedFiles (
0 commit comments