From defc745cf683cbe370fb144676b95cc830437686 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cosana=E2=80=9D?= Date: Fri, 29 Mar 2019 11:56:55 -0400 Subject: [PATCH] removing sonarqube integration --- Makefile | 4 ---- build.gradle | 2 -- circle.yml | 6 ------ docs/sonarqube.md | 38 -------------------------------------- gradle/dependencies.gradle | 2 -- gradle/sonarqube.gradle | 27 --------------------------- samples/build.gradle | 3 --- 7 files changed, 82 deletions(-) delete mode 100644 docs/sonarqube.md delete mode 100644 gradle/sonarqube.gradle diff --git a/Makefile b/Makefile index 07d9ae2c7..55d868de9 100644 --- a/Makefile +++ b/Makefile @@ -10,10 +10,6 @@ build-config: checkstyle: ./gradlew checkstyleMain -sonarqube: - ./gradlew JacocoTestReport - ./gradlew sonarqube - test: ./gradlew test diff --git a/build.gradle b/build.gradle index 34e2a1133..f7991d6b0 100644 --- a/build.gradle +++ b/build.gradle @@ -15,7 +15,6 @@ buildscript { } classpath 'com.android.tools.build:gradle:3.3.0' classpath pluginDependencies.errorprone - classpath pluginDependencies.sonarqube classpath pluginDependencies.buildConfig classpath pluginDependencies.jacoco } @@ -101,4 +100,3 @@ task clean(type: Delete) { delete rootProject.buildDir } -apply from: "${rootDir}/gradle/sonarqube.gradle" diff --git a/circle.yml b/circle.yml index d5184884a..6a9fa8f37 100644 --- a/circle.yml +++ b/circle.yml @@ -31,12 +31,6 @@ jobs: - run: name: Run unit-test for all modules command: make test - - run: - name: SonarQube upload - command: | - if [ "${CIRCLE_BRANCH}" == "master" ]; then - make sonarqube ; - fi - store_artifacts: path: mapbox/app/build/reports destination: reports diff --git a/docs/sonarqube.md b/docs/sonarqube.md deleted file mode 100644 index 127d82e31..000000000 --- a/docs/sonarqube.md +++ /dev/null @@ -1,38 +0,0 @@ -# Sonarqube - -Starting with Mapbox Java 3.0 we use [SonarQube](https://www.sonarqube.org/) for tracking of static analysis issues, code coverage, project stat history, etc. This doc will walk through local setup and some of the features Sonarqube offers. - -The project is public accessible through [SonarCloud](https://sonarcloud.io/dashboard?id=mapbox-java-services). - -## Setup - -### SonarCloud Account -To get admin access on SonarCloud, [sign in](https://sonarcloud.io/sessions/new) using your Github account and ping in the `#android` slack channel that you'd like access to the Mapbox organization. - -**Important:** Once signed in, you'll want to generate a security token and add it to your `bash_profile` so you can locally run the `sonarqube` gradle task. Once logged in, goto `My Account → Security`, enter a token name, and generate. Note that running the gradle command locally will update the project on SonarCloud using your current branch status, thus, it's best to let CI run all updates and only running locally if you have a valid reason. - -### SonarLint -Intellij has a plugin which helps quickly catch and resolve issues in real-time. To install, goto `Preferences → Plugins → Browse Repositories` and search SonarLint. - -To follow the project rules in place, make sure to connect the plugin following the [official instructions](http://www.sonarlint.org/intellij/index.html#Connected). - - -### Long-lived Non-branch analysis -In the case you want to maintain analysis of the canonical project in SonarQube, say the "master" branch, and also publish in SonarQube ongoing analysis of a secondary branch. The typical case is a release branch. In this scenario, you add the sonar.branch=[branch key] analysis property to the release branch to create a second, independent project in SonarQube. - -### Github PR Analysis -TODO Needs to be setup once 3.0 is merged into master - -## Features - -### Issues -The key feature of SonarQube is the issue tracker. The Mapbox organization contains a set of rules or "ways" which help eliminate common Java errors. These run each time the `sonarqube` gradle task is run and if new issues are found, a new issue in the queue will be open with detailed information on how to resolve - -In some cases, these issues can be a false positive and can be resolved by using the `Open` dropdown menu and marking the issue appropriately and giving a reason. - -### Method/Function tracking -For Android users, method count is critical information to know and keep track of. SonarQube allows you to track this information over time under the `measures` tab in the project. Click on `Size → Functions` and you'll see a list of the project files and the number of methods in each file. Above the list, you'll find a graph icon which can show progress and changes over time. - -By default, this shows the entire projects method count which is misleading since each module is published separately. To fix this and display individual module stats, locate the hamburger menu icon above the list of files and switch from `List` to `Tree`. This will list all the modules within the project and the method count. - -**Note:** These number don't include dependency method count. \ No newline at end of file diff --git a/gradle/dependencies.gradle b/gradle/dependencies.gradle index 66c5b1626..55f1a4c4f 100644 --- a/gradle/dependencies.gradle +++ b/gradle/dependencies.gradle @@ -18,7 +18,6 @@ ext { jacoco : '0.13.0', errorprone : '0.0.14', spotbugs : '1.3', - sonarqube : '2.5', buildConfig: '1.1.8', dependencyGraph: '0.4.0' @@ -43,7 +42,6 @@ ext { pluginDependencies = [ checkstyle : "com.puppycrawl.tools:checkstyle:${pluginVersion.checkstyle}", spotbugs : "gradle.plugin.com.github.spotbugs:gradlePlugin:${pluginVersion.spotbugs}", - sonarqube : "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:${pluginVersion.sonarqube}", errorprone : "net.ltgt.gradle:gradle-errorprone-plugin:${pluginVersion.errorprone}", buildConfig: "gradle.plugin.de.fuerstenau:BuildConfigPlugin:${pluginVersion.buildConfig}", dependencyGraph: "com.vanniktech:gradle-dependency-graph-generator-plugin:${pluginVersion.dependencyGraph}", diff --git a/gradle/sonarqube.gradle b/gradle/sonarqube.gradle deleted file mode 100644 index 2265704bc..000000000 --- a/gradle/sonarqube.gradle +++ /dev/null @@ -1,27 +0,0 @@ -apply plugin: 'org.sonarqube' - -sonarqube { - properties { - // Project Configuration - property "sonar.projectKey", "mapbox-java-services:master" - property "sonar.host.url", "https://sonarcloud.io" - property "sonar.organization", "mapbox" - - // Project identity - property "sonar.projectName", "Mapbox Java" - - // Test reports - property "sonar.java.coveragePlugin", "jacoco" - property "sonar.coverage.exclusions", ["${rootDir}/samples/*", "**/GeoJsonConstants.java"] - property "sonar.jacoco.reportPaths", "${project.buildDir}/jacoco/test.exec" - - // Authentication - property "sonar.login", System.env.SONARQUBE_API_TOKEN - - // Project information - property "sonar.projectDescription", "Contains both a lightwight wrappers for many of Mapbox's APIs and utilities such as Turf for geo-calculations." - property "sonar.links.homepage", "https://github.com/mapbox/mapbox-java" - property "sonar.links.ci", "https://circleci.com/gh/mapbox/mapbox-java" - property "sonar.links.issue", "https://github.com/mapbox/mapbox-java/issues" - } -} \ No newline at end of file diff --git a/samples/build.gradle b/samples/build.gradle index 805ed4410..9d3a825bb 100644 --- a/samples/build.gradle +++ b/samples/build.gradle @@ -32,6 +32,3 @@ buildConfig { buildConfigField 'String', 'MAPBOX_ACCESS_TOKEN', System.getenv("MAPBOX_ACCESS_TOKEN") } -sonarqube { - skipProject = true -}