Skip to content

Commit

Permalink
Soften deprecation message wording and remove unhelpful version strin…
Browse files Browse the repository at this point in the history
…gs from some locations
  • Loading branch information
NlightNFotis committed May 13, 2024
1 parent bcc1365 commit df4819e
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 26 deletions.
24 changes: 16 additions & 8 deletions lib/setup-codeql.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/setup-codeql.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions lib/setup-codeql.test.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/setup-codeql.test.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/setup-codeql.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ test("getCodeQLSource correctly returns bundled CLI version when tools == latest

// Afterwards, ensure that we see the deprecation message in the log.
const expected_message: string =
"The 'latest' alias for the CodeQL tools has been deprecated. Please use 'linked' instead.";
"`tools: latest` has been renamed to `tools: linked`, but the old name is still supported for now. No action is required.";
t.assert(
loggedMessages.some(
(msg) =>
Expand Down Expand Up @@ -216,7 +216,7 @@ test("setupCodeQLBundle logs the CodeQL CLI version being used when asked to dow
t.is(result.toolsVersion, expectedVersion);

// Ensure message logging CodeQL CLI version was present in user logs.
const expected_message: string = `Using CodeQL CLI version 2.16.0 downloaded from ${bundleUrl}.`;
const expected_message: string = `Using CodeQL CLI version 2.16.0 sourced from ${bundleUrl}.`;
t.assert(
loggedMessages.some(
(msg) =>
Expand Down
28 changes: 16 additions & 12 deletions src/setup-codeql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ export async function getCodeQLSource(
!CODEQL_BUNDLE_VERSION_ALIAS.includes(toolsInput) &&
!toolsInput.startsWith("http")
) {
logger.info("Using CodeQL CLI from local path $path");
logger.info(`Using CodeQL CLI from local path ${toolsInput}`);
return {
codeqlTarPath: toolsInput,
sourceType: "local",
Expand Down Expand Up @@ -317,7 +317,7 @@ export async function getCodeQLSource(

if (toolsInput === "latest") {
logger.warning(
"The 'latest' alias for the CodeQL tools has been deprecated. Please use 'linked' instead.",
"`tools: latest` has been renamed to `tools: linked`, but the old name is still supported for now. No action is required.",
);
}
}
Expand Down Expand Up @@ -442,14 +442,17 @@ export async function getCodeQLSource(
}

if (codeqlFolder) {
const version = cliVersion ?? humanReadableVersion;
logger.info(
`Using CodeQL CLI version ${version} from toolcache at ${codeqlFolder}`,
);
if (cliVersion) {
logger.info(
`Using CodeQL CLI version ${cliVersion} from toolcache at ${codeqlFolder}`,
);
} else {
logger.info(`Using CodeQL CLI from toolcache at ${codeqlFolder}`);
}
return {
codeqlFolder,
sourceType: "toolcache",
toolsVersion: version,
toolsVersion: cliVersion ?? humanReadableVersion,
};
}

Expand All @@ -474,16 +477,17 @@ export async function getCodeQLSource(
url = await getCodeQLBundleDownloadURL(tagName!, apiDetails, logger);
}

const toolsVersion = cliVersion ?? humanReadableVersion;
logger.info(
`Using CodeQL CLI version ${toolsVersion} downloaded from ${url}.`,
);
if (cliVersion) {
logger.info(`Using CodeQL CLI version ${cliVersion} sourced from ${url}.`);
} else {
logger.info(`Using CodeQL CLI sourced from ${url}.`);
}
return {
bundleVersion: tagName && tryGetBundleVersionFromTagName(tagName, logger),
cliVersion,
codeqlURL: url,
sourceType: "download",
toolsVersion,
toolsVersion: cliVersion ?? humanReadableVersion,
};
}

Expand Down

0 comments on commit df4819e

Please sign in to comment.