fix linter

This commit is contained in:
Marco Gario
2020-09-15 15:50:23 +02:00
parent b9e8fa6371
commit 4d836f4b5a
24 changed files with 464 additions and 364 deletions
Generated
+17 -13
View File
@@ -73,14 +73,16 @@ async function getCodeQLBundleDownloadURL(bundleNames, githubAuth, githubUrl, mo
}
const [repositoryOwner, repositoryName] = repository.split("/");
try {
const release = await api.getApiClient(githubAuth, githubUrl).repos.getReleaseByTag({
const release = await api
.getApiClient(githubAuth, githubUrl)
.repos.getReleaseByTag({
owner: repositoryOwner,
repo: repositoryName,
tag: CODEQL_BUNDLE_VERSION
tag: CODEQL_BUNDLE_VERSION,
});
// See if any of the bundles appears in the assets list
for (let bundleName of bundleNames) {
for (let asset of release.data.assets) {
for (const bundleName of bundleNames) {
for (const asset of release.data.assets) {
if (asset.name === bundleName) {
logger.info(`Found CodeQL bundle in ${downloadSource[1]} on ${downloadSource[0]} with URL ${asset.url}.`);
return asset.url;
@@ -132,17 +134,17 @@ async function setupCodeQL(codeqlURL, languages, githubAuth, githubUrl, tempDir,
// - If multiple languages are being anlyzed, use the full bundle
let plVersion = undefined;
let platform;
if (process.platform === 'win32') {
if (process.platform === "win32") {
platform = "win64";
}
else if (process.platform === 'linux') {
else if (process.platform === "linux") {
platform = "linux64";
}
else if (process.platform === 'darwin') {
else if (process.platform === "darwin") {
platform = "osx64";
}
else {
throw new Error("Unsupported platform: " + process.platform);
throw new Error(`Unsupported platform: ${process.platform}`);
}
if (languages.length === 1) {
plVersion = `${platform}-${languages[0]}`;
@@ -152,23 +154,25 @@ async function setupCodeQL(codeqlURL, languages, githubAuth, githubUrl, tempDir,
let codeqlFolder;
logger.debug(`PL Version ${plVersion}`);
if (plVersion) {
codeqlFolder = toolcache.find('CodeQL', `${codeqlURLVersion}-${plVersion}`);
codeqlFolder = toolcache.find("CodeQL", `${codeqlURLVersion}-${plVersion}`);
if (codeqlFolder) {
logger.debug(`CodeQL found in cache ${codeqlFolder}`);
}
}
if (!codeqlFolder) {
codeqlFolder = toolcache.find('CodeQL', codeqlURLVersion);
codeqlFolder = toolcache.find("CodeQL", codeqlURLVersion);
if (codeqlFolder) {
logger.debug(`CodeQL found in cache ${codeqlFolder}`);
}
}
if (!codeqlFolder) {
const codeqlToolcacheVersion = plVersion ? `${codeqlURLVersion}-${plVersion}` : codeqlURLVersion;
const codeqlToolcacheVersion = plVersion
? `${codeqlURLVersion}-${plVersion}`
: codeqlURLVersion;
logger.debug(`CodeQL not found in cache`);
if (!codeqlURL) {
// Provide a few options, from smaller to bigger
let bundles = [];
const bundles = [];
if (plVersion) {
bundles.push(CODEQL_BUNDLE_NAME.replace("-bundle", `-bundle-${plVersion}`));
}
@@ -193,7 +197,7 @@ async function setupCodeQL(codeqlURL, languages, githubAuth, githubUrl, tempDir,
logger.debug(`CodeQL bundle download to ${codeqlPath} complete.`);
const codeqlExtracted = await toolcache.extractTar(codeqlPath);
logger.debug(`Caching ${codeqlToolcacheVersion}`);
codeqlFolder = await toolcache.cacheDir(codeqlExtracted, 'CodeQL', codeqlToolcacheVersion);
codeqlFolder = await toolcache.cacheDir(codeqlExtracted, "CodeQL", codeqlToolcacheVersion);
}
let codeqlCmd = path.join(codeqlFolder, "codeql", "codeql");
if (process.platform === "win32") {