File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -818,13 +818,6 @@ export function fixInvalidNotifications(
818818 sarif : SarifFile ,
819819 logger : Logger
820820) : SarifFile {
821- if ( process . env [ CODEQL_ACTION_DISABLE_DUPLICATE_LOCATION_FIX ] === "true" ) {
822- logger . info (
823- "SARIF notification object duplicate location fix disabled by the " +
824- `${ CODEQL_ACTION_DISABLE_DUPLICATE_LOCATION_FIX } environment variable.`
825- ) ;
826- return sarif ;
827- }
828821 if ( ! Array . isArray ( sarif . runs ) ) {
829822 return sarif ;
830823 }
@@ -888,9 +881,17 @@ export function fixInvalidNotificationsInFile(
888881 outputPath : string ,
889882 logger : Logger
890883) : void {
891- let sarif = JSON . parse ( fs . readFileSync ( inputPath , "utf8" ) ) as SarifFile ;
892- sarif = fixInvalidNotifications ( sarif , logger ) ;
893- fs . writeFileSync ( outputPath , JSON . stringify ( sarif ) ) ;
884+ if ( process . env [ CODEQL_ACTION_DISABLE_DUPLICATE_LOCATION_FIX ] === "true" ) {
885+ logger . info (
886+ "SARIF notification object duplicate location fix disabled by the " +
887+ `${ CODEQL_ACTION_DISABLE_DUPLICATE_LOCATION_FIX } environment variable.`
888+ ) ;
889+ fs . renameSync ( inputPath , outputPath ) ;
890+ } else {
891+ let sarif = JSON . parse ( fs . readFileSync ( inputPath , "utf8" ) ) as SarifFile ;
892+ sarif = fixInvalidNotifications ( sarif , logger ) ;
893+ fs . writeFileSync ( outputPath , JSON . stringify ( sarif ) ) ;
894+ }
894895}
895896
896897export function wrapError ( error : unknown ) : Error {
You can’t perform that action at this time.
0 commit comments