Skip to content

Commit 5f818db

Browse files
authored
Merge pull request #1 from kekru/sonarqube
Sonarqube integration
2 parents 2e2b303 + 3730e79 commit 5f818db

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+1964
-26
lines changed

CONTRIBUTE.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Develop, Contribute
2+
3+
Feel free to either write an issue or implement a pull request.
4+
5+
## Building Locally
6+
7+
To build locally run
8+
9+
```bash
10+
./gradlew build publishToMavenLocal -x test
11+
```
12+
13+
The result is available under `de.kekru.codeanalysisbb:code-analysis-bitbucket-exporter:0.0.1-SNAPSHOT` in your local Maven m2 repository
14+
15+
## Get build from JitPack
16+
17+
To get build artifacts from any commit, you can use [JitPack](https://jitpack.io/).
18+
First create a fork of this repo and push your change to a branch.
19+
20+
Assuming your fork is `github.com/your-name/code-analysis-bitbucket-exporter` and your commit id is `bcfe41f439e3bf19304ee79b01f4f07e3a2f14ca`
21+
then you can get the artifact like this:
22+
23+
```groovy
24+
repositories {
25+
maven { url 'https://jitpack.io' }
26+
}
27+
dependencies {
28+
classpath "com.github.your-name:code-analysis-bitbucket-exporter:bcfe41f439e3bf19304ee79b01f4f07e3a2f14ca"
29+
}
30+
```
31+
32+
You can find a build log under `https://jitpack.io/com/github/your-name/code-analysis-bitbucket-exporter/bcfe41f439e3bf19304ee79b01f4f07e3a2f14ca/build.log`
33+
34+
JitPack will build the artifact when it is requested for the first time.
35+
36+
## Adding a new reporter
37+
38+
To add a new reporter service, you should do the following
39+
40+
+ add a new `public class <Xyz>Reporter implements Reporter` under [src/main/java/de/kekru/codeanalysisbb/reporter](./src/main/java/de/kekru/codeanalysisbb/reporter)
41+
+ add a new Config for your Reporter in [Config.java](./src/main/java/de/kekru/codeanalysisbb/config/Config.java)
42+
and don't forget to add it to the `getActiveReporters()` method in Config.java
43+
+ add a test under [src/test/java/de/kekru/codeanalysisbb/reporter](./src/test/java/de/kekru/codeanalysisbb/reporter)
44+
See PmdReporterIntegrationTest.java as a template
45+
+ add the new Config to the description in [README.md](./README.md)
46+
47+
Now create a `code-analysis-bb.yml` with your config options in the root of the project and run
48+
49+
```bash
50+
./gradlew build run -x test
51+
```
52+
53+
## Dependency Injection
54+
55+
Dependecy injection is a very basic implementation via `ServiceRegistry.get(Class)` from [kekru/java-utils](https://github.com/kekru/java-utils).
56+
`Class` must be annotated with `@Service`. Then it will create an instance by calling the constructor.
57+
If there are parameters in the constructor, the necessary other objects will be created first.
58+
All created objects are singletons.
59+
60+
So if you need another service, just add it as an argument to your service's constructor.
61+
62+
## Http Client
63+
64+
When calling other servers via http, then Apacha jclouds is used, because it already comes with com.cdancy:bitbucket-rest library (which is used for Bitbucket communication)
65+
An example for jclouds can be found under [src/main/java/de/kekru/codeanalysisbb/reporter/sonarqube](./src/main/java/de/kekru/codeanalysisbb/reporter/sonarqube)

0 commit comments

Comments
 (0)