public final class ByPathWarningsGuard extends WarningsGuard
WarningsGuard
that can modify the
CheckLevel
based on the file that caused the warning, and whether
this file matches a set of paths (specified either as include or exclude
of path name parts).
For example:
List<String> paths = new ArrayList<String>(); paths.add("foo"); WarningsGuard guard = ByPathWarningsGuard.forPath(paths, CheckLevel.ERROR, 1);This guard will convert any warning that came from a file that contains "foo" in its path to an error.
WarningsGuard.Priority
Modifier and Type | Field and Description |
---|---|
private boolean |
include |
private CheckLevel |
level |
private java.util.List<java.lang.String> |
paths |
private int |
priority |
private static long |
serialVersionUID |
Modifier | Constructor and Description |
---|---|
private |
ByPathWarningsGuard(java.util.List<java.lang.String> paths,
boolean include,
CheckLevel level)
Constructs a new instance.
|
Modifier and Type | Method and Description |
---|---|
static ByPathWarningsGuard |
exceptPath(java.util.List<java.lang.String> paths,
CheckLevel level) |
static ByPathWarningsGuard |
forPath(java.util.List<java.lang.String> paths,
CheckLevel level) |
protected int |
getPriority()
The priority in which warnings guards are applied.
|
CheckLevel |
level(JSError error)
Returns a new check level for a given error.
|
disables, enables, makeNonStrict
private static final long serialVersionUID
private final java.util.List<java.lang.String> paths
private final boolean include
private final int priority
private CheckLevel level
private ByPathWarningsGuard(java.util.List<java.lang.String> paths, boolean include, CheckLevel level)
CheckLevel
: ERROR have Priority.STRICT, and OFF have priority
FILTER_BY_PATH.
Use forPath(java.util.List<java.lang.String>, com.google.javascript.jscomp.CheckLevel)
or exceptPath(java.util.List<java.lang.String>, com.google.javascript.jscomp.CheckLevel)
to actually create a new
instance.public static ByPathWarningsGuard forPath(java.util.List<java.lang.String> paths, CheckLevel level)
paths
- Paths for matching.level
- The CheckLevel
to apply on affected files.ByPathWarningsGuard
that would affect any file in the
given set of paths.public static ByPathWarningsGuard exceptPath(java.util.List<java.lang.String> paths, CheckLevel level)
paths
- Paths for matching.level
- The CheckLevel
to apply on affected files.ByPathWarningsGuard
that would affect any file not
in the given set of paths.public CheckLevel level(JSError error)
WarningsGuard
level
in class WarningsGuard
error
- a reported error.protected int getPriority()
WarningsGuard
getPriority
in class WarningsGuard