Interface ErrorManager
- All Superinterfaces:
ErrorHandler
- All Known Implementing Classes:
AntErrorManager,BasicErrorManager,BlackHoleErrorManager,FixingErrorManager,LoggerErrorManager,PrintStreamErrorManager,SortingErrorManager,ThreadSafeDelegatingErrorManager
-
Method Summary
Modifier and TypeMethodDescriptionvoidWrites a report to an implementation-specific medium.intGets the number of reported errors.com.google.common.collect.ImmutableList<JSError> Gets all the errors.doubleGets the percentage of typed expressions.intGets the number of reported warnings.com.google.common.collect.ImmutableList<JSError> Gets all the warnings.default booleanReturns if the error manager has errors that should make compilation halt.voidreport(CheckLevel level, JSError error) Reports an error.voidsetTypedPercent(double typedPercent) Sets the percentage of typed expressions.default booleanshouldReportConformanceViolation(com.google.javascript.jscomp.Requirement requirement, com.google.common.base.Optional<com.google.javascript.jscomp.Requirement.WhitelistEntry> whitelistEntry, JSError diagnostic, com.google.javascript.jscomp.ConformanceConfig.LibraryLevelNonAllowlistedConformanceViolationsBehavior behavior, boolean isAllowlisted) Return true if the conformance violation should be reported.
-
Method Details
-
report
Reports an error. The errors will be displayed by thegenerateReport()at the discretion of the implementation.- Specified by:
reportin interfaceErrorHandler- Parameters:
level- the reporting levelerror- the error to report
-
generateReport
void generateReport()Writes a report to an implementation-specific medium. The compiler calls this method after any and allreport(com.google.javascript.jscomp.CheckLevel, com.google.javascript.jscomp.JSError)calls. -
getErrorCount
int getErrorCount()Gets the number of reported errors. -
getWarningCount
int getWarningCount()Gets the number of reported warnings. -
getErrors
com.google.common.collect.ImmutableList<JSError> getErrors()Gets all the errors. -
getWarnings
com.google.common.collect.ImmutableList<JSError> getWarnings()Gets all the warnings. -
setTypedPercent
void setTypedPercent(double typedPercent) Sets the percentage of typed expressions. -
getTypedPercent
double getTypedPercent()Gets the percentage of typed expressions. -
hasHaltingErrors
default boolean hasHaltingErrors()Returns if the error manager has errors that should make compilation halt. This, for example, omits errors that were promoted from warnings by using the --strict flag. -
shouldReportConformanceViolation
default boolean shouldReportConformanceViolation(com.google.javascript.jscomp.Requirement requirement, com.google.common.base.Optional<com.google.javascript.jscomp.Requirement.WhitelistEntry> whitelistEntry, JSError diagnostic, com.google.javascript.jscomp.ConformanceConfig.LibraryLevelNonAllowlistedConformanceViolationsBehavior behavior, boolean isAllowlisted) Return true if the conformance violation should be reported. This is called even if the violation is allowlisted and override implementations all can return true despite allowlisting.This method's name is misleading.
It is called by the
AbstractRule.reportmethod, but none of the implementations of this method actually check whether the violation is allowlisted or not. The actual checking of allowlists is done later at the call-site in theAbstractRule.reportmethod. See - https://source.corp.google.com/piper///depot/google3/third_party/java_src/jscomp/java/com/google/javascript/jscomp/ConformanceRules.java;rcl=783510053;l=364The implementations of this method always delegate to this method (return true) as long as the violation is not in a generated code file (which is always safe and never reported) or is being used by ConformanceAllowlister to generate allowlist updates (therefore not reported). For all violations other violations (except in generated code), this method returns true.
-