Skip to content

Commit

Permalink
commentOnlyChangedFiles
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasbjerre committed Jun 16, 2019
1 parent 0d21fa5 commit 9c4796f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,12 @@ Missing a format? Open an issue [here](https://github.com/tomasbjerre/violations
commented.
<boolean>: true or false
Default: true
-comment-only-changed-files, -cocf <boolean> True if only changed
files should be commented.
False if all findings should
be commented.
<boolean>: true or false
Default: true
-comment-template <string> https://github.
com/tomasbjerre/violation-comments-lib
<string>: any string
Expand Down Expand Up @@ -170,7 +176,7 @@ ccwasfc <boolean> Default: false
CLANG, CPD, CPPCHECK,
CPPLINT, CSSLINT, FINDBUGS,
FLAKE8, FXCOP, GENDARME, IAR,
JCREPORT, JSHINT, LINT,
JCREPORT, JSHINT, JUNIT, LINT,
KLOCWORK, KOTLINMAVEN,
KOTLINGRADLE, MSCPP, MYPY, GOLINT,
GOOGLEERRORPRONE, PERLCRITIC, PITEST,
Expand Down
10 changes: 10 additions & 0 deletions src/main/java/se/bjurr/violations/main/Runner.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public class Runner {
private String username;
private String password;
private boolean shouldCommentOnlyChangedContent;
private boolean shouldCommentOnlyChangedFiles;
private Integer maxNumberOfViolations;

public void main(final String args[]) throws Exception {
Expand Down Expand Up @@ -106,6 +107,12 @@ public void main(final String args[]) throws Exception {
.description(
"True if only changed parts of the changed files should be commented. False if all findings on the changed files should be commented.")
.build();
final Argument<Boolean> shouldCommentOnlyChangedFilesArg =
booleanArgument("-comment-only-changed-files", "-cocf")
.defaultValue(true)
.description(
"True if only changed files should be commented. False if all findings should be commented.")
.build();
final Argument<Integer> maxNumberOfViolationsArg =
integerArgument("-max-number-of-violations", "-max")
.defaultValue(Integer.MAX_VALUE)
Expand All @@ -128,6 +135,7 @@ public void main(final String args[]) throws Exception {
usernameArg, //
passwordArg, //
shouldCommentOnlyChangedContentArg, //
shouldCommentOnlyChangedFilesArg, //
maxNumberOfViolationsArg //
) //
.parse(args);
Expand All @@ -146,6 +154,7 @@ public void main(final String args[]) throws Exception {
this.username = parsed.get(usernameArg);
this.password = parsed.get(passwordArg);
this.shouldCommentOnlyChangedContent = parsed.get(shouldCommentOnlyChangedContentArg);
this.shouldCommentOnlyChangedFiles = parsed.get(shouldCommentOnlyChangedFilesArg);
this.maxNumberOfViolations = parsed.get(maxNumberOfViolationsArg);

if (parsed.wasGiven(showDebugInfo)) {
Expand Down Expand Up @@ -198,6 +207,7 @@ public void main(final String args[]) throws Exception {
.withCreateCommentWithAllSingleFileComments(createCommentWithAllSingleFileComments) //
.withCreateSingleFileComment(createSingleFileComments) //
.withShouldCommentOnlyChangedContent(shouldCommentOnlyChangedContent) //
.withShouldCommentOnlyChangedFiles(shouldCommentOnlyChangedFiles) //
.withKeepOldComments(keepOldComments) //
.withCommentTemplate(commentTemplate) //
.withMaxNumberOfViolations(maxNumberOfViolations) //
Expand Down

0 comments on commit 9c4796f

Please sign in to comment.