public abstract class WarningsGuard
extends java.lang.Object
implements java.io.Serializable
Guard has several choices: - return OFF - suppress the warning/error - return WARNING - return ERROR report it with high severity - return null. Does not know what to do with it. Lets the other guard decide what to do with it.
Although the interface is very simple, it allows you easily customize what warnings you are interested in.
For example there are could be several implementations: StrictGuard - {return ERROR}. All warnings should be treat as errors. SilentGuard - {if (WARNING) return OFF}. Suppress all warnings but still fail if JS has errors. AllowlistGuard (if !allowlistErrors.contains(error) return ERROR) return error if it does not present in the allowlist.
Modifier and Type | Class and Description |
---|---|
static class |
WarningsGuard.Priority
Priority
|
Constructor and Description |
---|
WarningsGuard() |
Modifier and Type | Method and Description |
---|---|
protected boolean |
disables(DiagnosticGroup group)
Returns whether all warnings in the given diagnostic group will be
filtered out.
|
protected boolean |
enables(DiagnosticGroup group)
Returns whether any of the warnings in the given diagnostic group will be
upgraded to a warning or error.
|
protected int |
getPriority()
The priority in which warnings guards are applied.
|
abstract CheckLevel |
level(JSError error)
Returns a new check level for a given error.
|
public abstract CheckLevel level(JSError error)
error
- a reported error.protected int getPriority()
protected boolean disables(DiagnosticGroup group)
group
- A group of DiagnosticTypes.protected boolean enables(DiagnosticGroup group)
group
- A group of DiagnosticTypes.Copyright © 2009-2020 Google. All Rights Reserved.