Skip to content

Commit dead345

Browse files
committed
Custom template
1 parent 29bb738 commit dead345

File tree

4 files changed

+33
-5
lines changed

4 files changed

+33
-5
lines changed

CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,24 @@
33

44
Changelog of Violation comments to bitbucket server lib.
55

6+
## 1.48
7+
### No issue
8+
9+
**PCLint**
10+
11+
12+
[68c09c2d9836709](https://github.com/tomasbjerre/violation-comments-to-bitbucket-server-lib/commit/68c09c2d9836709) Tomas Bjerre *2018-02-13 18:59:38*
13+
14+
15+
## 1.47
16+
### No issue
17+
18+
**ViolationCommentsToBitbucketServerApi**
19+
20+
21+
[e8cd87fdd59f777](https://github.com/tomasbjerre/violation-comments-to-bitbucket-server-lib/commit/e8cd87fdd59f777) Tomas Bjerre *2018-02-10 07:55:37*
22+
23+
624
## 1.46
725
### GitHub #47
826

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ apply from: project.buildscript.classLoader.getResource('release.gradle').toURI(
1919

2020

2121
dependencies {
22-
compile 'se.bjurr.violations:violation-comments-lib:1.55'
22+
compile 'se.bjurr.violations:violation-comments-lib:1.58'
2323
compile 'com.jayway.jsonpath:json-path:2.0.0'
2424
compile 'com.google.code.gson:gson:2.8.0'
2525
compile 'com.google.guava:guava:20.0'

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import se.bjurr.violations.comments.lib.model.ChangedFile;
2424
import se.bjurr.violations.comments.lib.model.Comment;
2525
import se.bjurr.violations.comments.lib.model.CommentsProvider;
26-
import se.bjurr.violations.lib.model.Violation;
2726
import se.bjurr.violations.lib.util.Optional;
2827

2928
public class BitbucketServerCommentsProvider implements CommentsProvider {
@@ -181,9 +180,8 @@ public boolean shouldCreateSingleFileComment() {
181180
}
182181

183182
@Override
184-
public Optional<String> findCommentFormat(
185-
final ChangedFile changedFile, final Violation violation) {
186-
return Optional.absent();
183+
public Optional<String> findCommentTemplate() {
184+
return violationCommentsToBitbucketApi.findCommentTemplate();
187185
}
188186

189187
@Override

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@
22

33
import static com.google.common.base.Preconditions.checkNotNull;
44
import static se.bjurr.violations.comments.lib.CommentsCreator.createComments;
5+
import static se.bjurr.violations.lib.util.Optional.fromNullable;
56
import static se.bjurr.violations.lib.util.Utils.firstNonNull;
67
import static se.bjurr.violations.lib.util.Utils.isNullOrEmpty;
78

89
import java.util.List;
910
import se.bjurr.violations.comments.lib.model.CommentsProvider;
1011
import se.bjurr.violations.lib.model.Violation;
12+
import se.bjurr.violations.lib.util.Optional;
1113

1214
public class ViolationCommentsToBitbucketServerApi {
1315
private static final Integer BITBUCKET_MAX_COMMENT_SIZE = 32767;
@@ -35,6 +37,7 @@ public static ViolationCommentsToBitbucketServerApi violationCommentsToBitbucket
3537
private int commentOnlyChangedContentContext;
3638
private boolean shouldKeepOldComments;
3739
private String personalAccessToken;
40+
private String commentTemplate;
3841

3942
private ViolationCommentsToBitbucketServerApi() {}
4043

@@ -226,4 +229,13 @@ public boolean getShouldKeepOldComments() {
226229
public String getPersonalAccessToken() {
227230
return personalAccessToken;
228231
}
232+
233+
public ViolationCommentsToBitbucketServerApi withCommentTemplate(final String commentTemplate) {
234+
this.commentTemplate = commentTemplate;
235+
return this;
236+
}
237+
238+
public Optional<String> findCommentTemplate() {
239+
return fromNullable(commentTemplate);
240+
}
229241
}

0 commit comments

Comments
 (0)