Skip to content

Commit 576f30c

Browse files
committed
Moving multiple/single commenting logic to lib
1 parent e3c793a commit 576f30c

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ repositories {
6363
}
6464

6565
dependencies {
66-
compile 'se.bjurr.violations:violation-comments-lib:1.18'
66+
compile 'se.bjurr.violations:violation-comments-lib:1.19'
6767
compile 'com.jayway.jsonpath:json-path:2.0.0'
6868
compile 'com.google.code.gson:gson:2.8.0'
6969

src/main/java/se/bjurr/violations/comments/bitbucketserver/lib/BitbucketServerCommentsProvider.java

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -55,19 +55,11 @@ public BitbucketServerCommentsProvider(ViolationCommentsToBitbucketServerApi vio
5555

5656
@Override
5757
public void createCommentWithAllSingleFileComments(String comment) {
58-
if (!violationCommentsToBitbucketApi.getCreateCommentWithAllSingleFileComments()) {
59-
return;
60-
}
61-
6258
client.pullRequestComment(comment);
6359
}
6460

6561
@Override
6662
public void createSingleFileComment(ChangedFile file, Integer line, String comment) {
67-
if (!violationCommentsToBitbucketApi.getCreateSingleFileComments()) {
68-
return;
69-
}
70-
7163
client.pullRequestComment(file.getFilename(), line, comment);
7264
}
7365

@@ -115,9 +107,6 @@ public void removeComments(List<Comment> comments) {
115107

116108
@Override
117109
public boolean shouldComment(ChangedFile changedFile, Integer changedLine) {
118-
if (!violationCommentsToBitbucketApi.getCommentOnlyChangedContent()) {
119-
return true;
120-
}
121110
for (BitbucketServerDiff diff : diffResponse.get().getDiffs()) {
122111
if (diff.getDestination().getToString().equals(changedFile.getFilename())) {
123112
for (DiffHunk hunk : diff.getHunks()) {
@@ -136,4 +125,14 @@ public boolean shouldComment(ChangedFile changedFile, Integer changedLine) {
136125
}
137126
return false;
138127
}
128+
129+
@Override
130+
public boolean shouldCreateCommentWithAllSingleFileComments() {
131+
return violationCommentsToBitbucketApi.getCreateCommentWithAllSingleFileComments();
132+
}
133+
134+
@Override
135+
public boolean shouldCreateSingleFileComment() {
136+
return violationCommentsToBitbucketApi.getCreateSingleFileComments();
137+
}
139138
}

0 commit comments

Comments
 (0)