Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Turn off conformance checks for clutz and gents. #808

Merged
merged 1 commit into from Dec 6, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/main/java/com/google/javascript/clutz/Options.java
Expand Up @@ -16,6 +16,8 @@
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.regex.Pattern;
import org.kohsuke.args4j.Argument;
import org.kohsuke.args4j.CmdLineException;
Expand Down Expand Up @@ -183,6 +185,12 @@ public CompilerOptions getCompilerOptions() {
DependencyOptions.pruneLegacyForEntryPoints(entryPointIdentifiers));
}

// Turns off common warning messages, when PhaseOptimizer decides to skip some passes due to
// unsupported code constructs. They are not very actionable to users, and do not seem to
// affect the quality of produced .d.ts.
Logger phaseLogger = Logger.getLogger("com.google.javascript.jscomp.PhaseOptimizer");
phaseLogger.setLevel(Level.OFF);

// All diagnostics are WARNINGs (or off) and thus ignored unless debug == true.
// Only report issues (and fail for them) that are specifically causing problems for Clutz.
// The idea is to not do a general sanity check of Closure code, just make sure Clutz works.
Expand All @@ -206,6 +214,7 @@ public CompilerOptions getCompilerOptions() {
options.setChecksOnly(true);
options.setPreserveDetailedSourceInfo(true);
options.setParseJsDocDocumentation(Config.JsDocParsing.INCLUDE_DESCRIPTIONS_NO_WHITESPACE);
options.clearConformanceConfigs();
if (partialInput) {
options.setAssumeForwardDeclaredForMissingTypes(true);
options.setWarningLevel(DiagnosticGroups.MISSING_SOURCES_WARNINGS, CheckLevel.OFF);
Expand Down
10 changes: 10 additions & 0 deletions src/main/java/com/google/javascript/gents/Options.java
Expand Up @@ -19,6 +19,8 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.kohsuke.args4j.Argument;
import org.kohsuke.args4j.CmdLineException;
import org.kohsuke.args4j.CmdLineParser;
Expand Down Expand Up @@ -113,6 +115,12 @@ public CompilerOptions getCompilerOptions() {
final CompilerOptions options = new CompilerOptions();
options.setClosurePass(true);

// Turns off common warning messages, when PhaseOptimizer decides to skip some passes due to
// unsupported code constructs. They are not very actionable to users and do not matter to
// gents.
Logger phaseLogger = Logger.getLogger("com.google.javascript.jscomp.PhaseOptimizer");
phaseLogger.setLevel(Level.OFF);

options.setCheckGlobalNamesLevel(CheckLevel.ERROR);
// Report duplicate definitions, e.g. for accidentally duplicated externs.
options.setWarningLevel(DiagnosticGroups.DUPLICATE_VARS, CheckLevel.ERROR);
Expand All @@ -133,6 +141,8 @@ public CompilerOptions getCompilerOptions() {
options.setPreserveDetailedSourceInfo(true);
options.setParseJsDocDocumentation(Config.JsDocParsing.INCLUDE_DESCRIPTIONS_NO_WHITESPACE);

options.clearConformanceConfigs();

return options;
}

Expand Down