aboutsummaryrefslogtreecommitdiffstats
path: root/lint/cli
diff options
context:
space:
mode:
authorTor Norbye <tnorbye@google.com>2012-08-22 14:44:02 -0700
committerTor Norbye <tnorbye@google.com>2012-08-22 14:44:17 -0700
commit7840cea28d27dffe201f356bc77dba8e632f1b94 (patch)
tree5b0f934a9ee4d16bb4885c39d2f7bfbaf042588c /lint/cli
parent66bfe320933d596f263d0b8bda5d025a8f50a7c6 (diff)
downloadsdk-7840cea28d27dffe201f356bc77dba8e632f1b94.zip
sdk-7840cea28d27dffe201f356bc77dba8e632f1b94.tar.gz
sdk-7840cea28d27dffe201f356bc77dba8e632f1b94.tar.bz2
Preserve fatal severity for Lint XML reports
The Lint CLI does not distinguish between errors and fatal errors in the error output. However, changing the severity was happening when the issue was reported rather in the output reporter itself, which meant that it accidentally changed the severity in the XML report, where all metadata should be preserved. Change-Id: Ib3ee9a20a7b1d2413ed85e1952f5f3d1783a8826
Diffstat (limited to 'lint/cli')
-rw-r--r--lint/cli/src/com/android/tools/lint/Main.java7
-rw-r--r--lint/cli/src/com/android/tools/lint/TextReporter.java9
2 files changed, 9 insertions, 7 deletions
diff --git a/lint/cli/src/com/android/tools/lint/Main.java b/lint/cli/src/com/android/tools/lint/Main.java
index 20825cb..47d00d2 100644
--- a/lint/cli/src/com/android/tools/lint/Main.java
+++ b/lint/cli/src/com/android/tools/lint/Main.java
@@ -1053,12 +1053,7 @@ public class Main extends LintClient {
return;
}
- if (severity == Severity.FATAL) {
- // From here on, treat the fatal error as an error such that we don't display
- // both "Fatal:" and "Error:" etc in the error output.
- severity = Severity.ERROR;
- }
- if (severity == Severity.ERROR) {
+ if (severity == Severity.ERROR || severity == Severity.FATAL) {
mHasErrors = true;
mErrorCount++;
} else {
diff --git a/lint/cli/src/com/android/tools/lint/TextReporter.java b/lint/cli/src/com/android/tools/lint/TextReporter.java
index 7bce91f..4f2c8b4 100644
--- a/lint/cli/src/com/android/tools/lint/TextReporter.java
+++ b/lint/cli/src/com/android/tools/lint/TextReporter.java
@@ -18,6 +18,7 @@ package com.android.tools.lint;
import com.android.tools.lint.detector.api.Location;
import com.android.tools.lint.detector.api.Position;
+import com.android.tools.lint.detector.api.Severity;
import com.google.common.annotations.Beta;
import java.io.IOException;
@@ -75,7 +76,13 @@ public class TextReporter extends Reporter {
}
}
- output.append(warning.severity.getDescription());
+ Severity severity = warning.severity;
+ if (severity == Severity.FATAL) {
+ // Treat the fatal error as an error such that we don't display
+ // both "Fatal:" and "Error:" etc in the error output.
+ severity = Severity.ERROR;
+ }
+ output.append(severity.getDescription());
output.append(':');
output.append(' ');