From 4335f19a6ac7b6ba69d35f95e7e4adf85b2e4fb8 Mon Sep 17 00:00:00 2001 From: "Steven R. Loomis" Date: Mon, 24 Jun 2024 09:48:26 -0500 Subject: [PATCH] fix(developer): remove redundant check in linter - simplify LdmlKeyboardCompiler.validate() by removing a redundant check --- developer/src/kmc-ldml/src/compiler/compiler.ts | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/developer/src/kmc-ldml/src/compiler/compiler.ts b/developer/src/kmc-ldml/src/compiler/compiler.ts index 59ed5f9a072..bdb11ac176d 100644 --- a/developer/src/kmc-ldml/src/compiler/compiler.ts +++ b/developer/src/kmc-ldml/src/compiler/compiler.ts @@ -291,10 +291,14 @@ export class LdmlKeyboardCompiler implements KeymanCompiler { } /** - * Runs any linter steps + * Runs any linter steps, adding hints to the callbacks as needed * @internal + * @returns true unless there was a linter failure. */ private async lint(source: LDMLKeyboardXMLSourceFile, kmx: KMXPlus.KMXPlusFile) : Promise { + if (!kmx || !source) { + return false; + } // run each of the linters for (const linter of this.buildLinters(source, kmx)) { if (!await linter.lint()) { @@ -319,12 +323,7 @@ export class LdmlKeyboardCompiler implements KeymanCompiler { } // Run the linters - if (!await this.lint(source, kmx)) { - return false; - } - - // We are valid if we have a keyboard file at this point. - return !!kmx; + return (await this.lint(source, kmx)); } /**