From 8c516efeafa545ef0072dc237fcbc2b97f7de84e Mon Sep 17 00:00:00 2001 From: Taylor Smock Date: Tue, 15 Sep 2020 08:16:55 -0600 Subject: [PATCH] Add sonar lint Signed-off-by: Taylor Smock --- .gitlab-ci.yml | 15 +++++++++++++++ build.gradle | 13 +++++++++++++ 2 files changed, 28 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 508a1e9..df7eb97 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -121,6 +121,21 @@ build: - build needs: ["assemble"] +sonarcloud.io: + image: registry.gitlab.com/josm/docker-library/openjdk-8-josmplugin:latest + stage: test + environment: + name: sonarcloud.io + url: https://sonarcloud.io/dashboard?id=mapwithai%3Amapwithai + script: + - ./gradlew -Dsonar.login=$SONAR_TOKEN sonarqube + needs: ["assemble"] + rules: + - if: '$CI_MERGE_REQUEST_IID && $SONAR_TOKEN =~ /[0-9a-z]+/' + - if: '$CI_COMMIT_TAG && $SONAR_TOKEN =~ /[0-9a-z]+/' + - if: '$CI_PIPELINE_SOURCE == "merge_request_event" && $SONAR_TOKEN =~ /[0-9a-z]+/' + - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $SONAR_TOKEN =~ /[0-9a-z]+/' + test: stage: test script: diff --git a/build.gradle b/build.gradle index 827ff6e..b7c9115 100644 --- a/build.gradle +++ b/build.gradle @@ -15,6 +15,7 @@ plugins { id "org.openstreetmap.josm" version "0.7.0" id "net.ltgt.errorprone" version "1.2.1" id "com.diffplug.spotless" version "5.1.0" + id "org.sonarqube" version "3.0" //id 'de.aaschmid.cpd' version '2.0' } @@ -277,3 +278,15 @@ if (ciJobToken != null && projectId!= null) { } } } + +sonarqube { + properties { + property "sonar.organization", "mapwithai" + property "sonar.projectKey", "mapwithai" + property("sonar.forceAuthentication", "true") + property("sonar.host.url", "https://sonarcloud.io") + property("sonar.projectDescription", properties.get("plugin.description")) + property("sonar.projectVersion", project.version) + property("sonar.sources", listOf("src")) + } +}