diff options
author | Tor Norbye <tnorbye@google.com> | 2012-02-13 09:26:58 -0800 |
---|---|---|
committer | Tor Norbye <tnorbye@google.com> | 2012-02-13 10:46:48 -0800 |
commit | 5da3610b249d74267a67a6b48acdf4cc95475bc0 (patch) | |
tree | 49aa6c0ba4df839c0ea7fba9236d07a6bdb40587 /lint/cli | |
parent | 8c2598f3c4192355773bd070a3eee90e26e382a6 (diff) | |
download | sdk-5da3610b249d74267a67a6b48acdf4cc95475bc0.zip sdk-5da3610b249d74267a67a6b48acdf4cc95475bc0.tar.gz sdk-5da3610b249d74267a67a6b48acdf4cc95475bc0.tar.bz2 |
Add Fatal severity
This changeset adds a new severity, "Fatal", and shifts the abort-on-
export feature from using the Error severity to the Fatal severity.
This gives the user (and lint check developers) a bit more control
over which errors should fail a build. You can now leave some issues
as "error", but not have it block export. This can be useful for
checks which are extremely slow, or for checks that generally
represent errors but where the rule cannot know for sure (such as
attempts to figure out reflection calls in Java).
Change-Id: Ie44d5efcb605091ba8c1c67aa720edbbde416ca5
Diffstat (limited to 'lint/cli')
-rw-r--r-- | lint/cli/src/com/android/tools/lint/HtmlReporter.java | 4 | ||||
-rw-r--r-- | lint/cli/src/com/android/tools/lint/Main.java | 7 | ||||
-rw-r--r-- | lint/cli/src/com/android/tools/lint/MultiProjectHtmlReporter.java | 2 |
3 files changed, 9 insertions, 4 deletions
diff --git a/lint/cli/src/com/android/tools/lint/HtmlReporter.java b/lint/cli/src/com/android/tools/lint/HtmlReporter.java index 45aac72..9cc9c6f 100644 --- a/lint/cli/src/com/android/tools/lint/HtmlReporter.java +++ b/lint/cli/src/com/android/tools/lint/HtmlReporter.java @@ -334,7 +334,7 @@ class HtmlReporter extends Reporter { mWriter.write("</div>\n"); //$NON-NLS-1$ mWriter.write("Severity: "); - if (severity == Severity.ERROR) { + if (severity == Severity.ERROR || severity == Severity.FATAL) { mWriter.write("<span class=\"error\">"); //$NON-NLS-1$ } else if (severity == Severity.WARNING) { mWriter.write("<span class=\"warning\">"); //$NON-NLS-1$ @@ -507,7 +507,7 @@ class HtmlReporter extends Reporter { boolean isError = false; for (Warning warning : warnings) { - if (warning.severity == Severity.ERROR) { + if (warning.severity == Severity.ERROR || warning.severity == Severity.FATAL) { isError = true; break; } diff --git a/lint/cli/src/com/android/tools/lint/Main.java b/lint/cli/src/com/android/tools/lint/Main.java index 3c94f93..c57ec36 100644 --- a/lint/cli/src/com/android/tools/lint/Main.java +++ b/lint/cli/src/com/android/tools/lint/Main.java @@ -853,8 +853,13 @@ public class Main extends LintClient { if (severity == Severity.IGNORE) { return; } - if (severity == Severity.ERROR){ + if (severity == Severity.FATAL) { mFatal = true; + // 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) { mErrorCount++; } else { mWarningCount++; diff --git a/lint/cli/src/com/android/tools/lint/MultiProjectHtmlReporter.java b/lint/cli/src/com/android/tools/lint/MultiProjectHtmlReporter.java index 6dad258..db7b4fb 100644 --- a/lint/cli/src/com/android/tools/lint/MultiProjectHtmlReporter.java +++ b/lint/cli/src/com/android/tools/lint/MultiProjectHtmlReporter.java @@ -103,7 +103,7 @@ class MultiProjectHtmlReporter extends HtmlReporter { int projectErrorCount = 0; int projectWarningCount = 0; for (Warning warning: issues) { - if (warning.severity == Severity.ERROR) { + if (warning.severity == Severity.ERROR || warning.severity == Severity.FATAL) { projectErrorCount++; } else if (warning.severity == Severity.WARNING) { projectWarningCount++; |