From: Sangwook Ha Date: Fri, 22 Apr 2022 16:13:03 +0000 (-0700) Subject: Fix the short option for 'no-warning-for-unkeyed-lists' X-Git-Tag: v8.0.4~11 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=yangtools.git;a=commitdiff_plain;h=c26026934f6cbfe07ec86b6cbc6c23229f67d5a5 Fix the short option for 'no-warning-for-unkeyed-lists' Dash "-" is not allowed in the short option string. Replace it with 'K', a single character option consistent with others. Having two options to control warnings on the unkeyed list, although mutually exclusive, makes the default behavior unclear when neither option is used. Simplify the options by removing 'warning-for-unkeyed-lists' while preserving the original default behavior of warning against unkeyed lists when neither option is used. JIRA: YANGTOOLS-1429 Change-Id: I6c37892ae7e39864420a0e6c15dd2fc1cf0ba952 Signed-off-by: Sangwook Ha (cherry picked from commit db8732c024c02cadb7814149fe23fab85533944b) --- diff --git a/tools/yang-model-validator/src/main/java/org/opendaylight/yangtools/yang/validator/Main.java b/tools/yang-model-validator/src/main/java/org/opendaylight/yangtools/yang/validator/Main.java index 858d7b9e22..1d9aac62de 100644 --- a/tools/yang-model-validator/src/main/java/org/opendaylight/yangtools/yang/validator/Main.java +++ b/tools/yang-model-validator/src/main/java/org/opendaylight/yangtools/yang/validator/Main.java @@ -49,8 +49,8 @@ import org.slf4j.LoggerFactory; * -v, --verbose shows details about the results of test running. * -o, --output path to output file for logs. Output file will be overwritten. * -m, --module-name validate yang by module name. - * -wul, --warning-for-unkeyed-lists - * add warnings about unkeyed lists with config true. + * -K, --no-warning-for-unkeyed-lists + * do not add warnings about unkeyed lists with config true. */ @SuppressWarnings({"checkstyle:LoggerMustBeSlf4j", "checkstyle:LoggerFactoryClassParameter"}) public final class Main { @@ -78,9 +78,7 @@ public final class Main { private static final Option QUIET = new Option("q", "quiet", false, "completely suppress output."); private static final Option VERBOSE = new Option("v", "verbose", false, "shows details about the results of test running."); - private static final Option LIST_WARNING_ON = new Option("wul", "warning-for-unkeyed-lists", false, - "add warnings about unkeyed lists with config true"); - private static final Option LIST_WARNING_OFF = new Option("no-wul", "no-warning-for-unkeyed-lists", false, + private static final Option LIST_WARNING_OFF = new Option("K", "no-warning-for-unkeyed-lists", false, "do not add warnings about unkeyed lists with config true"); private Main() { @@ -93,7 +91,7 @@ public final class Main { .addOption(PATH) .addOption(RECURSIVE) .addOptionGroup(new OptionGroup().addOption(DEBUG).addOption(QUIET).addOption(VERBOSE)) - .addOptionGroup(new OptionGroup().addOption(LIST_WARNING_ON).addOption(LIST_WARNING_OFF)) + .addOption(LIST_WARNING_OFF) .addOption(OUTPUT) .addOption(MODULE_NAME) .addOption(FEATURE); @@ -123,12 +121,7 @@ public final class Main { LOG_ROOT.detachAndStopAllAppenders(); } - final boolean warnForUnkeyedLists; - if (arguments.hasOption(LIST_WARNING_ON.getLongOpt()) || !arguments.hasOption(LIST_WARNING_OFF.getLongOpt())) { - warnForUnkeyedLists = true; - } else { - warnForUnkeyedLists = false; - } + final boolean warnForUnkeyedLists = !arguments.hasOption(LIST_WARNING_OFF.getLongOpt()); final List yangLibDirs = initYangDirsPath(arguments); final List yangFiles = new ArrayList<>();