Auto-fix linting errors

This commit is contained in:
Angela P Wen 2023-07-25 10:29:00 +02:00
parent eff6331393
commit b16296be30
52 changed files with 1182 additions and 1172 deletions

View file

@ -55,18 +55,18 @@ export async function sendStatusReport(
trapCacheUploadTime: number | undefined,
dbCreationTimings: DatabaseCreationTimings | undefined,
didUploadTrapCaches: boolean,
logger: Logger
logger: Logger,
) {
const status = actionsUtil.getActionsStatus(
error,
stats?.analyze_failure_language
stats?.analyze_failure_language,
);
const statusReportBase = await api.createStatusReportBase(
"finish",
status,
startedAt,
error?.message,
error?.stack
error?.stack,
);
const statusReport: FinishStatusReport = {
...statusReportBase,
@ -83,7 +83,7 @@ export async function sendStatusReport(
...statusReport,
trap_cache_upload_duration_ms: Math.round(trapCacheUploadTime || 0),
trap_cache_upload_size_bytes: Math.round(
await getTotalCacheSize(config.trapCaches, logger)
await getTotalCacheSize(config.trapCaches, logger),
),
};
await api.sendStatusReport(trapCacheUploadStatusReport);
@ -119,7 +119,7 @@ function doesGoExtractionOutputExist(config: Config): boolean {
".trap.tar.gz",
".trap.tar.br",
".trap.tar",
].some((ext) => fileName.endsWith(ext))
].some((ext) => fileName.endsWith(ext)),
)
);
}
@ -147,20 +147,20 @@ async function runAutobuildIfLegacyGoWorkflow(config: Config, logger: Logger) {
}
if (dbIsFinalized(config, Language.go, logger)) {
logger.debug(
"Won't run Go autobuild since there is already a finalized database for Go."
"Won't run Go autobuild since there is already a finalized database for Go.",
);
return;
}
// This captures whether a user has added manual build steps for Go
if (doesGoExtractionOutputExist(config)) {
logger.debug(
"Won't run Go autobuild since at least one file of Go code has already been extracted."
"Won't run Go autobuild since at least one file of Go code has already been extracted.",
);
// If the user has run the manual build step, and has set the `CODEQL_EXTRACTOR_GO_BUILD_TRACING`
// variable, we suggest they remove it from their workflow.
if ("CODEQL_EXTRACTOR_GO_BUILD_TRACING" in process.env) {
logger.warning(
`The CODEQL_EXTRACTOR_GO_BUILD_TRACING environment variable has no effect on workflows with manual build steps, so we recommend that you remove it from your workflow.`
`The CODEQL_EXTRACTOR_GO_BUILD_TRACING environment variable has no effect on workflows with manual build steps, so we recommend that you remove it from your workflow.`,
);
}
return;
@ -182,7 +182,7 @@ async function run() {
try {
if (
!(await api.sendStatusReport(
await api.createStatusReportBase("finish", "starting", startedAt)
await api.createStatusReportBase("finish", "starting", startedAt),
))
) {
return;
@ -190,13 +190,13 @@ async function run() {
config = await getConfig(actionsUtil.getTemporaryDirectory(), logger);
if (config === undefined) {
throw new Error(
"Config file could not be found at expected location. Has the 'init' action been called?"
"Config file could not be found at expected location. Has the 'init' action been called?",
);
}
if (hasBadExpectErrorInput()) {
throw new Error(
"`expect-error` input parameter is for internal use only. It should only be set by codeql-action or a fork."
"`expect-error` input parameter is for internal use only. It should only be set by codeql-action or a fork.",
);
}
@ -204,11 +204,11 @@ async function run() {
const outputDir = actionsUtil.getRequiredInput("output");
const threads = util.getThreadsFlag(
actionsUtil.getOptionalInput("threads") || process.env["CODEQL_THREADS"],
logger
logger,
);
const repositoryNwo = parseRepositoryNwo(
util.getRequiredEnvParam("GITHUB_REPOSITORY")
util.getRequiredEnvParam("GITHUB_REPOSITORY"),
);
const gitHubVersion = await getGitHubVersion();
@ -217,12 +217,12 @@ async function run() {
gitHubVersion,
repositoryNwo,
actionsUtil.getTemporaryDirectory(),
logger
logger,
);
const memory = util.getMemoryFlag(
actionsUtil.getOptionalInput("ram") || process.env["CODEQL_RAM"],
await features.getValue(Feature.ScalingReservedRamEnabled)
await features.getValue(Feature.ScalingReservedRamEnabled),
);
await runAutobuildIfLegacyGoWorkflow(config, logger);
@ -233,7 +233,7 @@ async function run() {
memory,
config,
logger,
features
features,
);
if (actionsUtil.getRequiredInput("skip-queries") !== "true") {
@ -245,7 +245,7 @@ async function run() {
actionsUtil.getOptionalInput("category"),
config,
logger,
features
features,
);
}
@ -253,7 +253,7 @@ async function run() {
await runCleanup(
config,
actionsUtil.getOptionalInput("cleanup-level") || "brutal",
logger
logger,
);
}
@ -268,7 +268,7 @@ async function run() {
outputDir,
actionsUtil.getRequiredInput("checkout_path"),
actionsUtil.getOptionalInput("category"),
logger
logger,
);
core.setOutput("sarif-id", uploadResult.sarifID);
} else {
@ -294,13 +294,13 @@ async function run() {
await uploadLib.waitForProcessing(
parseRepositoryNwo(util.getRequiredEnvParam("GITHUB_REPOSITORY")),
uploadResult.sarifID,
getActionsLogger()
getActionsLogger(),
);
}
// If we did not throw an error yet here, but we expect one, throw it.
if (actionsUtil.getOptionalInput("expect-error") === "true") {
core.setFailed(
`expect-error input was set to true but no error was thrown.`
`expect-error input was set to true but no error was thrown.`,
);
}
core.exportVariable(EnvVar.ANALYZE_DID_COMPLETE_SUCCESSFULLY, "true");
@ -323,7 +323,7 @@ async function run() {
trapCacheUploadTime,
dbCreationTimings,
didUploadTrapCaches,
logger
logger,
);
} else {
await sendStatusReport(
@ -334,7 +334,7 @@ async function run() {
trapCacheUploadTime,
dbCreationTimings,
didUploadTrapCaches,
logger
logger,
);
}
@ -353,7 +353,7 @@ async function run() {
trapCacheUploadTime,
dbCreationTimings,
didUploadTrapCaches,
logger
logger,
);
} else if (runStats) {
await sendStatusReport(
@ -364,7 +364,7 @@ async function run() {
trapCacheUploadTime,
dbCreationTimings,
didUploadTrapCaches,
logger
logger,
);
} else {
await sendStatusReport(
@ -375,7 +375,7 @@ async function run() {
trapCacheUploadTime,
dbCreationTimings,
didUploadTrapCaches,
logger
logger,
);
}
}