Use more explicit checks on .length for readability

This commit is contained in:
Henry Mercer
2025-08-05 17:55:50 +01:00
parent e682065360
commit ea05bf27b6
15 changed files with 15 additions and 15 deletions
+1 -1
View File
@@ -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
View File
@@ -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
View File
@@ -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
View File
@@ -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
View File
@@ -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}`);