From 359f822ab5f265edc6866f4e7738311fa2d284c1 Mon Sep 17 00:00:00 2001 From: David Waltermire Date: Fri, 1 Nov 2024 23:14:35 -0400 Subject: [PATCH] Refactored code to reduce warnings. --- .../cli/processor/CLIProcessor.java | 9 +- .../modules/sarif/SarifValidationHandler.java | 5 +- .../sarif/SarifValidationHandlerTest.java | 3 +- metaschema-cli/pom.xml | 3 +- .../gov/nist/secauto/metaschema/cli/CLI.java | 3 + .../commands/AbstractConvertSubcommand.java | 8 +- .../AbstractValidateContentCommand.java | 119 ++++++-- .../ConvertContentUsingModuleCommand.java | 6 +- .../cli/commands/GenerateDiagramCommand.java | 9 +- .../cli/commands/GenerateSchemaCommand.java | 84 ++--- .../cli/commands/MetaschemaCommands.java | 289 ++++++++++++++---- .../ValidateContentUsingModuleCommand.java | 6 +- .../cli/commands/ValidateModuleCommand.java | 3 + .../metapath/EvaluateMetapathCommand.java | 28 +- .../metapath/ListFunctionsSubcommand.java | 7 +- .../commands/metapath/MetapathCommand.java | 4 + .../cli/util/LoggingValidationHandler.java | 4 + .../nist/secauto/metaschema/cli/CLITest.java | 28 +- .../EvaluateMetapathSubCommandTest.java | 6 +- metaschema-maven-plugin/pom.xml | 15 +- 20 files changed, 425 insertions(+), 214 deletions(-) diff --git a/cli-processor/src/main/java/gov/nist/secauto/metaschema/cli/processor/CLIProcessor.java b/cli-processor/src/main/java/gov/nist/secauto/metaschema/cli/processor/CLIProcessor.java index 17c015a00..a18b2abc5 100644 --- a/cli-processor/src/main/java/gov/nist/secauto/metaschema/cli/processor/CLIProcessor.java +++ b/cli-processor/src/main/java/gov/nist/secauto/metaschema/cli/processor/CLIProcessor.java @@ -214,8 +214,7 @@ public static void handleQuiet() { } protected void showVersion() { - @SuppressWarnings("resource") - PrintStream out = AnsiConsole.out(); // NOPMD - not owner + @SuppressWarnings("resource") PrintStream out = AnsiConsole.out(); // NOPMD - not owner getVersionInfos().values().stream().forEach(info -> { out.println(ansi() .bold().a(info.getName()).boldOff() @@ -253,8 +252,7 @@ public class CallingContext { @SuppressFBWarnings(value = "CT_CONSTRUCTOR_THROW", justification = "Use of final fields") public CallingContext(@NonNull List args) { - @SuppressWarnings("PMD.LooseCoupling") - LinkedList calledCommands = new LinkedList<>(); + @SuppressWarnings("PMD.LooseCoupling") LinkedList calledCommands = new LinkedList<>(); List