Refactoring: Add getExtractionVerbosityArguments wrapper

This commit is contained in:
Henry Mercer 2024-03-13 18:27:21 +00:00
parent 070b05147a
commit 8da95d81a8
3 changed files with 20 additions and 19 deletions

View file

@ -692,9 +692,7 @@ export async function getCodeQLForCmd(
"trace-command",
"--index-traceless-dbs",
...(await getTrapCachingExtractorConfigArgsForLang(config, language)),
...(config.debugMode
? [`--verbosity=${EXTRACTION_DEBUG_MODE_VERBOSITY}`]
: []),
...getExtractionVerbosityArguments(config.debugMode),
...getExtraOptionsFromEnv(["database", "trace-command"]),
util.getCodeQLDatabasePath(config, language),
]);
@ -705,9 +703,7 @@ export async function getCodeQLForCmd(
"trace-command",
"--use-build-mode",
...(await getTrapCachingExtractorConfigArgsForLang(config, language)),
...(config.debugMode
? [`--verbosity=${EXTRACTION_DEBUG_MODE_VERBOSITY}`]
: []),
...getExtractionVerbosityArguments(config.debugMode),
...getExtraOptionsFromEnv(["database", "trace-command"]),
util.getCodeQLDatabasePath(config, language),
]);
@ -724,9 +720,7 @@ export async function getCodeQLForCmd(
"--finalize-dataset",
threadsFlag,
memoryFlag,
...(enableDebugLogging
? [`--verbosity=${EXTRACTION_DEBUG_MODE_VERBOSITY}`]
: []),
...getExtractionVerbosityArguments(enableDebugLogging),
...getExtraOptionsFromEnv(["database", "finalize"]),
databasePath,
];
@ -1425,3 +1419,11 @@ async function getCodeScanningQueryHelpArguments(
}
return ["--sarif-add-query-help"];
}
function getExtractionVerbosityArguments(
enableDebugLogging: boolean,
): string[] {
return enableDebugLogging
? [`--verbosity=${EXTRACTION_DEBUG_MODE_VERBOSITY}`]
: [];
}