|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.android.tools.lint.detector.api.Issue
@Beta public final class Issue
An issue is a potential bug in an Android application. An issue is discovered
by a Detector, and has an associated Severity.
Issues and detectors are separate classes because a detector can discover multiple different issues as it's analyzing code, and we want to be able to different severities for different issues, the ability to suppress one but not other issues from the same detector, and so on.
NOTE: This is not a public or final API; if you rely on this be prepared to adjust your code for the next tools release.
| Nested Class Summary | |
|---|---|
static class |
Issue.OutputFormat
The format of output from the description methods |
| Method Summary | |
|---|---|
Issue |
addMoreInfo(java.lang.String moreInfoUrl)
Adds a more info URL string |
int |
compareTo(Issue other)
Sorts the detectors alphabetically by id. |
static java.lang.String |
convertMarkup(java.lang.String text,
boolean html)
Converts the given markup text to HTML or text, depending on the. |
static Issue |
create(java.lang.String id,
java.lang.String briefDescription,
java.lang.String description,
java.lang.String explanation,
Category category,
int priority,
Severity severity,
Implementation implementation)
Creates a new issue. |
java.lang.String |
getBriefDescription(Issue.OutputFormat format)
Briefly (in a couple of words) describes these errors |
Category |
getCategory()
The primary category of the issue |
Severity |
getDefaultSeverity()
Returns the default severity of the issues found by this detector (some tools may allow the user to specify custom severities for detectors). |
java.lang.String |
getDescription(Issue.OutputFormat format)
Describes in a single line the kinds of checks performed by this rule |
java.lang.String |
getExplanation(Issue.OutputFormat format)
Describes the error found by this rule, e.g. |
java.lang.String |
getId()
Returns the unique id of this issue. |
Implementation |
getImplementation()
Returns the implementation for the given issue |
java.util.List<java.lang.String> |
getMoreInfo()
Returns a link (a URL string) to more information, or null |
int |
getPriority()
Returns a priority, in the range 1-10, with 10 being the most severe and 1 the least |
boolean |
isEnabledByDefault()
Returns whether this issue should be enabled by default, unless the user has explicitly disabled it. |
Issue |
setEnabledByDefault(boolean enabledByDefault)
Sets whether this issue is enabled by default. |
void |
setImplementation(Implementation implementation)
Sets the implementation for the given issue. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Method Detail |
|---|
@NonNull
public static Issue create(@NonNull
java.lang.String id,
@NonNull
java.lang.String briefDescription,
@NonNull
java.lang.String description,
@NonNull
java.lang.String explanation,
@NonNull
Category category,
int priority,
@NonNull
Severity severity,
@NonNull
Implementation implementation)
convertMarkup(String, boolean) method for details.
id - the fixed id of the issuebriefDescription - short summary (typically 5-6 words or less), typically
describing the problem rather than the fix
(e.g. "Missing minSdkVersion")description - the quick summary of the issue (one line), typically describing
what the detector looks forexplanation - a full explanation of the issue, with suggestions for
how to fix itcategory - the associated category, if anypriority - the priority, a number from 1 to 10 with 10 being most
important/severeseverity - the default severity of the issueimplementation - the default implementation for this issue
Issue@NonNull public java.lang.String getId()
@NonNull
public java.lang.String getBriefDescription(@NonNull
Issue.OutputFormat format)
getDescription(OutputFormat)
@NonNull
public java.lang.String getDescription(@NonNull
Issue.OutputFormat format)
getBriefDescription(OutputFormat)
@NonNull
public java.lang.String getExplanation(@NonNull
Issue.OutputFormat format)
getMoreInfo().
format - the format to write the format as
@NonNull public Category getCategory()
public int getPriority()
@NonNull public Severity getDefaultSeverity()
Note that even though the normal way for an issue to be disabled is for
the Configuration to return Severity.IGNORE, there is a
isEnabledByDefault() method which can be used to turn off issues
by default. This is done rather than just having the severity as the only
attribute on the issue such that an issue can be configured with an
appropriate severity (such as Severity.ERROR) even when issues
are disabled by default for example because they are experimental or not
yet stable.
@NonNull public java.util.List<java.lang.String> getMoreInfo()
@NonNull
public Issue addMoreInfo(@NonNull
java.lang.String moreInfoUrl)
moreInfoUrl - url string
public boolean isEnabledByDefault()
@NonNull public Implementation getImplementation()
public void setImplementation(@NonNull
Implementation implementation)
implementation - the new implementation to usepublic int compareTo(Issue other)
compareTo in interface java.lang.Comparable<Issue>other - the Issue to compare this issue to@NonNull public Issue setEnabledByDefault(boolean enabledByDefault)
enabledByDefault - whether the issue should be enabled by default
public java.lang.String toString()
toString in class java.lang.Object
@NonNull
public static java.lang.String convertMarkup(@NonNull
java.lang.String text,
boolean html)
This will recognize the following formatting conventions:
<html> tags around the fragment for HTML output.
TODO: Consider switching to the restructured text format - http://docutils.sourceforge.net/docs/user/rst/quickstart.html
text - the text to be formattedhtml - whether to convert into HTML or text
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||