Package com.google.javascript.jscomp
Class ConformanceRules.AbstractRule
- java.lang.Object
-
- com.google.javascript.jscomp.ConformanceRules.AbstractRule
-
- All Implemented Interfaces:
CheckConformance.Rule
- Direct Known Subclasses:
ConformanceRules.BanCreateDom,ConformanceRules.BanCreateElement,ConformanceRules.BanExpose,ConformanceRules.BanForOf,ConformanceRules.BanGlobalVars,ConformanceRules.BanNullDeref,ConformanceRules.BanThrowOfNonErrorTypes,ConformanceRules.BanUnknownDirectThisPropsReferences,ConformanceRules.BanUnknownThis,ConformanceRules.BanUnknownTypedClassPropsReferences,ConformanceRules.BanUnresolvedType,ConformanceRules.RequireFileoverviewVisibility,ConformanceRules.RequireUseStrict,ConformanceRules.StrictBanUnresolvedType
- Enclosing class:
- ConformanceRules
public abstract static class ConformanceRules.AbstractRule extends java.lang.Object implements CheckConformance.Rule
A conformance rule implementation to support things common to all rules such as allowlisting and reporting.
-
-
Constructor Summary
Constructors Constructor Description AbstractRule(AbstractCompiler compiler, Requirement requirement)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidcheck(NodeTraversal t, Node n)Perform conformance checkprotected abstract ConformanceRules.ConformanceResultcheckConformance(NodeTraversal t, Node n)protected voidreport(Node n, ConformanceRules.ConformanceResult result)Report a conformance warning for the given node.protected booleantsIsAllowlisted()
-
-
-
Constructor Detail
-
AbstractRule
public AbstractRule(AbstractCompiler compiler, Requirement requirement) throws CheckConformance.InvalidRequirementSpec
-
-
Method Detail
-
tsIsAllowlisted
protected boolean tsIsAllowlisted()
-
checkConformance
protected abstract ConformanceRules.ConformanceResult checkConformance(NodeTraversal t, Node n)
- Returns:
- Whether the code represented by the Node conforms to the rule.
-
check
public final void check(NodeTraversal t, Node n)
Description copied from interface:CheckConformance.RulePerform conformance check- Specified by:
checkin interfaceCheckConformance.Rule
-
report
protected void report(Node n, ConformanceRules.ConformanceResult result)
Report a conformance warning for the given node.- Parameters:
n- The node representing the violating code.result- The result representing the confidence of the violation.
-
-