From 69d6ba48c07b69ddd6cce7361573d3ab46517fb0 Mon Sep 17 00:00:00 2001 From: Julien HENRY Date: Tue, 30 Apr 2024 16:59:35 +0200 Subject: [PATCH] SCANCLI-84 Rename SonarScanner -> SonarScanner CLI --- .../sonarsource/scanner/it/ScannerTest.java | 2 +- pom.xml | 2 +- src/main/assembly/bin/sonar-scanner | 2 +- src/main/assembly/bin/sonar-scanner-debug | 4 ++-- src/main/assembly/bin/sonar-scanner-debug.bat | 4 ++-- src/main/assembly/bin/sonar-scanner.bat | 2 +- .../assembly/conf/sonar-scanner.properties | 13 +++++----- .../org/sonarsource/scanner/cli/Main.java | 6 ++--- .../sonarsource/scanner/cli/SystemInfo.java | 2 +- .../org/sonarsource/scanner/cli/MainTest.java | 24 +++++++++---------- .../scanner/cli/SystemInfoTest.java | 2 +- 11 files changed, 31 insertions(+), 32 deletions(-) diff --git a/it/src/test/java/com/sonarsource/scanner/it/ScannerTest.java b/it/src/test/java/com/sonarsource/scanner/it/ScannerTest.java index 1d71853..899c03c 100644 --- a/it/src/test/java/com/sonarsource/scanner/it/ScannerTest.java +++ b/it/src/test/java/com/sonarsource/scanner/it/ScannerTest.java @@ -199,7 +199,7 @@ public class ScannerTest extends ScannerTestCase { "{ \"sonar.scanner.skip\":\"true\" }"); BuildResult result = orchestrator.executeBuild(build); - assertThat(result.getLogs()).contains("SonarScanner analysis skipped"); + assertThat(result.getLogs()).contains("SonarScanner CLI analysis skipped"); } @Test diff --git a/pom.xml b/pom.xml index f047034..5fe78e5 100644 --- a/pom.xml +++ b/pom.xml @@ -66,7 +66,7 @@ org.sonarsource.scanner.lib sonar-scanner-java-library - 3.0.0.74 + 3.0.0.76 com.google.code.findbugs diff --git a/src/main/assembly/bin/sonar-scanner b/src/main/assembly/bin/sonar-scanner index 2d2c2cc..128143f 100755 --- a/src/main/assembly/bin/sonar-scanner +++ b/src/main/assembly/bin/sonar-scanner @@ -1,6 +1,6 @@ #!/usr/bin/env sh # -# SonarScanner Startup Script for Unix +# SonarScanner CLI Startup Script for Unix # # Required ENV vars: # JAVA_HOME - Location of Java's installation, optional if use_embedded_jre is set diff --git a/src/main/assembly/bin/sonar-scanner-debug b/src/main/assembly/bin/sonar-scanner-debug index dd45ab0..1a49c84 100755 --- a/src/main/assembly/bin/sonar-scanner-debug +++ b/src/main/assembly/bin/sonar-scanner-debug @@ -1,6 +1,6 @@ #!/usr/bin/env sh # -# SonarScanner Startup Script for Unix +# SonarScanner CLI Startup Script for Unix # # Required ENV vars: # JAVA_HOME - Location of Java's installation, optional if use_embedded_jre is set @@ -10,7 +10,7 @@ SONAR_SCANNER_DEBUG_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000" -echo "Executing SonarScanner in Debug Mode" +echo "Executing SonarScanner CLI in Debug Mode" echo "SONAR_SCANNER_DEBUG_OPTS=\"-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000\"" env SONAR_SCANNER_OPTS="$SONAR_SCANNER_OPTS" SONAR_SCANNER_DEBUG_OPTS="$SONAR_SCANNER_DEBUG_OPTS" "`dirname "$0"`"/sonar-scanner "$@" diff --git a/src/main/assembly/bin/sonar-scanner-debug.bat b/src/main/assembly/bin/sonar-scanner-debug.bat index 3021c01..aeaae59 100644 --- a/src/main/assembly/bin/sonar-scanner-debug.bat +++ b/src/main/assembly/bin/sonar-scanner-debug.bat @@ -1,4 +1,4 @@ -@REM SonarScanner Startup Script for Windows +@REM SonarScanner CLI Startup Script for Windows @REM @REM Required ENV vars: @REM JAVA_HOME - Location of Java's installation, optional if use_embedded_jre is set @@ -8,6 +8,6 @@ @setlocal @set SONAR_SCANNER_DEBUG_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -echo "Executing SonarScanner in Debug Mode" +echo "Executing SonarScanner CLI in Debug Mode" echo "SONAR_SCANNER_DEBUG_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000" @call "%~dp0"sonar-scanner.bat %* diff --git a/src/main/assembly/bin/sonar-scanner.bat b/src/main/assembly/bin/sonar-scanner.bat index fdfbfd9..654137d 100644 --- a/src/main/assembly/bin/sonar-scanner.bat +++ b/src/main/assembly/bin/sonar-scanner.bat @@ -1,4 +1,4 @@ -@REM SonarScanner Startup Script for Windows +@REM SonarScanner CLI Startup Script for Windows @REM @REM Required ENV vars: @REM JAVA_HOME - Location of Java's installation, optional if use_embedded_jre is set diff --git a/src/main/assembly/conf/sonar-scanner.properties b/src/main/assembly/conf/sonar-scanner.properties index b30e841..8bf8356 100644 --- a/src/main/assembly/conf/sonar-scanner.properties +++ b/src/main/assembly/conf/sonar-scanner.properties @@ -1,9 +1,8 @@ -#Configure here general information about the environment, such as SonarQube server connection details for example -#No information about specific project should appear here +# Configure here general information about the environment, such as the server connection details for example +# No information about specific project should appear here -#----- Default SonarQube server -#sonar.host.url=http://localhost:9000 - -#----- Default source code encoding -#sonar.sourceEncoding=UTF-8 +#----- SonarQube server URL (default to SonarCloud) +#sonar.host.url=https://mycompany.com/sonarqube +#sonar.scanner.proxyHost=myproxy.mycompany.com +#sonar.scanner.proxyPort=8002 diff --git a/src/main/java/org/sonarsource/scanner/cli/Main.java b/src/main/java/org/sonarsource/scanner/cli/Main.java index f9a613d..8ad0c05 100644 --- a/src/main/java/org/sonarsource/scanner/cli/Main.java +++ b/src/main/java/org/sonarsource/scanner/cli/Main.java @@ -79,7 +79,7 @@ public class Main { } } catch (Throwable e) { displayExecutionResult(stats, "FAILURE"); - showError("Error during SonarScanner execution", e, cli.isDebugEnabled()); + showError("Error during SonarScanner CLI execution", e, cli.isDebugEnabled()); status = isUserError(e) ? Exit.USER_ERROR : Exit.INTERNAL_ERROR; } finally { exit.exit(status); @@ -97,7 +97,7 @@ public class Main { private void checkSkip(Properties properties) { if ("true".equalsIgnoreCase(properties.getProperty(ScanProperties.SKIP))) { - logger.info("SonarScanner analysis skipped"); + logger.info("SonarScanner CLI analysis skipped"); exit.exit(Exit.SUCCESS); } } @@ -155,7 +155,7 @@ public class Main { private void suggestDebugMode() { if (!cli.isEmbedded()) { - logger.error("Re-run SonarScanner using the -X switch to enable full debug logging."); + logger.error("Re-run SonarScanner CLI using the -X switch to enable full debug logging."); } } diff --git a/src/main/java/org/sonarsource/scanner/cli/SystemInfo.java b/src/main/java/org/sonarsource/scanner/cli/SystemInfo.java index 5aee435..30abee5 100644 --- a/src/main/java/org/sonarsource/scanner/cli/SystemInfo.java +++ b/src/main/java/org/sonarsource/scanner/cli/SystemInfo.java @@ -39,7 +39,7 @@ class SystemInfo { } static void print(Logs logger) { - logger.info("SonarScanner " + ScannerVersion.version()); + logger.info("SonarScanner CLI " + ScannerVersion.version()); logger.info(java()); logger.info(os()); String scannerOpts = system.getenv("SONAR_SCANNER_OPTS"); diff --git a/src/test/java/org/sonarsource/scanner/cli/MainTest.java b/src/test/java/org/sonarsource/scanner/cli/MainTest.java index 3169142..5d4a372 100644 --- a/src/test/java/org/sonarsource/scanner/cli/MainTest.java +++ b/src/test/java/org/sonarsource/scanner/cli/MainTest.java @@ -93,7 +93,7 @@ public class MainTest { main.analyze(); verify(exit).exit(Exit.INTERNAL_ERROR); - verify(logs).error("Error during SonarScanner execution", e); + verify(logs).error("Error during SonarScanner CLI execution", e); } @Test @@ -110,7 +110,7 @@ public class MainTest { verify(bootstrapper).bootstrap(); verify(engine, never()).analyze(any()); verify(exit).exit(Exit.INTERNAL_ERROR); - verify(logs).error("Error during SonarScanner execution", e); + verify(logs).error("Error during SonarScanner CLI execution", e); } @Test @@ -118,8 +118,8 @@ public class MainTest { Exception e = createException(false); testException(e, false, false, Exit.INTERNAL_ERROR); - verify(logs).error("Error during SonarScanner execution", e); - verify(logs).error("Re-run SonarScanner using the -X switch to enable full debug logging."); + verify(logs).error("Error during SonarScanner CLI execution", e); + verify(logs).error("Re-run SonarScanner CLI using the -X switch to enable full debug logging."); } @Test @@ -128,11 +128,11 @@ public class MainTest { testException(e, false, false, Exit.USER_ERROR); verify(logs, times(5)).error(anyString()); - verify(logs).error("Error during SonarScanner execution"); + verify(logs).error("Error during SonarScanner CLI execution"); verify(logs).error("my message"); verify(logs).error("Caused by: A functional cause"); verify(logs).error(""); - verify(logs).error("Re-run SonarScanner using the -X switch to enable full debug logging."); + verify(logs).error("Re-run SonarScanner CLI using the -X switch to enable full debug logging."); } @Test @@ -141,7 +141,7 @@ public class MainTest { testException(e, false, true, Exit.USER_ERROR); verify(logs, times(4)).error(anyString()); - verify(logs).error("Error during SonarScanner execution"); + verify(logs).error("Error during SonarScanner CLI execution"); verify(logs).error("my message"); verify(logs).error("Caused by: A functional cause"); verify(logs).error(""); @@ -153,7 +153,7 @@ public class MainTest { testException(e, true, false, Exit.USER_ERROR); verify(logs, times(1)).error(anyString(), any(Throwable.class)); - verify(logs).error("Error during SonarScanner execution", e); + verify(logs).error("Error during SonarScanner CLI execution", e); } @Test @@ -162,7 +162,7 @@ public class MainTest { testException(e, true, true, Exit.USER_ERROR); verify(logs, times(1)).error(anyString(), any(Throwable.class)); - verify(logs).error("Error during SonarScanner execution", e); + verify(logs).error("Error during SonarScanner CLI execution", e); } @Test @@ -170,8 +170,8 @@ public class MainTest { Exception e = createException(false); testException(e, true, false, Exit.INTERNAL_ERROR); - verify(logs).error("Error during SonarScanner execution", e); - verify(logs, never()).error("Re-run SonarScanner using the -X switch to enable full debug logging."); + verify(logs).error("Error during SonarScanner CLI execution", e); + verify(logs, never()).error("Re-run SonarScanner CLI using the -X switch to enable full debug logging."); } private void testException(Exception e, boolean debugEnabled, boolean isEmbedded, int expectedExitCode) { @@ -228,7 +228,7 @@ public class MainTest { Main main = new Main(exit, cli, conf, scannerEngineBootstrapperFactory, logs); main.analyze(); - verify(logs).info("SonarScanner analysis skipped"); + verify(logs).info("SonarScanner CLI analysis skipped"); InOrder inOrder = Mockito.inOrder(exit, scannerEngineBootstrapperFactory); inOrder.verify(exit, times(1)).exit(Exit.SUCCESS); diff --git a/src/test/java/org/sonarsource/scanner/cli/SystemInfoTest.java b/src/test/java/org/sonarsource/scanner/cli/SystemInfoTest.java index b5415a1..5a45873 100644 --- a/src/test/java/org/sonarsource/scanner/cli/SystemInfoTest.java +++ b/src/test/java/org/sonarsource/scanner/cli/SystemInfoTest.java @@ -83,7 +83,7 @@ public class SystemInfoTest { verify(mockSystem).getenv("SONAR_SCANNER_OPTS"); verify(logs, never()).info("SonarScanner null"); - verify(logs).info("SonarScanner " + ScannerVersion.version()); + verify(logs).info("SonarScanner CLI " + ScannerVersion.version()); verify(logs).info("Java 1.9 oracle (64-bit)"); verify(logs).info("linux 2.5 x64"); verify(logs).info("SONAR_SCANNER_OPTS=arg"); -- 2.39.5