Skip to content

Commit 96d1635

Browse files
authored
HIVE-29196: Apply and report checkstyle issues via Sonarqube (#6076)
1 parent f374f39 commit 96d1635

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

Jenkinsfile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ def sonarAnalysis(args) {
117117
-Dsonar.organization=apache \
118118
-Dsonar.projectKey=apache_hive \
119119
-Dsonar.host.url=https://sonarcloud.io \
120+
-Dsonar.java.checkstyle.reportPaths=target/checkstyle-result.xml \
120121
"""+args+" -DskipTests -Dit.skipTests -Dmaven.javadoc.skip"
121122

122123
// Sonar scanner runs in a separate JVM so JAVA_OPTS (notably heap size)
@@ -193,6 +194,15 @@ def jobWrappers(closure) {
193194
}
194195
}
195196

197+
def checkstyle() {
198+
sh '''#!/bin/bash -e
199+
set -x
200+
sw java 21 && . /etc/profile.d/java.sh
201+
export MAVEN_OPTS="-Xmx6G"
202+
mvn checkstyle:checkstyle -Pitests
203+
'''
204+
}
205+
196206
def saveWS() {
197207
sh '''#!/bin/bash -e
198208
tar --exclude=archive.tar -cf archive.tar .
@@ -342,13 +352,19 @@ tar -xzf packaging/target/apache-hive-*-nightly-*-src.tar.gz
342352
stage('Prepare') {
343353
loadWS();
344354
}
355+
stage('Checkstyle') {
356+
checkstyle()
357+
}
345358
stage('Sonar') {
346359
sonarAnalysis("-Dsonar.branch.name=${BRANCH_NAME}")
347360
}
348361
} else if(env.CHANGE_ID) {
349362
stage('Prepare') {
350363
loadWS();
351364
}
365+
stage('Checkstyle') {
366+
checkstyle()
367+
}
352368
stage('Sonar') {
353369
sonarAnalysis("""-Dsonar.pullrequest.github.repository=apache/hive \
354370
-Dsonar.pullrequest.key=${CHANGE_ID} \

0 commit comments

Comments
 (0)