@Beta
public class LintCliFlags
extends java.lang.Object
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.
| Modifier and Type | Field and Description |
|---|---|
static int |
ERRNO_APPLIED_SUGGESTIONS |
static int |
ERRNO_CREATED_BASELINE |
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 and Description |
|---|
LintCliFlags() |
| Modifier and Type | Method and Description |
|---|---|
void |
addDisabledCategory(com.android.tools.lint.detector.api.Category category)
Adds a category to disable
|
void |
addEnabledCategory(com.android.tools.lint.detector.api.Category category)
Adds a category to enable
|
void |
addExactCategory(com.android.tools.lint.detector.api.Category category)
Adds a category to check exactly
|
void |
addExactId(java.lang.String id)
Adds an id to check (will disable everything else)
|
java.io.File |
getBaselineFile()
Returns the baseline file to use, if any.
|
java.util.List<java.io.File> |
getClassesOverride()
Gets the optional manual override of the class file directories.
|
java.lang.String |
getCompileSdkVersionOverride()
Gets the optional compileSdkVersion override.
|
java.io.File |
getDefaultConfiguration()
Returns the default configuration file to use as a fallback
|
java.util.Set<com.android.tools.lint.detector.api.Category> |
getDisabledCategories()
Returns the set of categories to disable, if any.
|
java.util.Set<com.android.tools.lint.detector.api.Category> |
getEnabledCategories()
Returns the set of categories to enable, if any.
|
java.util.Set<java.lang.String> |
getEnabledIds()
Returns the set of issue id's to enable.
|
java.util.Set<com.android.tools.lint.detector.api.Category> |
getExactCategories()
Returns the set of exact categories to check, if any.
|
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.io.File |
getProjectDescriptorOverride()
Gets the optional manual override of the project hierarchy.
|
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 |
isAutoFix()
Whether to apply safe suggestions
|
boolean |
isCheckAllWarnings()
Returns whether lint should check all warnings, including those off by default
|
boolean |
isCheckDependencies()
Returns whether lint should check all dependencies too as part of its analysis.
|
boolean |
isCheckGeneratedSources()
Returns whether lint should run checks on generated sources.
|
boolean |
isCheckTestSources()
Returns whether lint should run all checks on test sources, instead of just the lint checks
that have been specifically written to include tests (e.g.
|
boolean |
isExplainIssues()
Whether text reports should include full explanation texts.
|
boolean |
isFatalOnly()
Returns true if we should only check fatal issues
|
boolean |
isFullPath()
Whether lint should display full paths in the error output.
|
boolean |
isIgnoreTestSources()
Like
isCheckTestSources(), but always skips analyzing tests -- meaning that it also
ignores checks that have explicitly asked to look at test sources, such as the unused
resource check. |
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 |
isRemoveFixedBaselineIssues()
Whether lint will update the baseline file to remove any issues that are no longer present in
the codebase.
|
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
|
boolean |
isWriteBaselineIfMissing()
If true, write the baseline file if missing.
|
void |
setAutoFix(boolean autoFix)
Sets whether to apply safe suggestions
|
void |
setBaselineFile(java.io.File baselineFile)
Sets the baseline file, if any.
|
void |
setCheckAllWarnings(boolean warnAll)
Sets whether lint should check all warnings, including those off by default
|
void |
setCheckDependencies(boolean checkDependencies)
Sets whether lint should check dependencies too
|
void |
setCheckGeneratedSources(boolean checkGenerated)
Sets whether lint should check generated sources
|
void |
setCheckTestSources(boolean checkTests)
Sets whether lint should run all the normal checks on test sources
|
void |
setClassesOverride(java.util.List<java.io.File> classes)
Sets the optional manual override of the class file directories.
|
void |
setCompileSdkVersionOverride(java.lang.String compileSdkVersion)
Sets the optional compileSdkVersion override.
|
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 |
setExplainIssues(boolean explainText)
Sets whether text reports should include full explanation texts.
|
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 |
setIgnoreTestSources(boolean ignoreTests)
Sets whether we should completely skip test sources.
|
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 |
setProjectDescriptorOverride(java.io.File projectDescriptor)
Sets the optional manual override of the project hierarchy.
|
void |
setQuiet(boolean quiet)
Sets whether lint should be quiet (for example, not show progress dots for each analyzed
file)
|
void |
setRemovedFixedBaselineIssues(boolean removeFixed)
Sets whether lint should remove fixed baseline issues.
|
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
|
void |
setWriteBaselineIfMissing(boolean writeBaselineIfMissing)
If true, write the baseline file if missing.
|
public static final int ERRNO_SUCCESS
public static final int ERRNO_ERRORS
public static final int ERRNO_USAGE
public static final int ERRNO_EXISTS
public static final int ERRNO_HELP
public static final int ERRNO_INVALID_ARGS
public static final int ERRNO_CREATED_BASELINE
public static final int ERRNO_APPLIED_SUGGESTIONS
@NonNull public java.util.Set<java.lang.String> getSuppressedIds()
Issue.getId() to the returned set.@NonNull public java.util.Set<java.lang.String> getEnabledIds()
Issue.getId() to the returned set.@Nullable public java.util.Set<com.android.tools.lint.detector.api.Category> getEnabledCategories()
@Nullable public java.util.Set<com.android.tools.lint.detector.api.Category> getDisabledCategories()
@Nullable public java.util.Set<com.android.tools.lint.detector.api.Category> getExactCategories()
@NonNull public java.util.Map<java.lang.String,com.android.tools.lint.detector.api.Severity> getSeverityOverrides()
@Nullable public java.util.Set<java.lang.String> getExactCheckedIds()
getEnabledIds() and without issues disabled via
getSuppressedIds(). If non-null, callers are allowed to modify this collection.public void setExactCheckedIds(@Nullable
java.util.Set<java.lang.String> check)
check - the set of issue id's to checkpublic void addExactId(@NonNull
java.lang.String id)
public void addEnabledCategory(@NonNull
com.android.tools.lint.detector.api.Category category)
public void addDisabledCategory(@NonNull
com.android.tools.lint.detector.api.Category category)
public void addExactCategory(@NonNull
com.android.tools.lint.detector.api.Category category)
public boolean isSetExitCode()
public void setSetExitCode(boolean setExitCode)
public boolean isFullPath()
public void setFullPath(boolean fullPath)
public boolean isShowSourceLines()
public void setShowSourceLines(boolean showLines)
@NonNull public java.util.List<Reporter> getReporters()
XmlReporter and HtmlReporter.public boolean isQuiet()
public void setQuiet(boolean quiet)
public boolean isCheckAllWarnings()
public void setCheckAllWarnings(boolean warnAll)
public boolean isIgnoreWarnings()
public void setIgnoreWarnings(boolean noWarnings)
public boolean isWarningsAsErrors()
public void setWarningsAsErrors(boolean allErrors)
public boolean isCheckTestSources()
public void setCheckTestSources(boolean checkTests)
public boolean isIgnoreTestSources()
isCheckTestSources(), but always skips analyzing tests -- meaning that it also
ignores checks that have explicitly asked to look at test sources, such as the unused
resource check.public void setIgnoreTestSources(boolean ignoreTests)
ignoreTests - if true, ignore tests completelypublic boolean isCheckGeneratedSources()
public void setCheckGeneratedSources(boolean checkGenerated)
public boolean isCheckDependencies()
public void setCheckDependencies(boolean checkDependencies)
public boolean isShowEverything()
public void setShowEverything(boolean showAll)
@Nullable public java.io.File getDefaultConfiguration()
public void setDefaultConfiguration(@Nullable
java.io.File defaultConfiguration)
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).@Nullable public java.util.List<java.io.File> getSourcesOverride()
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.
public void setSourcesOverride(@Nullable
java.util.List<java.io.File> sources)
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.
@Nullable public java.util.List<java.io.File> getClassesOverride()
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.
public void setClassesOverride(@Nullable
java.util.List<java.io.File> classes)
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.
@Nullable public java.util.List<java.io.File> getLibrariesOverride()
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.
public void setLibrariesOverride(@Nullable
java.util.List<java.io.File> libraries)
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.
@Nullable public java.util.List<java.io.File> getResourcesOverride()
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.
public void setResourcesOverride(@Nullable
java.util.List<java.io.File> resources)
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.
@Nullable public java.io.File getProjectDescriptorOverride()
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 specify
the project hierarchy 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).
public void setProjectDescriptorOverride(@Nullable
java.io.File projectDescriptor)
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 specify
the project hierarchy 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).
@Nullable public java.lang.String getCompileSdkVersionOverride()
Normally, the compileSdkVersion (e.g. the build target version) is known by lint from the build system (it's specified explicitly in build.gradle, and in older Eclipse-based projects, in the project.properties file). However, when using third party / unsupported build systems, there's a fallback mechanism you can use specifying the set of manifests, resources and sources via dedicated flags. In those cases the compileSdkVersion is unknown. This flag lets you provide a specific dedicated version to use.
public void setCompileSdkVersionOverride(@Nullable
java.lang.String compileSdkVersion)
Normally, the compileSdkVersion (e.g. the build target version) is known by lint from the build system (it's specified explicitly in build.gradle, and in older Eclipse-based projects, in the project.properties file). However, when using third party / unsupported build systems, there's a fallback mechanism you can use specifying the set of manifests, resources and sources via dedicated flags. In those cases the compileSdkVersion is unknown. This flag lets you provide a specific dedicated version to use.
public boolean isFatalOnly()
public void setFatalOnly(boolean fatalOnly)
fatalOnly - if true, only check fatal issuespublic void setSeverityOverrides(@NonNull
java.util.Map<java.lang.String,com.android.tools.lint.detector.api.Severity> severities)
severities - map from issue id to severitypublic boolean isExplainIssues()
public void setExplainIssues(boolean explainText)
explainText - true if text reports should include explanation text@Nullable public java.io.File getBaselineFile()
If you have a project with a large number of existing warnings, this lets you set a baseline and only see newly introduced warnings until you get a chance to go back and address the "technical debt" of the earlier warnings.
public void setBaselineFile(@Nullable
java.io.File baselineFile)
getBaselineFile()public boolean isRemoveFixedBaselineIssues()
Only applies when a baseline file has been configured.
public void setRemovedFixedBaselineIssues(boolean removeFixed)
isRemoveFixedBaselineIssues()public boolean isWriteBaselineIfMissing()
public void setWriteBaselineIfMissing(boolean writeBaselineIfMissing)
public boolean isAutoFix()
public void setAutoFix(boolean autoFix)