]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-7626 Deprecate issues report (html/console) feature 974/head
authorDuarte Meneses <duarte.meneses@sonarsource.com>
Fri, 13 May 2016 12:48:20 +0000 (14:48 +0200)
committerDuarte Meneses <duarte.meneses@sonarsource.com>
Fri, 13 May 2016 14:44:08 +0000 (16:44 +0200)
sonar-scanner-engine/src/main/java/org/sonar/batch/scan/report/ConsoleReport.java
sonar-scanner-engine/src/main/java/org/sonar/batch/scan/report/HtmlReport.java
sonar-scanner-engine/src/test/java/org/sonar/batch/scan/report/ConsoleReportTest.java

index 7e37b789c712343c5922e6cdd41013758469e97e..2ae5f5b8cff174780b60b1a9793f1e624016424b 100644 (file)
@@ -98,6 +98,7 @@ public class ConsoleReport implements Reporter {
   @Override
   public void execute() {
     if (settings.getBoolean(CONSOLE_REPORT_ENABLED_KEY)) {
+      LOG.warn("Console report is deprecated. Use SonarLint CLI to have local reports of issues");
       Report r = new Report();
       r.setNoFile(!inputPathCache.allFiles().iterator().hasNext());
       for (TrackedIssue issue : issueCache.all()) {
index 8111abd467e399dba4acfd5927385a91528a441c..d032a5582cef8221a39daef4b1aaf65c890a37be 100644 (file)
@@ -77,6 +77,7 @@ public class HtmlReport implements Reporter {
   @Override
   public void execute() {
     if (settings.getBoolean(HTML_REPORT_ENABLED_KEY)) {
+      LOG.warn("HTML report is deprecated. Use SonarLint CLI to have local reports of issues");
       IssuesReport report = builder.buildReport();
       print(report);
     }
index 1a49bb94731e394e09607cc73585c73d6beadb43..86b655323a584b2460c2901e1b5a77eef70a9704 100644 (file)
@@ -64,6 +64,7 @@ public class ConsoleReportTest {
     for (String log : logTester.logs()) {
       assertThat(log).doesNotContain(ConsoleReport.HEADER);
     }
+    assertNotDeprecated();
   }
 
   @Test
@@ -72,6 +73,7 @@ public class ConsoleReportTest {
     when(inputPathCache.allFiles()).thenReturn(Collections.<InputFile>emptyList());
     when(issueCache.all()).thenReturn(Collections.<TrackedIssue>emptyList());
     report.execute();
+    assertDeprecated();
     assertThat(getReportLog()).isEqualTo(
       "\n\n-------------  Issues Report  -------------\n\n" +
         "  No file analyzed\n" +
@@ -84,6 +86,7 @@ public class ConsoleReportTest {
     when(inputPathCache.allFiles()).thenReturn(Arrays.<InputFile>asList(new DefaultInputFile("foo", "src/Foo.php")));
     when(issueCache.all()).thenReturn(Arrays.asList(createIssue(false, null)));
     report.execute();
+    assertDeprecated();
     assertThat(getReportLog()).isEqualTo(
       "\n\n-------------  Issues Report  -------------\n\n" +
         "  No new issue\n" +
@@ -96,6 +99,7 @@ public class ConsoleReportTest {
     when(inputPathCache.allFiles()).thenReturn(Arrays.<InputFile>asList(new DefaultInputFile("foo", "src/Foo.php")));
     when(issueCache.all()).thenReturn(Arrays.asList(createIssue(true, Severity.BLOCKER)));
     report.execute();
+    assertDeprecated();
     assertThat(getReportLog()).isEqualTo(
       "\n\n-------------  Issues Report  -------------\n\n" +
         "        +1 issue\n\n" +
@@ -114,6 +118,7 @@ public class ConsoleReportTest {
       createIssue(true, Severity.MINOR),
       createIssue(true, Severity.INFO)));
     report.execute();
+    assertDeprecated();
     assertThat(getReportLog()).isEqualTo(
       "\n\n-------------  Issues Report  -------------\n\n" +
         "        +5 issues\n\n" +
@@ -124,6 +129,22 @@ public class ConsoleReportTest {
         "        +1 info\n" +
         "\n-------------------------------------------\n\n");
   }
+  
+  private void assertDeprecated() {
+    assertThat(getLogs()).contains("Console report is deprecated");
+  }
+  
+  private void assertNotDeprecated() {
+    assertThat(getLogs()).doesNotContain("Console report is deprecated");
+  }
+
+  private String getLogs() {
+    StringBuilder builder = new StringBuilder();
+    for (String log : logTester.logs()) {
+      builder.append(log).append("\n");
+    }
+    return builder.toString();
+  }
 
   private String getReportLog() {
     for (String log : logTester.logs()) {