public class WhitelistWarningsGuard extends WarningsGuard
WarningsGuard that provides functionality to maintain
a list of warnings (white-list). It is subclasses' responsibility to decide
what to do with the white-list by implementing the level function.
Warnings are defined by the name of the JS file and the first line of
warnings description.| Modifier and Type | Class and Description |
|---|---|
static class |
WhitelistWarningsGuard.WhitelistBuilder |
WarningsGuard.Priority| Constructor and Description |
|---|
WhitelistWarningsGuard(Set<String> whiteList)
This class depends on an input set that contains the white-list.
|
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
containWarning(String formattedWarning)
Determines whether a given warning is included in the white-list.
|
static String |
formatWarning(JSError error) |
static String |
formatWarning(JSError error,
boolean withLineNumber) |
static WhitelistWarningsGuard |
fromFile(File file)
Creates a warnings guard from a file.
|
static String |
getFirstLine(String warning) |
int |
getPriority()
The priority in which warnings guards are applied.
|
CheckLevel |
level(JSError error)
Returns a new check level for a given error.
|
static Set<String> |
loadWhitelistedJsWarnings(File file)
Loads legacy warnings list from the file.
|
protected static Set<String> |
loadWhitelistedJsWarnings(com.google.common.io.InputSupplier<InputStreamReader> supplier)
Loads legacy warnings list from the file.
|
disables, enablespublic WhitelistWarningsGuard(Set<String> whiteList)
whiteList - The set of JS-warnings that are white-listed. This is
expected to have similar format as formatWarning(JSError).public CheckLevel level(JSError error)
WarningsGuardlevel in class WarningsGuarderror - a reported error.protected boolean containWarning(String formattedWarning)
formattedWarning - the warning formatted by formatWarningpublic int getPriority()
WarningsGuardgetPriority in class WarningsGuardpublic static WhitelistWarningsGuard fromFile(File file)
public static Set<String> loadWhitelistedJsWarnings(File file)
protected static Set<String> loadWhitelistedJsWarnings(com.google.common.io.InputSupplier<InputStreamReader> supplier)