Skip to content

Commit

Permalink
Added CI argument to ignore the issue count as return code (#113)
Browse files Browse the repository at this point in the history
* Removed SystemExit call in for main

* Revert last commit, added ci argument
  • Loading branch information
Fischer96 authored and sylvainhalle committed Dec 14, 2019
1 parent 294a8e4 commit 204a7af
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Source/Core/src/ca/uqac/lif/textidote/Main.java
Original file line number Diff line number Diff line change
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

0 comments on commit 204a7af

Please sign in to comment.