Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ static int main(PrintWriter out, PrintWriter err, String... args) {
return formatter.format(args);
} catch (UsageException e) {
err.print(e.getMessage());
return 0;
// We return exit code 2 to differentiate usage issues from code formatting issues.
return 2;
} finally {
err.flush();
out.flush();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public void testUsageOutputAfterLoadingViaToolName() {

int result = format.run(new PrintWriter(out, true), new PrintWriter(err, true), "--help");

assertThat(result).isEqualTo(0);
assertThat(result).isEqualTo(2);

String usage = err.toString();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public void testMain() throws Exception {
process.waitFor();
String err = new String(ByteStreams.toByteArray(process.getErrorStream()), UTF_8);
assertThat(err).contains("Usage: google-java-format");
assertThat(process.exitValue()).isEqualTo(0);
assertThat(process.exitValue()).isEqualTo(2);
}

// end to end javadoc formatting test
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.