diff --git a/tools/cldr-apps/src/main/java/org/unicode/cldr/web/DataPage.java b/tools/cldr-apps/src/main/java/org/unicode/cldr/web/DataPage.java index c8eb55b86fc..62cce3351b6 100644 --- a/tools/cldr-apps/src/main/java/org/unicode/cldr/web/DataPage.java +++ b/tools/cldr-apps/src/main/java/org/unicode/cldr/web/DataPage.java @@ -308,9 +308,6 @@ public String getPClass() { */ private boolean setTests(List testList) { tests = ImmutableList.copyOf(testList); - // remove coverage level errors from payload - tests.removeIf((status) -> status.getSubtype() == Subtype.coverageLevel); - boolean weHaveTests = false; int errorCount = 0; int warningCount = 0; @@ -752,6 +749,7 @@ private void setShimTests(String base_xpath_string, TestResultBundle checkCldr) CandidateItem shimItem = new CandidateItem(null); List iTests = new ArrayList<>(); checkCldr.check(base_xpath_string, iTests, null); + STFactory.removeExcludedChecks(iTests); if (!iTests.isEmpty()) { // Got a bite. if (shimItem.setTests(iTests)) { @@ -868,6 +866,7 @@ private void updateInheritedValue(CLDRFile ourSrc, TestResultBundle checkCldr) { List iTests = new ArrayList<>(); checkCldr.check(xpath, iTests, inheritedValue); + STFactory.removeExcludedChecks(iTests); if (TRACE_TIME) { System.err.println("@@6:" + (System.currentTimeMillis() - lastTime)); @@ -1928,6 +1927,7 @@ private void populateFromThisXpath( List examplesResult = new ArrayList<>(); if (checkCldr != null) { checkCldr.check(xpath, checkCldrResult, isExtraPath ? null : ourValue); + STFactory.removeExcludedChecks(checkCldrResult); checkCldr.getExamples(xpath, isExtraPath ? null : ourValue, examplesResult); } if (ourValue != null && ourValue.length() > 0) { @@ -1959,6 +1959,7 @@ private void populateFromThisXpathAddItemsForVotes( if (avalue != null && checkCldr != null) { List item2Result = new ArrayList<>(); checkCldr.check(xpath, item2Result, avalue); + STFactory.removeExcludedChecks(item2Result); if (!item2Result.isEmpty()) { item2.setTests(item2Result); } diff --git a/tools/cldr-apps/src/main/java/org/unicode/cldr/web/STFactory.java b/tools/cldr-apps/src/main/java/org/unicode/cldr/web/STFactory.java index c9b4fc7cab2..cb1e0b39274 100644 --- a/tools/cldr-apps/src/main/java/org/unicode/cldr/web/STFactory.java +++ b/tools/cldr-apps/src/main/java/org/unicode/cldr/web/STFactory.java @@ -31,6 +31,8 @@ import java.util.logging.Logger; import java.util.stream.Collectors; import org.unicode.cldr.test.CheckCLDR; +import org.unicode.cldr.test.CheckCLDR.CheckStatus; +import org.unicode.cldr.test.CheckCLDR.CheckStatus.Subtype; import org.unicode.cldr.test.TestCache; import org.unicode.cldr.util.CLDRConfig; import org.unicode.cldr.util.CLDRFile; @@ -2032,4 +2034,10 @@ public boolean isVisibleInSurveyTool(CLDRLocale l, String dPath) { return true; // OK. } + + /** remove tests excluded by SurveyTool */ + public static List removeExcludedChecks(List tests) { + tests.removeIf((status) -> status.getSubtype() == Subtype.coverageLevel); + return tests; + } } diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/test/CheckCLDR.java b/tools/cldr-code/src/main/java/org/unicode/cldr/test/CheckCLDR.java index 7e70dddf0cb..9b9eabcf4fb 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/test/CheckCLDR.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/test/CheckCLDR.java @@ -447,6 +447,15 @@ public Options(Options options2) { this.locale = options2.locale; } + public Options(CLDRLocale locale) { + this.locale = locale; + options = new String[Option.values().length]; + set(Option.locale, locale.getBaseName()); + StringBuilder sb = new StringBuilder(); + sb.append(locale.getBaseName()).append('/'); + key = sb.toString().intern(); + } + public Options( CLDRLocale locale, CheckCLDR.Phase testPhase, diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/util/VettingViewer.java b/tools/cldr-code/src/main/java/org/unicode/cldr/util/VettingViewer.java index 745c9274cee..6696998312d 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/util/VettingViewer.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/util/VettingViewer.java @@ -29,7 +29,6 @@ import org.unicode.cldr.test.CheckCLDR; import org.unicode.cldr.test.CheckCLDR.CheckStatus; import org.unicode.cldr.test.CheckCLDR.CheckStatus.Subtype; -import org.unicode.cldr.test.CheckCLDR.Options; import org.unicode.cldr.test.CheckCoverage; import org.unicode.cldr.test.CheckNew; import org.unicode.cldr.test.CoverageLevel2; @@ -158,7 +157,7 @@ Status getErrorStatus( private static class DefaultErrorStatus implements ErrorChecker { private CheckCLDR checkCldr; - private HashMap options = new HashMap<>(); + private CheckCLDR.Options options = null; private ArrayList result = new ArrayList<>(); private CLDRFile cldrFile; private final Factory factory; @@ -170,18 +169,16 @@ private DefaultErrorStatus(Factory cldrFactory) { @Override public Status initErrorStatus(CLDRFile cldrFile) { this.cldrFile = cldrFile; - options = new HashMap<>(); + options = new CheckCLDR.Options(CLDRLocale.getInstance(cldrFile.getLocaleID())); result = new ArrayList<>(); - checkCldr = CheckCLDR.getCheckAll(factory, ".*"); - checkCldr.setCldrFileToCheck(cldrFile, new Options(options), result); + // test initialization is handled by TestCache return Status.ok; } @Override public List getErrorCheckStatus(String path, String value) { - String fullPath = cldrFile.getFullXPath(path); ArrayList result2 = new ArrayList<>(); - checkCldr.check(path, fullPath, value, new CheckCLDR.Options(options), result2); + factory.getTestCache().getBundle(options).check(path, result2, value); return result2; } @@ -198,8 +195,7 @@ public Status getErrorStatus( EnumSet outputSubtypes) { Status result0 = Status.ok; StringBuilder errorMessage = new StringBuilder(); - String fullPath = cldrFile.getFullXPath(path); - checkCldr.check(path, fullPath, value, new CheckCLDR.Options(options), result); + factory.getTestCache().getBundle(options).check(path, result, value); for (CheckStatus checkStatus : result) { final CheckCLDR cause = checkStatus.getCause(); /*