Skip to content

Commit e8e6834

Browse files
committed
Enabling injected logger
1 parent e8a37d5 commit e8e6834

File tree

5 files changed

+46
-4
lines changed

5 files changed

+46
-4
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,5 @@ bin
88
temp
99
.gradle
1010
.okhttpcache
11+
.idea
12+
out

CHANGELOG.md

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

44
Changelog of Violation comments to bitbucket server lib.
55

6+
## 1.56
7+
### No issue
8+
9+
**Fix optional rule in YAMLLint**
10+
11+
12+
[ef9cf692c04a118](https://github.com/tomasbjerre/violation-comments-to-bitbucket-server-lib/commit/ef9cf692c04a118) Tomas Bjerre *2018-09-17 13:32:10*
13+
14+
15+
## 1.55
16+
### No issue
17+
18+
**YAMLLint**
19+
20+
21+
[cba77400e34ef7f](https://github.com/tomasbjerre/violation-comments-to-bitbucket-server-lib/commit/cba77400e34ef7f) Tomas Bjerre *2018-09-15 07:59:32*
22+
23+
24+
## 1.54
25+
### No issue
26+
27+
**Correcting CPD parser and adding category to model**
28+
29+
30+
[54d69ce9a83237b](https://github.com/tomasbjerre/violation-comments-to-bitbucket-server-lib/commit/54d69ce9a83237b) Tomas Bjerre *2018-09-12 20:46:49*
31+
32+
633
## 1.53
734
### No issue
835

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.65'
22+
compile 'se.bjurr.violations:violation-comments-lib:1.66'
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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
import se.bjurr.violations.comments.bitbucketserver.lib.client.model.DiffHunk;
2121
import se.bjurr.violations.comments.bitbucketserver.lib.client.model.Line;
2222
import se.bjurr.violations.comments.bitbucketserver.lib.client.model.Segment;
23+
import se.bjurr.violations.comments.lib.CommentsProvider;
2324
import se.bjurr.violations.comments.lib.model.ChangedFile;
2425
import se.bjurr.violations.comments.lib.model.Comment;
25-
import se.bjurr.violations.comments.lib.model.CommentsProvider;
2626
import se.bjurr.violations.lib.util.Optional;
2727

2828
public class BitbucketServerCommentsProvider implements CommentsProvider {

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

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
import static se.bjurr.violations.lib.util.Utils.isNullOrEmpty;
88

99
import java.util.List;
10-
import se.bjurr.violations.comments.lib.model.CommentsProvider;
10+
import org.slf4j.LoggerFactory;
11+
import se.bjurr.violations.comments.lib.CommentsProvider;
12+
import se.bjurr.violations.comments.lib.ViolationsLogger;
1113
import se.bjurr.violations.lib.model.Violation;
1214
import se.bjurr.violations.lib.util.Optional;
1315

@@ -43,6 +45,13 @@ public static ViolationCommentsToBitbucketServerApi violationCommentsToBitbucket
4345
private Integer proxyHostPort = 0;
4446
private String proxyUser;
4547
private String proxyPassword;
48+
private ViolationsLogger violationsLogger =
49+
new ViolationsLogger() {
50+
@Override
51+
public void log(final String string) {
52+
LoggerFactory.getLogger(ViolationsLogger.class).info(string);
53+
}
54+
};
4655

4756
private ViolationCommentsToBitbucketServerApi() {}
4857

@@ -73,6 +82,10 @@ private void checkState() {
7382
checkNotNull(projectKey, "projectKey");
7483
}
7584

85+
public void setViolationsLogger(final ViolationsLogger violationsLogger) {
86+
this.violationsLogger = violationsLogger;
87+
}
88+
7689
public String getBitbucketServerUrl() {
7790
return bitbucketServerUrl;
7891
}
@@ -166,7 +179,7 @@ public void toPullRequest() throws Exception {
166179
populateFromEnvironmentVariables();
167180
checkState();
168181
final CommentsProvider commentsProvider = new BitbucketServerCommentsProvider(this);
169-
createComments(commentsProvider, violations, BITBUCKET_MAX_COMMENT_SIZE);
182+
createComments(violationsLogger, violations, BITBUCKET_MAX_COMMENT_SIZE, commentsProvider);
170183
}
171184

172185
public ViolationCommentsToBitbucketServerApi withBitbucketServerUrl(

0 commit comments

Comments
 (0)