Skip to content

Commit 30ebe0a

Browse files
Don't use shorthand boolean for large method calls
To make it clear what the search is doing and make the code more readable. Co-authored-by: Robert Brignull <robertbrignull@github.com>
1 parent 28745da commit 30ebe0a

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

extensions/ql-vscode/src/skeleton-query-wizard.ts

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -269,18 +269,21 @@ export class SkeletonQueryWizard {
269269
throw new Error("Language is undefined");
270270
}
271271

272-
const databaseNwo = QUERY_LANGUAGE_TO_DATABASE_REPO[this.language];
273-
274-
return (
275-
(await this.findDatabaseItemByNwo(
276-
this.language,
277-
databaseNwo,
278-
this.databaseManager.databaseItems,
279-
)) ||
280-
(await this.findDatabaseItemByLanguage(
281-
this.language,
282-
this.databaseManager.databaseItems,
283-
))
272+
const defaultDatabaseNwo = QUERY_LANGUAGE_TO_DATABASE_REPO[this.language];
273+
274+
const defaultDatabaseItem = await this.findDatabaseItemByNwo(
275+
this.language,
276+
defaultDatabaseNwo,
277+
this.databaseManager.databaseItems,
278+
);
279+
280+
if (defaultDatabaseItem !== undefined) {
281+
return defaultDatabaseItem;
282+
}
283+
284+
return await this.findDatabaseItemByLanguage(
285+
this.language,
286+
this.databaseManager.databaseItems,
284287
);
285288
}
286289
}

0 commit comments

Comments
 (0)