From 70895a6b1805bc879846f193e879f1e6471100e1 Mon Sep 17 00:00:00 2001 From: Martin Spielmann Date: Fri, 2 Mar 2018 17:40:23 +0100 Subject: [PATCH 1/4] add jacoco and sonar --- Jenkinsfile | 11 ++++++++++- pom.xml | 41 ++++++++++++++++++++++++++++++++++++++++ sonar-project.properties | 11 +++++++++++ 3 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 sonar-project.properties diff --git a/Jenkinsfile b/Jenkinsfile index aaee540..0eb94a8 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -21,5 +21,14 @@ pipeline { sh 'mvn install' } } + + stage('QA') { + withSonarQubeEnv('sonar') { + script { + def scannerHome = tool 'sonarqube-scanner' + sh "${scannerHome}/bin/sonar-scanner" + } + } + } } -} \ No newline at end of file +} diff --git a/pom.xml b/pom.xml index eeeec54..b1e4087 100644 --- a/pom.xml +++ b/pom.xml @@ -158,6 +158,47 @@ ${wtp.version} + + org.jacoco + jacoco-maven-plugin + 0.8.0 + + + jacoco-initialize + + prepare-agent + + + + jacoco-report + prepare-package + + report + + + + post-unit-test + test + + report + + + target/jacoco.exec + target/jacoco-ut + + + + + surefireArgLine + + + + maven-surefire-plugin + 2.20.1 + + ${surefireArgLine} + + diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 0000000..c084b40 --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,11 @@ +sonar.projectKey=wicket-pwnedpasswords-validator +sonar.organization=pingunaut-github +sonar.sources=src/main/java +sonar.tests=src/test/java +sonar.sourceEncoding=UTF-8 +sonar.java.binaries=target/classes +sonar.java.test.binaries=target/test-classes +sonar.junit.reportPaths=target/surefire-reports +sonar.java.coveragePlugin=jacoco +sonar.jacoco.reportPaths=target/jacoco.exec + From 340c15eaa9742203ccde12177b76be29eb797320 Mon Sep 17 00:00:00 2001 From: Martin Spielmann Date: Fri, 2 Mar 2018 17:42:12 +0100 Subject: [PATCH 2/4] fix jenkins job --- Jenkinsfile | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 0eb94a8..dd640cd 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -23,12 +23,14 @@ pipeline { } stage('QA') { - withSonarQubeEnv('sonar') { - script { - def scannerHome = tool 'sonarqube-scanner' - sh "${scannerHome}/bin/sonar-scanner" + steps { + withSonarQubeEnv('sonar') { + script { + def scannerHome = tool 'sonarqube-scanner' + sh "${scannerHome}/bin/sonar-scanner" + } } } - } + } } } From 27401bd3c91e7da1ad66cbe02c2b301ec787fabe Mon Sep 17 00:00:00 2001 From: Martin Spielmann Date: Fri, 2 Mar 2018 17:52:40 +0100 Subject: [PATCH 3/4] add sonar badge --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 4c5d12d..9d5fb0c 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,7 @@ The validator uses the free API of https://haveibeenpwned.com/ by [@troyhunt](ht validate that the password has not been previously exposed in data breaches. [![Build Status](https://ci.martinspielmann.de/buildStatus/icon?job=pingunaut/wicket-pwnedpasswords-validator/master)](https://ci.martinspielmann.de/job/pingunaut/job/wicket-pwnedpasswords-validator/job/master/) +[![SonarQube Coverage](https://img.shields.io/sonar/https/sonarcloud.io/wicket-pwned-passwords-validator/coverage.svg)](https://sonarcloud.io/component_measures?id=wicket-pwnedpasswords-validator&metric=coverage) ## Usage From 1e0ca227f36ac976c654747dfe36bd75df656b00 Mon Sep 17 00:00:00 2001 From: Martin Spielmann Date: Fri, 2 Mar 2018 17:55:29 +0100 Subject: [PATCH 4/4] fix sonar badge --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 9d5fb0c..494ede9 100644 --- a/README.md +++ b/README.md @@ -5,8 +5,7 @@ The validator uses the free API of https://haveibeenpwned.com/ by [@troyhunt](ht validate that the password has not been previously exposed in data breaches. [![Build Status](https://ci.martinspielmann.de/buildStatus/icon?job=pingunaut/wicket-pwnedpasswords-validator/master)](https://ci.martinspielmann.de/job/pingunaut/job/wicket-pwnedpasswords-validator/job/master/) -[![SonarQube Coverage](https://img.shields.io/sonar/https/sonarcloud.io/wicket-pwned-passwords-validator/coverage.svg)](https://sonarcloud.io/component_measures?id=wicket-pwnedpasswords-validator&metric=coverage) - +[![Coverage](https://img.shields.io/sonar/https/sonarcloud.io/wicket-pwnedpasswords-validator/coverage.svg)](https://sonarcloud.io/component_measures?id=wicket-pwnedpasswords-validator&metric=coverage) ## Usage 1. Include maven dependency in your pom.xml