Fix failing test and address PR comments
This commit is contained in:
parent
2314063848
commit
a09a029937
12 changed files with 28 additions and 15 deletions
|
|
@ -1234,13 +1234,16 @@ async function runTool(cmd: string, args: string[] = []) {
|
|||
* @param config The configuration to use.
|
||||
* @returns the path to the generated user configuration file.
|
||||
*/
|
||||
async function generateCodescanningConfig(codeql: CodeQL, config: Config) {
|
||||
async function generateCodescanningConfig(
|
||||
codeql: CodeQL,
|
||||
config: Config
|
||||
): Promise<string | undefined> {
|
||||
if (!(await util.useCodeScanningConfigInCli(codeql))) {
|
||||
return;
|
||||
}
|
||||
const configLocation = path.resolve(config.tempDir, "user-config.yaml");
|
||||
// make a copy so we can modify it
|
||||
const augmentedConfig = JSON.parse(JSON.stringify(config.originalUserInput));
|
||||
const augmentedConfig = cloneObject(config.originalUserInput);
|
||||
|
||||
// Inject the queries from the input
|
||||
if (config.augmentationProperties.queriesInput) {
|
||||
|
|
@ -1299,3 +1302,7 @@ async function generateCodescanningConfig(codeql: CodeQL, config: Config) {
|
|||
fs.writeFileSync(configLocation, yaml.dump(augmentedConfig));
|
||||
return configLocation;
|
||||
}
|
||||
|
||||
function cloneObject(obj: any) {
|
||||
return JSON.parse(JSON.stringify(obj));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1623,7 +1623,7 @@ function parseInputAndConfigMacro(
|
|||
configUtils.parsePacks(
|
||||
packsFromConfig,
|
||||
packsFromInput,
|
||||
!!packsFromInput?.trim().startsWith("+"),
|
||||
!!packsFromInput?.trim().startsWith("+"), // coerce to boolean
|
||||
languages,
|
||||
"/a/b",
|
||||
mockLogger
|
||||
|
|
|
|||
|
|
@ -198,6 +198,8 @@ export const defaultAugmentationProperties: AugmentationProperties = {
|
|||
queriesInputCombines: false,
|
||||
packsInputCombines: false,
|
||||
injectedMlQueries: false,
|
||||
packsInput: undefined,
|
||||
queriesInput: undefined,
|
||||
};
|
||||
|
||||
export type Packs = Partial<Record<Language, string[]>>;
|
||||
|
|
|
|||
|
|
@ -776,8 +776,7 @@ export async function useCodeScanningConfigInCli(
|
|||
codeql: CodeQL
|
||||
): Promise<boolean> {
|
||||
return (
|
||||
(process.env[EnvVar.CODEQL_PASS_CONFIG_TO_CLI] === "true" &&
|
||||
(await codeQlVersionAbove(codeql, CODEQL_VERSION_CONFIG_FILES))) ||
|
||||
false
|
||||
process.env[EnvVar.CODEQL_PASS_CONFIG_TO_CLI] === "true" &&
|
||||
(await codeQlVersionAbove(codeql, CODEQL_VERSION_CONFIG_FILES))
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue