Skip to content

Commit 20aafcd

Browse files
committed
Remove unnecessary type assertions
1 parent 6a1c070 commit 20aafcd

File tree

8 files changed

+23
-11
lines changed

8 files changed

+23
-11
lines changed

lib/analyze.js

Lines changed: 5 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/analyze.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/config-utils.js

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/config-utils.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/tracer-config.test.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/analyze.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,12 @@ export async function runQueries(
191191

192192
try {
193193
if (hasPackWithCustomQueries) {
194+
logger.info("*************");
195+
logger.info(
196+
"Performing analysis with custom QL Packs. QL Packs are an experimental feature."
197+
);
198+
logger.info("And should not be used in production yet.");
199+
logger.info("*************");
194200
logger.startGroup(`Downloading custom packs for ${language}`);
195201

196202
const codeql = getCodeQL(config.codeQLCmd);
@@ -338,7 +344,7 @@ function packWithVersionToQuerySuiteEntry(
338344
): string {
339345
let text = `- qlpack: ${pack.packName}`;
340346
if (pack.version) {
341-
text += `${"\n"} version: ${pack.version}`;
347+
text += `\n version: ${pack.version}`;
342348
}
343349
return text;
344350
}

src/config-utils.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -845,7 +845,7 @@ export async function getDefaultConfig(
845845
queries,
846846
pathsIgnore: [],
847847
paths: [],
848-
packs: {} as Record<Language, PackWithVersion[]>,
848+
packs: {},
849849
originalUserInput: {},
850850
tempDir,
851851
toolCacheDir,
@@ -942,10 +942,11 @@ async function loadConfig(
942942
shouldAddConfigFileQueries(queriesInput) &&
943943
QUERIES_PROPERTY in parsedYAML
944944
) {
945-
if (!Array.isArray(parsedYAML[QUERIES_PROPERTY])) {
945+
const queriesArr = parsedYAML[QUERIES_PROPERTY];
946+
if (!Array.isArray(queriesArr)) {
946947
throw new Error(getQueriesInvalid(configFile));
947948
}
948-
for (const query of parsedYAML[QUERIES_PROPERTY]!) {
949+
for (const query of queriesArr) {
949950
if (
950951
!(QUERIES_USES_PROPERTY in query) ||
951952
typeof query[QUERIES_USES_PROPERTY] !== "string"

src/tracer-config.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ function getTestConfig(tmpDir: string): configUtils.Config {
2828
codeQLCmd: "",
2929
gitHubVersion: { type: util.GitHubVariant.DOTCOM } as util.GitHubVersion,
3030
dbLocation: path.resolve(tmpDir, "codeql_databases"),
31-
packs: {} as configUtils.Packs,
31+
packs: {},
3232
};
3333
}
3434

0 commit comments

Comments
 (0)