mirror of
https://github.com/github/codeql-action.git
synced 2026-04-26 00:38:48 +00:00
Use more explicit checks on .length for readability
This commit is contained in:
+1
-1
@@ -37,7 +37,7 @@ export async function determineAutobuildLanguages(
|
||||
async (language) => await codeql.isTracedLanguage(language),
|
||||
);
|
||||
|
||||
if (!autobuildLanguages.length) {
|
||||
if (autobuildLanguages.length === 0) {
|
||||
logger.info(
|
||||
"None of the languages in this project require extra build steps",
|
||||
);
|
||||
|
||||
+1
-1
@@ -427,7 +427,7 @@ export async function getRawLanguages(
|
||||
}> {
|
||||
// If the user has specified languages, use those.
|
||||
const languagesFromInput = getRawLanguagesNoAutodetect(languagesInput);
|
||||
if (languagesFromInput.length) {
|
||||
if (languagesFromInput.length > 0) {
|
||||
return { rawLanguages: languagesFromInput, autodetected: false };
|
||||
}
|
||||
// Otherwise, autodetect languages in the repository.
|
||||
|
||||
+1
-1
@@ -138,7 +138,7 @@ export function cleanupDatabaseClusterDirectory(
|
||||
if (
|
||||
fs.existsSync(config.dbLocation) &&
|
||||
(fs.statSync(config.dbLocation).isFile() ||
|
||||
fs.readdirSync(config.dbLocation).length)
|
||||
fs.readdirSync(config.dbLocation).length > 0)
|
||||
) {
|
||||
logger.warning(
|
||||
`The database cluster directory ${config.dbLocation} must be empty. Attempting to clean it up.`,
|
||||
|
||||
+1
-1
@@ -155,7 +155,7 @@ export function tryGetTagNameFromUrl(
|
||||
logger: Logger,
|
||||
): string | undefined {
|
||||
const matches = [...url.matchAll(/\/(codeql-bundle-[^/]*)\//g)];
|
||||
if (!matches.length) {
|
||||
if (matches.length === 0) {
|
||||
logger.debug(`Could not determine tag name for URL ${url}.`);
|
||||
return undefined;
|
||||
}
|
||||
|
||||
+1
-1
@@ -541,7 +541,7 @@ export function validateSarifFileSchema(
|
||||
);
|
||||
}
|
||||
|
||||
if (errors.length) {
|
||||
if (errors.length > 0) {
|
||||
// Output the more verbose error messages in groups as these may be very large.
|
||||
for (const error of errors) {
|
||||
logger.startGroup(`Error details: ${error.stack}`);
|
||||
|
||||
Reference in New Issue
Block a user