From d0c71c3bdcc1869b88781ec6bc6835a370be9c8c Mon Sep 17 00:00:00 2001 From: Danno Ferrin Date: Thu, 21 Jul 2022 16:28:20 -0600 Subject: [PATCH] Remove Sonar Integration (#4135) Sonar has been removed from the build workflow. This PR removes all configuration and code markings that were used to facilitate it. Signed-off-by: Danno Ferrin --- .circleci/config.yml | 9 +--- .github/workflows/sonarcloud.yml | 41 ------------------- .../org/hyperledger/besu/cli/BesuCommand.java | 6 +-- build.gradle | 13 ------ .../besu/util/Slf4jLambdaHelper.java | 1 - 5 files changed, 4 insertions(+), 66 deletions(-) delete mode 100644 .github/workflows/sonarcloud.yml diff --git a/.circleci/config.yml b/.circleci/config.yml index 4192595610f..7c4830b45c1 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -212,11 +212,6 @@ jobs: command: | ./gradlew --no-daemon build - capture_test_results -# Temporarily disabled -# - run: -# name: SonarQube -# no_output_timeout: 30m -# command: ./gradlew --no-daemon jacocoRootReport sonarqube -Dsonar.login=$SONAR_TOKEN integrationTests: executor: xl_machine_executor @@ -411,9 +406,7 @@ workflows: - dco - spotless - unitTests: -# Temporarily disabled -# context: SonarCloud - requires: + requires: - assemble - testWindows: requires: diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml deleted file mode 100644 index 8665eab6656..00000000000 --- a/.github/workflows/sonarcloud.yml +++ /dev/null @@ -1,41 +0,0 @@ - -name: SonarCloud analysis - -on: - push: - branches: [ "main", release* ] -# pull_request: -# branches: [ "main" ] - workflow_dispatch: - -permissions: - pull-requests: read # allows SonarCloud to decorate PRs with analysis results - -jobs: - Analysis: - runs-on: ubuntu-latest - - steps: - - name: Analyze with SonarCloud - - # You can pin the exact commit or the version. - # uses: SonarSource/sonarcloud-github-action@de2e56b42aa84d0b1c5b622644ac17e505c9a049 - uses: SonarSource/sonarcloud-github-action@de2e56b42aa84d0b1c5b622644ac17e505c9a049 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} # Generate a token on Sonarcloud.io, add it to the secrets of this repo with the name SONAR_TOKEN (Settings > Secrets > Actions > add new repository secret) - with: - # Additional arguments for the sonarcloud scanner - args: - # Unique keys of your project and organization. You can find them in SonarCloud > Information (bottom-left menu) - # mandatory - -Dsonar.projectKey=hyperledger_besu - -Dsonar.organization=hyperledger - # Comma-separated paths to directories containing main source files. - #-Dsonar.sources= # optional, default is project base directory - # When you need the analysis to take place in a directory other than the one from which it was launched - #-Dsonar.projectBaseDir= # optional, default is . - # Comma-separated paths to directories containing test source files. - #-Dsonar.tests= # optional. For more info about Code Coverage, please refer to https://docs.sonarcloud.io/enriching/test-coverage/overview/ - # Adds more detail to both client and server-side analysis logs, activating DEBUG mode for the scanner, and adding client-side environment variables and system properties to the server-side log of analysis report processing. - #-Dsonar.verbose= # optional, default is false diff --git a/besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java b/besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java index 4c66897c595..ce53d8cdb43 100644 --- a/besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java +++ b/besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java @@ -1190,7 +1190,7 @@ static class TxPoolOptionGroup { "Maximum number of pending transaction hashes that will be kept in the transaction pool (default: ${DEFAULT-VALUE})", arity = "1") @SuppressWarnings("unused") - private final Integer pooledTransactionHashesSize = null; // NOSONAR + private final Integer pooledTransactionHashesSize = null; @Option( names = {"--tx-pool-retention-hours"}, @@ -1906,7 +1906,7 @@ private void issueOptionWarnings() { "--privacy-flexible-groups-enabled"); } - if (txPoolOptionGroup.pooledTransactionHashesSize != null) { // NOSONAR + if (txPoolOptionGroup.pooledTransactionHashesSize != null) { logger.warn(DEPRECATED_AND_USELESS_WARNING_MSG, "--tx-pool-hashes-max-size"); } } @@ -2136,7 +2136,7 @@ private JsonRpcConfiguration createEngineJsonRpcConfiguration( engineConfig.setAuthenticationEnabled(true); engineConfig.setAuthenticationAlgorithm(JwtAlgorithm.HS256); if (Objects.nonNull(engineRPCOptionGroup.engineJwtKeyFile) - && java.nio.file.Files.exists(engineRPCOptionGroup.engineJwtKeyFile)) { // NOSONAR + && java.nio.file.Files.exists(engineRPCOptionGroup.engineJwtKeyFile)) { engineConfig.setAuthenticationPublicKeyFile(engineRPCOptionGroup.engineJwtKeyFile.toFile()); } else { logger.info( diff --git a/build.gradle b/build.gradle index 3debb574b43..71425653c21 100644 --- a/build.gradle +++ b/build.gradle @@ -28,21 +28,8 @@ plugins { id 'me.champeau.jmh' version '0.6.6' apply false id 'net.ltgt.errorprone' version '2.0.2' id 'maven-publish' - id 'org.sonarqube' version '3.4.0.2513' } -sonarqube { - properties { - property "sonar.projectKey", "hyperledger_besu" - property "sonar.organization", "hyperledger" - property "sonar.host.url", "https://sonarcloud.io" - property "sonar.coverage.jacoco.xmlReportPaths", "${buildDir}/reports/jacoco/jacocoRootReport/jacocoRootReport.xml" - property "sonar.coverage.exclusions", "acceptance-tests/**/*" - } -} - -project.tasks["sonarqube"].dependsOn "jacocoRootReport" - if (!JavaVersion.current().java11Compatible) { throw new GradleException("Java 11 or later is required to build Besu.\n" + " Detected version ${JavaVersion.current()}") diff --git a/util/src/main/java/org/hyperledger/besu/util/Slf4jLambdaHelper.java b/util/src/main/java/org/hyperledger/besu/util/Slf4jLambdaHelper.java index f0c4c907106..88481bce929 100644 --- a/util/src/main/java/org/hyperledger/besu/util/Slf4jLambdaHelper.java +++ b/util/src/main/java/org/hyperledger/besu/util/Slf4jLambdaHelper.java @@ -25,7 +25,6 @@ */ public class Slf4jLambdaHelper { - // sonar code smell private Slf4jLambdaHelper() {} public static void warnLambda(