}
} 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);
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);
}
}
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.");
}
}
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
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
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
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
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("");
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
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
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) {
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);