diff options
author | Duarte Meneses <duarte.meneses@sonarsource.com> | 2020-03-09 14:53:05 -0500 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2020-03-13 20:04:14 +0000 |
commit | 27a35cf5aa760828047510cd329e6a49fa4f102a (patch) | |
tree | 55a9bfcb08f79d405ad7edb00f367888dfd7d753 /sonar-scanner-engine | |
parent | ee7b162dd1226cdcf8426864d212bc3c547ab824 (diff) | |
download | sonarqube-27a35cf5aa760828047510cd329e6a49fa4f102a.tar.gz sonarqube-27a35cf5aa760828047510cd329e6a49fa4f102a.zip |
SONAR-11853 Improve logs about autoconfiguration in CIs
Diffstat (limited to 'sonar-scanner-engine')
4 files changed, 9 insertions, 6 deletions
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/ci/CiConfigurationProvider.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/ci/CiConfigurationProvider.java index 80a557760d5..ff7e0cf3bbe 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/ci/CiConfigurationProvider.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/ci/CiConfigurationProvider.java @@ -51,7 +51,7 @@ public class CiConfigurationProvider extends ProviderAdapter { if (detectedVendors.size() == 1) { CiVendor vendor = detectedVendors.get(0); - LOG.info("Detected {}", vendor.getName()); + LOG.info("Auto-configuring with CI '{}'", vendor.getName()); return vendor.loadConfiguration(); } return new EmptyCiConfiguration(); diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/ci/vendors/Jenkins.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/ci/vendors/Jenkins.java index d79cbd7c17c..81c0b579311 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/ci/vendors/Jenkins.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/ci/vendors/Jenkins.java @@ -35,7 +35,7 @@ import org.sonar.scanner.ci.CiVendor; import static org.apache.commons.lang.StringUtils.isNotBlank; public class Jenkins implements CiVendor { - private final static Logger log = Loggers.get(Jenkins.class); + private static final Logger LOG = Loggers.get(Jenkins.class); private final System2 system; private final DefaultInputProject inputProject; @@ -104,7 +104,7 @@ public class Jenkins implements CiVendor { return ref.getObjectId().getName(); } } catch (Exception e) { - log.debug("Couldn't find git sha1 in '{}': {}", refName, e.getMessage()); + LOG.debug("Couldn't find git sha1 in '{}': {}", refName, e.getMessage()); } return null; } diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/report/MetadataPublisher.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/report/MetadataPublisher.java index 13928c69b0f..76b6d52c589 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/report/MetadataPublisher.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/report/MetadataPublisher.java @@ -146,7 +146,10 @@ public class MetadataPublisher implements ReportPublisherStep { private void addScmInformation(ScannerReport.Metadata.Builder builder) { try { - scmRevision.get().ifPresent(builder::setScmRevisionId); + scmRevision.get().ifPresent(revisionId -> { + LOG.debug("SCM revision ID '{}'", revisionId); + builder.setScmRevisionId(revisionId); + }); } catch (UnsupportedOperationException e) { LOG.debug(e.getMessage()); } diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/fs/FileSystemMediumTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/fs/FileSystemMediumTest.java index 0cc41665dea..7850e6ed104 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/fs/FileSystemMediumTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/fs/FileSystemMediumTest.java @@ -256,7 +256,7 @@ public class FileSystemMediumTest { .execute(); assertThat(logTester.logs()).contains("1 file indexed"); - assertThat(logTester.logs()).contains("'src" + File.separator + "sample.unknown' indexed with language 'null'"); + assertThat(logTester.logs()).contains("'src" + File.separator + "sample.unknown' indexed with no language"); assertThat(logTester.logs()).contains("'src/sample.unknown' generated metadata with charset 'UTF-8'"); DefaultInputFile inputFile = (DefaultInputFile) result.inputFile("src/sample.unknown"); assertThat(result.getReportComponent(inputFile)).isNotNull(); @@ -289,7 +289,7 @@ public class FileSystemMediumTest { .build()) .execute(); - assertThat(logTester.logs()).containsOnlyOnce("'src" + File.separator + "myfile.binary' indexed with language 'null'"); + assertThat(logTester.logs()).containsOnlyOnce("'src" + File.separator + "myfile.binary' indexed with no language"); assertThat(logTester.logs()).doesNotContain("Evaluate issue exclusions for 'src/myfile.binary'"); assertThat(logTester.logs()).containsOnlyOnce("Evaluate issue exclusions for 'src/sample.xoo'"); } |