Skip to content

Commit 8bb88f6

Browse files
authored
Merge pull request #109 from splitio/feat/sonar-scanner
SonarQube scanner
2 parents 385cc9f + d61ddcc commit 8bb88f6

File tree

3 files changed

+35
-12
lines changed

3 files changed

+35
-12
lines changed

.travis.settings.xml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,15 @@
1010
<activeByDefault>true</activeByDefault>
1111
</activation>
1212
<properties>
13-
<sonar.host.url>http://sonar.split.io:8080</sonar.host.url>
14-
<sonar.login>${env.SONAR_TOKEN}</sonar.login>
15-
<sonar.projectName>Split Java SDK</sonar.projectName>
16-
<sonar.projectVersion>development</sonar.projectVersion>
17-
<sonar.test.exclusions>**/test/**/*.*</sonar.test.exclusions>
18-
<sonar.exclusions>**/ai/**/*.*,**/jdbc/**/*.*,**/mpt/**/*.*,**/jcr/**/*.*,**/JDBC*</sonar.exclusions>
13+
<sonar.host.url>https://sonarqube.split-internal.com</sonar.host.url>
14+
<sonar.login>${env.SONAR_TOKEN}</sonar.login>
15+
<sonar.ws.timeout>300</sonar.ws.timeout>
16+
<sonar.links.ci>https://travis-ci.com/splitio/java-client</sonar.links.ci>
17+
<sonar.links.scm>https://github.com/splitio/java-client</sonar.links.scm>
18+
<sonar.projectName>java-client</sonar.projectName>
19+
<sonar.sources>./src</sonar.sources>
20+
<sonar.test.exclusions>**/test/**/*.*,**/testing/**/*.*</sonar.test.exclusions>
21+
<sonar.exclusions>**/ai/**/*.*,**/jdbc/**/*.*,**/mpt/**/*.*,**/jcr/**/*.*,**/JDBC*</sonar.exclusions>
1922
</properties>
2023
</profile>
2124
</profiles>

.travis.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
dist: trusty
22

3+
language: java
4+
35
jdk:
46
- oraclejdk8
57

8+
git:
9+
depth: false
10+
611
cache:
712
directories:
813
- $HOME/.m2
@@ -13,9 +18,5 @@ before_script:
1318
script:
1419
- mvn clean install
1520

16-
deploy:
17-
- provider: script
18-
skip_cleanup: true
19-
script: mvn -DskipTests sonar:sonar
20-
on:
21-
branch: development
21+
after_success:
22+
- bash sonar-scanner.sh

sonar-scanner.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#/bin/bash -e
2+
3+
if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
4+
mvn --batch-mode sonar:sonar -DskipTests \
5+
-Dsonar.pullrequest.provider='GitHub' \
6+
-Dsonar.pullrequest.github.repository='splitio/java-client' \
7+
-Dsonar.pullrequest.key=$TRAVIS_PULL_REQUEST \
8+
-Dsonar.pullrequest.branch=$TRAVIS_PULL_REQUEST_BRANCH \
9+
-Dsonar.pullrequest.base=$TRAVIS_BRANCH
10+
else
11+
if [ "$TRAVIS_BRANCH" == 'development' ]; then
12+
TARGET_BRANCH='master'
13+
else
14+
TARGET_BRANCH='development'
15+
fi
16+
mvn --batch-mode sonar:sonar -DskipTests \
17+
-Dsonar.branch.name=$TRAVIS_BRANCH \
18+
-Dsonar.branch.target=$TARGET_BRANCH
19+
fi

0 commit comments

Comments
 (0)