Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added CI argument to ignore the issue count as return code #113

Merged
merged 2 commits into from Dec 14, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 9 additions & 1 deletion Source/Core/src/ca/uqac/lif/textidote/Main.java
Expand Up @@ -167,6 +167,10 @@ public static int mainLoop(String[] args, InputStream in, PrintStream out, Print
cli_parser.addArgument(new Argument().withLongName("type").withArgument("x").withDescription("Input is of type x (tex or md)"));
cli_parser.addArgument(new Argument().withLongName("version").withDescription("Show version number"));
cli_parser.addArgument(new Argument().withLongName("output").withArgument("method").withDescription("Output as plain (default), json, html, or singleline"));
cli_parser.addArgument(new Argument().withLongName("ci").withDescription("Ignores the return code for CI usage"));

// Check if we are using textidote in a CI tool
boolean usingCI = false;

// Check if there is a parameter filename
ArgumentMap map = null;
Expand Down Expand Up @@ -491,6 +495,10 @@ else if (output_method.compareToIgnoreCase("json") == 0)
renderer = new JsonAdviceRenderer(stdout, lang_s);
}
}
if (map.hasOption("ci"))
{
usingCI = true;
}
else
{
renderer = new AnsiAdviceRenderer(stdout);
Expand Down Expand Up @@ -657,7 +665,7 @@ else if (output_method.compareToIgnoreCase("json") == 0)
renderer.render();

// The exit code is the number of warnings raised
return num_advice;
return usingCI ? 0 : num_advice;
}

/**
Expand Down