Must-share information (formatted with Markdown):
- SonarQube 7.9.1, Jenkins 2.207
- Code analysis and Code coverage on a project with both Java and TypeScript
- Created the below pipeline:
stages {
stage('NPM Build') {
steps {
script {
sh 'npm --no-color install && npm --no-color run ci && npm --no-color run build:prod'
}
}
}
stage('Maven Build') {
steps {
script {
withSonarQubeEnv('MySonarQube') {
sh "mvn -e clean package sonar:sonar"
}
}
post {
success {
// Calculate Jacoco Code Coverage
junit '**/target/surefire-reports/*.xml'
jacoco()
}
}
}
}
My question:
How do I modify this to get the TypeScript code analysis and code coverage? Is it best practice to:
a) Create a separate stage that will analyze frontend and backend at the same time? If so, should I use sonar-scanner with tool defined?
b) Add a separate withSonarQubeEnv(‘MySonarQube’) to the NPM build stage?
c) Add the sonar maven plugin to my root pom and pass a -Dsonar.sources with the frontend and backend directories
I would really appreciate some guidance here.
Thank You!