com.android.tools.lint.client.api
Class Configuration

java.lang.Object
  extended by com.android.tools.lint.client.api.Configuration
Direct Known Subclasses:
DefaultConfiguration

@Beta
public abstract class Configuration
extends java.lang.Object

Lint configuration for an Android project such as which specific rules to include, which specific rules to exclude, and which specific errors to ignore.

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.


Constructor Summary
Configuration()
           
 
Method Summary
 void finishBulkEditing()
          Marks the end of a "bulk" editing operation, where values should be committed to persistent storage.
 Severity getSeverity(Issue issue)
          Returns the severity for a given issue.
abstract  void ignore(Context context, Issue issue, Location location, java.lang.String message)
          Marks the given warning as "ignored".
 boolean isEnabled(Issue issue)
          Returns false if the given issue has been disabled.
 boolean isIgnored(Context context, Issue issue, Location location, java.lang.String message)
          Checks whether this issue should be ignored because the user has already suppressed the error? Note that this refers to individual issues being suppressed/ignored, not a whole detector being disabled via something like isEnabled(Issue).
abstract  void setSeverity(Issue issue, Severity severity)
          Sets the severity to be used for this issue.
 void startBulkEditing()
          Marks the beginning of a "bulk" editing operation with repeated calls to setSeverity(com.android.tools.lint.detector.api.Issue, com.android.tools.lint.detector.api.Severity) or ignore(com.android.tools.lint.detector.api.Context, com.android.tools.lint.detector.api.Issue, com.android.tools.lint.detector.api.Location, java.lang.String).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Configuration

public Configuration()
Method Detail

isIgnored

public boolean isIgnored(@NonNull
                         Context context,
                         @NonNull
                         Issue issue,
                         @Nullable
                         Location location,
                         @NonNull
                         java.lang.String message)
Checks whether this issue should be ignored because the user has already suppressed the error? Note that this refers to individual issues being suppressed/ignored, not a whole detector being disabled via something like isEnabled(Issue).

Parameters:
context - the context used by the detector when the issue was found
issue - the issue that was found
location - the location of the issue
message - the associated user message
Returns:
true if this issue should be suppressed

isEnabled

public boolean isEnabled(@NonNull
                         Issue issue)
Returns false if the given issue has been disabled. This is just a convenience method for getSeverity(issue) != Severity.IGNORE.

Parameters:
issue - the issue to check
Returns:
false if the issue has been disabled

getSeverity

public Severity getSeverity(@NonNull
                            Issue issue)
Returns the severity for a given issue. This is the same as the Issue.getDefaultSeverity() unless the user has selected a custom severity (which is tool context dependent).

Parameters:
issue - the issue to look up the severity from
Returns:
the severity use for issues for the given detector

ignore

public abstract void ignore(@NonNull
                            Context context,
                            @NonNull
                            Issue issue,
                            @Nullable
                            Location location,
                            @NonNull
                            java.lang.String message)
Marks the given warning as "ignored".

Parameters:
context - The scanning context
issue - the issue to be ignored
location - The location to ignore the warning at, if any
message - The message for the warning

setSeverity

public abstract void setSeverity(@NonNull
                                 Issue issue,
                                 @Nullable
                                 Severity severity)
Sets the severity to be used for this issue.

Parameters:
issue - the issue to set the severity for
severity - the severity to associate with this issue, or null to reset the severity to the default

startBulkEditing

public void startBulkEditing()
Marks the beginning of a "bulk" editing operation with repeated calls to setSeverity(com.android.tools.lint.detector.api.Issue, com.android.tools.lint.detector.api.Severity) or ignore(com.android.tools.lint.detector.api.Context, com.android.tools.lint.detector.api.Issue, com.android.tools.lint.detector.api.Location, java.lang.String). After all the values have been set, the client must call finishBulkEditing(). This allows configurations to avoid doing expensive I/O (such as writing out a config XML file) for each and every editing operation when they are applied in bulk, such as from a configuration dialog's "Apply" action.


finishBulkEditing

public void finishBulkEditing()
Marks the end of a "bulk" editing operation, where values should be committed to persistent storage. See startBulkEditing() for details.