Package com.google.javascript.jscomp
Class ByPathWarningsGuard
java.lang.Object
com.google.javascript.jscomp.WarningsGuard
com.google.javascript.jscomp.ByPathWarningsGuard
- All Implemented Interfaces:
Serializable
An implementation of a
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.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.google.javascript.jscomp.WarningsGuard
WarningsGuard.Priority -
Method Summary
Modifier and TypeMethodDescriptionstatic ByPathWarningsGuardexceptPath(List<String> paths, CheckLevel level) static ByPathWarningsGuardforPath(List<String> paths, CheckLevel level) protected intThe priority in which warnings guards are applied.@Nullable CheckLevelReturns a new check level for a given error.Methods inherited from class com.google.javascript.jscomp.WarningsGuard
mustRunChecks
-
Method Details
-
forPath
- Parameters:
paths- Paths for matching.level- TheCheckLevelto apply on affected files.- Returns:
- a new
ByPathWarningsGuardthat would affect any file in the given set of paths.
-
exceptPath
- Parameters:
paths- Paths for matching.level- TheCheckLevelto apply on affected files.- Returns:
- a new
ByPathWarningsGuardthat would affect any file not in the given set of paths.
-
level
Description copied from class:WarningsGuardReturns a new check level for a given error.`null` means that this guard does not know what to do with the error. `null` can be used it chain multiple guards; if current guard returns null, then the next in the chain should process it.
- Specified by:
levelin classWarningsGuard- Parameters:
error- a reported error.- Returns:
- what level given error should have.
-
getPriority
protected int getPriority()Description copied from class:WarningsGuardThe priority in which warnings guards are applied. Lower means the guard will be applied sooner. Expressed on a scale of 1 to 100.- Overrides:
getPriorityin classWarningsGuard
-