Class WarningsGuard
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
AllowlistWarningsGuard
,ByPathWarningsGuard
,CheckTypeSummaryWarningsGuard
,ClosureUnawareCodeWarningsGuard
,ComposeWarningsGuard
,DiagnosticGroupPathSuppressingWarningsGuard
,DiagnosticGroupWarningsGuard
,J2clSuppressWarningsGuard
,ShowByPathWarningsGuard
,StrictWarningsGuard
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.
- See Also:
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected int
The priority in which warnings guards are applied.abstract @Nullable CheckLevel
Returns a new check level for a given error.mustRunChecks
(DiagnosticGroup group) Do checks for `group` still need to be run if this guard is installed? TRUE: Enables one or more types in the group, so it must be checked.
-
Constructor Details
-
WarningsGuard
public WarningsGuard()
-
-
Method Details
-
level
Returns 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.
- Parameters:
error
- a reported error.- Returns:
- what level given error should have.
-
mustRunChecks
Do checks for `group` still need to be run if this guard is installed?- TRUE: Enables one or more types in the group, so it must be checked.
- FALSE: Disables all types in the group, so it need not be checked.
- UNKNOWN: Does not affect or only partially disables the group, so checking is undecided.
- Parameters:
group
- a group to check.
-
getPriority
protected int getPriority()The priority in which warnings guards are applied. Lower means the guard will be applied sooner. Expressed on a scale of 1 to 100.
-