Skip to content

Commit

Permalink
Fixed issues with website generation.
Browse files Browse the repository at this point in the history
Reformatted some code.
  • Loading branch information
david-waltermire committed Jul 3, 2023
1 parent ee4798c commit c5b10d4
Show file tree
Hide file tree
Showing 47 changed files with 126 additions and 132 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public abstract class AbstractExitStatus implements ExitStatus {

/**
* Construct a new exit status based on the provided {@code exitCode}.
*
*
* @param exitCode
* the exit code
*/
Expand All @@ -59,7 +59,7 @@ public ExitCode getExitCode() {

/**
* Get the associated throwable.
*
*
* @return the throwable or {@code null}
*/
@Override
Expand All @@ -76,7 +76,7 @@ public ExitStatus withThrowable(@NonNull Throwable throwable) {

/**
* Get the associated message.
*
*
* @return the message or {@code null}
*/
@Nullable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public CLIProcessor(@NonNull String exec, @NonNull List<IVersionInfo> versionInf

/**
* Gets the command used to execute for use in help text.
*
*
* @return the command name
*/
@NonNull
Expand All @@ -148,7 +148,7 @@ public String getExec() {

/**
* Retrieve the version information for this application.
*
*
* @return the versionInfo
*/
@NonNull
Expand All @@ -164,7 +164,7 @@ public void addCommandHandler(@NonNull Command handler) {
* Process a set of CLIProcessor arguments.
* <p>
* process().getExitCode().getStatusCode()
*
*
* @param args
* the arguments to process
* @return the exit status
Expand Down Expand Up @@ -202,9 +202,8 @@ private static void handleNoColor() {
}

public static void handleQuiet() {
@SuppressWarnings("resource")
LoggerContext ctx = (LoggerContext) LogManager.getContext(false); // NOPMD not
// closable here
@SuppressWarnings("resource") LoggerContext ctx = (LoggerContext) LogManager.getContext(false); // NOPMD not
// closable here
Configuration config = ctx.getConfiguration();
LoggerConfig loggerConfig = config.getLoggerConfig(LogManager.ROOT_LOGGER_NAME);
Level oldLevel = loggerConfig.getLevel();
Expand All @@ -215,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().stream().forEach((info) -> {
out.println(ansi()
.bold().a(getExec()).boldOff()
Expand All @@ -232,12 +230,12 @@ protected void showVersion() {
out.flush();
}

// @SuppressWarnings("null")
// @NonNull
// public String[] getArgArray() {
// return Stream.concat(options.stream(), extraArgs.stream()).toArray(size -> new String[size]);
// }
// @SuppressWarnings("null")
// @NonNull
// public String[] getArgArray() {
// return Stream.concat(options.stream(), extraArgs.stream()).toArray(size -> new String[size]);
// }

public class CallingContext {
@NonNull
private final List<Option> options;
Expand All @@ -249,7 +247,7 @@ public class CallingContext {
public CallingContext(@NonNull List<String> args) {
Map<String, Command> topLevelCommandMap = getTopLevelCommands().stream()
.collect(Collectors.toUnmodifiableMap(Command::getName, Functions.identity()));

List<Option> options = new LinkedList<>(OPTIONS);
Deque<Command> calledCommands = new LinkedList<>();
List<String> extraArgs = new LinkedList<>();
Expand Down Expand Up @@ -297,7 +295,7 @@ public CallingContext(@NonNull List<String> args) {

assert options != null;
assert extraArgs != null;

this.options = options;
this.calledCommands = calledCommands;
this.extraArgs = extraArgs;
Expand Down Expand Up @@ -330,7 +328,7 @@ protected Options toOptions() {
}
return retval;
}

public ExitStatus processCommand() {
CommandLineParser parser = new DefaultParser();
CommandLine cmdLine;
Expand Down Expand Up @@ -404,7 +402,7 @@ public ExitStatus handleInvalidCommand(

/**
* Callback for providing a help header.
*
*
* @return the header or {@code null}
*/
@Nullable
Expand All @@ -415,10 +413,10 @@ protected String buildHelpHeader() {

/**
* Callback for providing a help footer.
*
*
* @param exec
* the executable name
*
*
* @return the footer or {@code null}
*/
@NonNull
Expand Down Expand Up @@ -467,7 +465,7 @@ private String buildHelpFooter() {

/**
* Get the CLI syntax.
*
*
* @return the CLI syntax to display in help output
*/
protected String buildHelpCliSyntax() {
Expand Down Expand Up @@ -538,9 +536,9 @@ public void showHelp() {
AnsiPrintStream out = AnsiConsole.out();
int terminalWidth = Math.max(out.getTerminalWidth(), 40);

@SuppressWarnings("resource")
PrintWriter writer = new PrintWriter(out, true, StandardCharsets.UTF_8); // NOPMD -
// not owned
@SuppressWarnings("resource") PrintWriter writer = new PrintWriter(out, true, StandardCharsets.UTF_8); // NOPMD -
// not
// owned
formatter.printHelp(
writer,
terminalWidth,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public enum ExitCode {

/**
* Get the related status code for use with {@link System#exit(int)}.
*
*
* @return the statusCode
*/
public int getStatusCode() {
Expand All @@ -53,7 +53,7 @@ public int getStatusCode() {

/**
* Exit without a message.
*
*
* @return the exit status
*/
@NonNull
Expand All @@ -63,7 +63,7 @@ public ExitStatus exit() {

/**
* Exit with the associated message.
*
*
* @return the exit status
*/
@NonNull
Expand All @@ -73,10 +73,10 @@ public ExitStatus exitMessage() {

/**
* Exit with the associated message and message arguments.
*
*
* @param messageArguments
* any message parameters
*
*
* @return the exit status
*/
@NonNull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
public interface ExitStatus {
/**
* Get the exit code information associated with this exit status.
*
*
* @return the exit code information
*/
@NonNull
Expand All @@ -43,7 +43,7 @@ public interface ExitStatus {

/**
* Process the exit status.
*
*
* @param showStackTrace
* include the stack trace for the throwable, if associated
* @see #withThrowable(Throwable)
Expand All @@ -52,7 +52,7 @@ public interface ExitStatus {

/**
* Associate a throwable with the exit status.
*
*
* @param throwable
* the throwable
* @return this exit status
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class InvalidArgumentException

/**
* Generate a new exception.
*
*
* @param message
* the message
*/
Expand All @@ -65,7 +65,7 @@ public Option getOption() {

/**
* Assign the option requiring an argument that wasn't provided on the command line.
*
*
* @param option
* the option to set
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class MessageExitStatus

/**
* Construct a new {@link ExitStatus} based on an array of message arguments.
*
*
* @param code
* the exit code to use.
* @param messageArguments
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,4 @@ public static String toArgument(@NonNull Option option) {
return option.hasLongOpt() ? "--" + option.getLongOpt() : "-" + option.getOpt();
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,14 @@ public ExitStatus executeCommand(CallingContext callingContext, CommandLine cmdL
ExitStatus status;
if (isSubCommandRequired()) {
status = ExitCode.INVALID_COMMAND
.exitMessage("Please use one of the following sub-commands: "+
.exitMessage("Please use one of the following sub-commands: " +
getSubCommands().stream()
.map(command -> command.getName())
.collect(Collectors.joining(", ")));
.map(command -> command.getName())
.collect(Collectors.joining(", ")));
} else {
status = ExitCode.OK.exit();
}
return status;
return status;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public interface ExtraArgument {

/**
* The allowed number of arguments of this type.
*
*
* @return a positive integer value
*/
int getNumber();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public static ExitStatus runCli(String[] args) {
List<IVersionInfo> versions = List.of(
new MetaschemaJavaVersion(),
new MetaschemaVersion());
CLIProcessor processor = new CLIProcessor("metaschema-cli",versions);
CLIProcessor processor = new CLIProcessor("metaschema-cli", versions);
processor.addCommandHandler(new ValidateCommand());
processor.addCommandHandler(new GenerateSchemaCommand());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,7 @@ public ExitStatus executeCommand(CallingContext callingContext, CommandLine cmdL
IBoundLoader loader = bindingContext.newBoundLoader();

List<String> extraArgs = cmdLine.getArgList();
@SuppressWarnings("null")
Path source = resolvePathAgainstCWD(Paths.get(extraArgs.get(0)));
@SuppressWarnings("null") Path source = resolvePathAgainstCWD(Paths.get(extraArgs.get(0)));
assert source != null;

Format asFormat;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@
* OF THE RESULTS OF, OR USE OF, THE SOFTWARE OR SERVICES PROVIDED HEREUNDER.
*/

package gov.nist.secauto.metaschema.cli.commands;
package gov.nist.secauto.metaschema.cli.commands;
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public static void handleValidationFindings(@NonNull List<? extends IValidationF
}
}
}

public static void handleJsonValidationFinding(@NonNull JsonValidationFinding finding) {
Ansi ansi = generatePreamble(finding.getSeverity());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@
* OF THE RESULTS OF, OR USE OF, THE SOFTWARE OR SERVICES PROVIDED HEREUNDER.
*/

package gov.nist.secauto.metaschema.cli.util;
package gov.nist.secauto.metaschema.cli.util;
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@
import gov.nist.secauto.metaschema.cli.processor.ExitCode;
import gov.nist.secauto.metaschema.cli.processor.ExitStatus;

import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.opentest4j.MultipleFailuresError;

import edu.umd.cs.findbugs.annotations.NonNull;

Expand Down
26 changes: 0 additions & 26 deletions metaschema-freemarker-support/src/site/site.xml

This file was deleted.

2 changes: 1 addition & 1 deletion metaschema-java-binding/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<artifactId>metaschema-java-binding</artifactId>
<packaging>jar</packaging>

<name>Java Metaschema Data Binding</name>
<name>Metaschema Java Data Binding</name>
<description>A Metaschema binding-based parser for Java objects supporting serialization of conformant XML, JSON, and YAML data.</description>

<url>${site.url}${project.artifactId}/</url>
Expand Down
Loading

0 comments on commit c5b10d4

Please sign in to comment.