aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-scanner-engine
diff options
context:
space:
mode:
authorDuarte Meneses <duarte.meneses@sonarsource.com>2016-05-13 14:48:20 +0200
committerDuarte Meneses <duarte.meneses@sonarsource.com>2016-05-13 16:44:08 +0200
commitf49762d1f718302495b9b56ad521c7ec78c46c9d (patch)
treebb2a043f9e5c01a2b4c10ec376276ba8bae60cf1 /sonar-scanner-engine
parent3efea992de3a883b22321a42c0c639364b3fbf11 (diff)
downloadsonarqube-f49762d1f718302495b9b56ad521c7ec78c46c9d.tar.gz
sonarqube-f49762d1f718302495b9b56ad521c7ec78c46c9d.zip
SONAR-7626 Deprecate issues report (html/console) feature
Diffstat (limited to 'sonar-scanner-engine')
-rw-r--r--sonar-scanner-engine/src/main/java/org/sonar/batch/scan/report/ConsoleReport.java1
-rw-r--r--sonar-scanner-engine/src/main/java/org/sonar/batch/scan/report/HtmlReport.java1
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/batch/scan/report/ConsoleReportTest.java21
3 files changed, 23 insertions, 0 deletions
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/batch/scan/report/ConsoleReport.java b/sonar-scanner-engine/src/main/java/org/sonar/batch/scan/report/ConsoleReport.java
index 7e37b789c71..2ae5f5b8cff 100644
--- a/sonar-scanner-engine/src/main/java/org/sonar/batch/scan/report/ConsoleReport.java
+++ b/sonar-scanner-engine/src/main/java/org/sonar/batch/scan/report/ConsoleReport.java
@@ -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()) {
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/batch/scan/report/HtmlReport.java b/sonar-scanner-engine/src/main/java/org/sonar/batch/scan/report/HtmlReport.java
index 8111abd467e..d032a5582ce 100644
--- a/sonar-scanner-engine/src/main/java/org/sonar/batch/scan/report/HtmlReport.java
+++ b/sonar-scanner-engine/src/main/java/org/sonar/batch/scan/report/HtmlReport.java
@@ -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);
}
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/batch/scan/report/ConsoleReportTest.java b/sonar-scanner-engine/src/test/java/org/sonar/batch/scan/report/ConsoleReportTest.java
index 1a49bb94731..86b655323a5 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/batch/scan/report/ConsoleReportTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/batch/scan/report/ConsoleReportTest.java
@@ -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()) {