com.android.tools.lint
Class LintCliFlags

java.lang.Object
  extended by com.android.tools.lint.LintCliFlags

@Beta
public class LintCliFlags
extends java.lang.Object

Flags used by the LintCliClient

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.


Field Summary
static int ERRNO_ERRORS
           
static int ERRNO_EXISTS
           
static int ERRNO_HELP
           
static int ERRNO_INVALID_ARGS
           
static int ERRNO_SUCCESS
           
static int ERRNO_USAGE
           
 
Constructor Summary
LintCliFlags()
           
 
Method Summary
 java.util.List<java.io.File> getClassesOverride()
          Gets the optional manual override of the class file directories.
 java.io.File getDefaultConfiguration()
          Returns the default configuration file to use as a fallback
 java.util.Set<java.lang.String> getEnabledIds()
          Returns the set of issue id's to enable.
 java.util.Set<java.lang.String> getExactCheckedIds()
          Returns the exact set of issues to check, or null to run the issues that are enabled by default plus any issues enabled via getEnabledIds() and without issues disabled via getSuppressedIds().
 java.util.List<java.io.File> getLibrariesOverride()
          Gets the optional manual override of the library directories.
 java.util.List<Reporter> getReporters()
          Returns the list of error reports to generate.
 java.util.List<java.io.File> getResourcesOverride()
          Gets the optional manual override of the resources directories.
 java.util.Map<java.lang.String,com.android.tools.lint.detector.api.Severity> getSeverityOverrides()
          Returns a map of manually configured severities to use
 java.util.List<java.io.File> getSourcesOverride()
          Gets the optional manual override of the source directories.
 java.util.Set<java.lang.String> getSuppressedIds()
          Returns the set of issue id's to suppress.
 boolean isCheckAllWarnings()
          Returns whether lint should check all warnings, including those off by default
 boolean isFatalOnly()
          Returns true if we should only check fatal issues
 boolean isFullPath()
          Whether lint should display full paths in the error output.
 boolean isIgnoreWarnings()
          Returns whether lint will only check for errors (ignoring warnings)
 boolean isQuiet()
          Returns whether lint should be quiet (for example, not show progress dots for each analyzed file)
 boolean isSetExitCode()
          Whether lint should set the exit code of the process if errors are found
 boolean isShowEverything()
          Returns whether lint should include all output (e.g.
 boolean isShowSourceLines()
          Whether lint should include the source lines in the output where errors occurred (true by default)
 boolean isWarningsAsErrors()
          Returns whether lint should treat all warnings as errors
 void setCheckAllWarnings(boolean warnAll)
          Sets whether lint should check all warnings, including those off by default
 void setClassesOverride(java.util.List<java.io.File> classes)
          Sets the optional manual override of the class file directories.
 void setDefaultConfiguration(java.io.File defaultConfiguration)
          Sets the default config file to use as a fallback.
 void setExactCheckedIds(java.util.Set<java.lang.String> check)
          Sets the exact set of issues to check.
 void setFatalOnly(boolean fatalOnly)
          Sets whether we should only check fatal issues
 void setFullPath(boolean fullPath)
          Sets whether lint should display full paths in the error output.
 void setIgnoreWarnings(boolean noWarnings)
          Sets whether lint will only check for errors (ignoring warnings)
 void setLibrariesOverride(java.util.List<java.io.File> libraries)
          Sets the optional manual override of the library directories.
 void setQuiet(boolean quiet)
          Sets whether lint should be quiet (for example, not show progress dots for each analyzed file)
 void setResourcesOverride(java.util.List<java.io.File> resources)
          Gets the optional manual override of the resource directories.
 void setSetExitCode(boolean setExitCode)
          Sets whether lint should set the exit code of the process if errors are found
 void setSeverityOverrides(java.util.Map<java.lang.String,com.android.tools.lint.detector.api.Severity> severities)
          Sets a map of severities to use
 void setShowEverything(boolean showAll)
          Sets whether lint should include all output (e.g.
 void setShowSourceLines(boolean showLines)
          Sets whether lint should include the source lines in the output where errors occurred (true by default)
 void setSourcesOverride(java.util.List<java.io.File> sources)
          Sets the optional manual override of the source directories.
 void setWarningsAsErrors(boolean allErrors)
          Sets whether lint should treat all warnings as errors
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ERRNO_SUCCESS

public static final int ERRNO_SUCCESS
See Also:
Constant Field Values

ERRNO_ERRORS

public static final int ERRNO_ERRORS
See Also:
Constant Field Values

ERRNO_USAGE

public static final int ERRNO_USAGE
See Also:
Constant Field Values

ERRNO_EXISTS

public static final int ERRNO_EXISTS
See Also:
Constant Field Values

ERRNO_HELP

public static final int ERRNO_HELP
See Also:
Constant Field Values

ERRNO_INVALID_ARGS

public static final int ERRNO_INVALID_ARGS
See Also:
Constant Field Values
Constructor Detail

LintCliFlags

public LintCliFlags()
Method Detail

getSuppressedIds

@NonNull
public java.util.Set<java.lang.String> getSuppressedIds()
Returns the set of issue id's to suppress. Callers are allowed to modify this collection. To suppress a given issue, add the Issue.getId() to the returned set.


getEnabledIds

@NonNull
public java.util.Set<java.lang.String> getEnabledIds()
Returns the set of issue id's to enable. Callers are allowed to modify this collection. To enable a given issue, add the Issue.getId() to the returned set.


getSeverityOverrides

@NonNull
public java.util.Map<java.lang.String,com.android.tools.lint.detector.api.Severity> getSeverityOverrides()
Returns a map of manually configured severities to use

Returns:
the severity to use for a given issue id

getExactCheckedIds

@Nullable
public java.util.Set<java.lang.String> getExactCheckedIds()
Returns the exact set of issues to check, or null to run the issues that are enabled by default plus any issues enabled via getEnabledIds() and without issues disabled via getSuppressedIds(). If non-null, callers are allowed to modify this collection.


setExactCheckedIds

public void setExactCheckedIds(@Nullable
                               java.util.Set<java.lang.String> check)
Sets the exact set of issues to check.

Parameters:
check - the set of issue id's to check

isSetExitCode

public boolean isSetExitCode()
Whether lint should set the exit code of the process if errors are found


setSetExitCode

public void setSetExitCode(boolean setExitCode)
Sets whether lint should set the exit code of the process if errors are found


isFullPath

public boolean isFullPath()
Whether lint should display full paths in the error output. By default the paths are relative to the path lint was invoked from.


setFullPath

public void setFullPath(boolean fullPath)
Sets whether lint should display full paths in the error output. By default the paths are relative to the path lint was invoked from.


isShowSourceLines

public boolean isShowSourceLines()
Whether lint should include the source lines in the output where errors occurred (true by default)


setShowSourceLines

public void setShowSourceLines(boolean showLines)
Sets whether lint should include the source lines in the output where errors occurred (true by default)


getReporters

@NonNull
public java.util.List<Reporter> getReporters()
Returns the list of error reports to generate. Clients can modify the returned list and add additional reporters such as XmlReporter and HtmlReporter.


isQuiet

public boolean isQuiet()
Returns whether lint should be quiet (for example, not show progress dots for each analyzed file)


setQuiet

public void setQuiet(boolean quiet)
Sets whether lint should be quiet (for example, not show progress dots for each analyzed file)


isCheckAllWarnings

public boolean isCheckAllWarnings()
Returns whether lint should check all warnings, including those off by default


setCheckAllWarnings

public void setCheckAllWarnings(boolean warnAll)
Sets whether lint should check all warnings, including those off by default


isIgnoreWarnings

public boolean isIgnoreWarnings()
Returns whether lint will only check for errors (ignoring warnings)


setIgnoreWarnings

public void setIgnoreWarnings(boolean noWarnings)
Sets whether lint will only check for errors (ignoring warnings)


isWarningsAsErrors

public boolean isWarningsAsErrors()
Returns whether lint should treat all warnings as errors


setWarningsAsErrors

public void setWarningsAsErrors(boolean allErrors)
Sets whether lint should treat all warnings as errors


isShowEverything

public boolean isShowEverything()
Returns whether lint should include all output (e.g. include all alternate locations, not truncating long messages, etc.)


setShowEverything

public void setShowEverything(boolean showAll)
Sets whether lint should include all output (e.g. include all alternate locations, not truncating long messages, etc.)


getDefaultConfiguration

@Nullable
public java.io.File getDefaultConfiguration()
Returns the default configuration file to use as a fallback


setDefaultConfiguration

public void setDefaultConfiguration(@Nullable
                                    java.io.File defaultConfiguration)
Sets the default config file to use as a fallback. This corresponds to a lint.xml file with severities etc to use when a project does not have more specific information. To construct a configuration from a File, use LintCliClient.createConfigurationFromFile(java.io.File).


getSourcesOverride

@Nullable
public java.util.List<java.io.File> getSourcesOverride()
Gets the optional manual override of the source directories. Normally null.

Normally, the source, library and resource paths for a project should be computed by the LintClient itself, using available project metadata. However, the user can set the source paths explicitly. This is normally done when running lint on raw source code without proper metadata (or when using a build system unknown to lint, such as say make.


setSourcesOverride

public void setSourcesOverride(@Nullable
                               java.util.List<java.io.File> sources)
Sets the optional manual override of the source directories. Normally null.

Normally, the source, library and resource paths for a project should be computed by the LintClient itself, using available project metadata. However, the user can set the source paths explicitly. This is normally done when running lint on raw source code without proper metadata (or when using a build system unknown to lint, such as say make.


getClassesOverride

@Nullable
public java.util.List<java.io.File> getClassesOverride()
Gets the optional manual override of the class file directories. Normally null.

Normally, the source, library and resource paths for a project should be computed by the LintClient itself, using available project metadata. However, the user can set the source paths explicitly. This is normally done when running lint on raw source code without proper metadata (or when using a build system unknown to lint, such as say make.


setClassesOverride

public void setClassesOverride(@Nullable
                               java.util.List<java.io.File> classes)
Sets the optional manual override of the class file directories. Normally null.

Normally, the source, library and resource paths for a project should be computed by the LintClient itself, using available project metadata. However, the user can set the source paths explicitly. This is normally done when running lint on raw source code without proper metadata (or when using a build system unknown to lint, such as say make.


getLibrariesOverride

@Nullable
public java.util.List<java.io.File> getLibrariesOverride()
Gets the optional manual override of the library directories. Normally null.

Normally, the source, library and resource paths for a project should be computed by the LintClient itself, using available project metadata. However, the user can set the source paths explicitly. This is normally done when running lint on raw source code without proper metadata (or when using a build system unknown to lint, such as say make.


setLibrariesOverride

public void setLibrariesOverride(@Nullable
                                 java.util.List<java.io.File> libraries)
Sets the optional manual override of the library directories. Normally null.

Normally, the source, library and resource paths for a project should be computed by the LintClient itself, using available project metadata. However, the user can set the source paths explicitly. This is normally done when running lint on raw source code without proper metadata (or when using a build system unknown to lint, such as say make.


getResourcesOverride

@Nullable
public java.util.List<java.io.File> getResourcesOverride()
Gets the optional manual override of the resources directories. Normally null.

Normally, the source, library and resource paths for a project should be computed by the LintClient itself, using available project metadata. However, the user can set the source paths explicitly. This is normally done when running lint on raw source code without proper metadata (or when using a build system unknown to lint, such as say make.


setResourcesOverride

public void setResourcesOverride(@Nullable
                                 java.util.List<java.io.File> resources)
Gets the optional manual override of the resource directories. Normally null.

Normally, the source, library and resource paths for a project should be computed by the LintClient itself, using available project metadata. However, the user can set the source paths explicitly. This is normally done when running lint on raw source code without proper metadata (or when using a build system unknown to lint, such as say make.


isFatalOnly

public boolean isFatalOnly()
Returns true if we should only check fatal issues

Returns:
true if we should only check fatal issues

setFatalOnly

public void setFatalOnly(boolean fatalOnly)
Sets whether we should only check fatal issues

Parameters:
fatalOnly - if true, only check fatal issues

setSeverityOverrides

public void setSeverityOverrides(@NonNull
                                 java.util.Map<java.lang.String,com.android.tools.lint.detector.api.Severity> severities)
Sets a map of severities to use

Parameters:
severities - map from issue id to severity