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.BanExecCommand
,ConformanceRules.BanForOf
,ConformanceRules.BanGlobalVars
,ConformanceRules.BannedEnhance
,ConformanceRules.BanNullDeref
,ConformanceRules.BanSetAttribute
,ConformanceRules.BanStaticThis
,ConformanceRules.BanThrowOfNonErrorTypes
,ConformanceRules.BanUnknownDirectThisPropsReferences
,ConformanceRules.BanUnknownThis
,ConformanceRules.BanUnknownTypedClassPropsReferences
,ConformanceRules.BanUnresolvedType
,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, com.google.javascript.jscomp.Requirement requirement)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
check(NodeTraversal t, Node n)
Perform conformance checkprotected abstract ConformanceRules.ConformanceResult
checkConformance(NodeTraversal t, Node n)
protected void
report(Node n, ConformanceRules.ConformanceResult result)
Report a conformance warning for the given node.protected boolean
tsIsAllowlisted()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.google.javascript.jscomp.CheckConformance.Rule
getPrecondition
-
-
-
-
Constructor Detail
-
AbstractRule
public AbstractRule(AbstractCompiler compiler, com.google.javascript.jscomp.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.Rule
Perform conformance check- Specified by:
check
in 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.
-
-