Skip to content

Commit

Permalink
CLDR-7646 Prepare to use TestCache in VettingViewer
Browse files Browse the repository at this point in the history
- CheckCoverage: improve accept() call
- DataPage / STFactory:  use all tests (.*), but filter out Coverage before sending to client
  • Loading branch information
srl295 committed Jan 6, 2024
1 parent 8fc4577 commit 5e91b63
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 27 deletions.
35 changes: 14 additions & 21 deletions tools/cldr-apps/src/main/java/org/unicode/cldr/web/DataPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.unicode.cldr.icu.LDMLConstants;
import org.unicode.cldr.test.*;
import org.unicode.cldr.test.CheckCLDR.CheckStatus;
import org.unicode.cldr.test.CheckCLDR.CheckStatus.Subtype;
import org.unicode.cldr.test.CheckCLDR.InputMethod;
import org.unicode.cldr.test.CheckCLDR.Options;
import org.unicode.cldr.test.CheckCLDR.StatusAction;
Expand Down Expand Up @@ -307,30 +308,22 @@ public String getPClass() {
*/
private boolean setTests(List<CheckStatus> testList) {
tests = ImmutableList.copyOf(testList);
// only consider non-example tests as notable.
// remove coverage level errors from payload
tests.removeIf((status) -> status.getSubtype() == Subtype.coverageLevel);

boolean weHaveTests = false;
int errorCount = 0;
int warningCount = 0;
for (CheckStatus status : tests) {
if (!status.getType().equals(CheckStatus.exampleType)) {
// skip codefallback exemplar complaints (i.e. 'JPY'
// isn't in exemplars).. they'll show up in missing
if (DEBUG)
System.err.println(
"err: "
+ status.getMessage()
+ ", test: "
+ status.getClass()
+ ", cause: "
+ status.getCause()
+ " on "
+ xpath);
weHaveTests = true;
if (status.getType().equals(CheckStatus.errorType)) {
errorCount++;
} else if (status.getType().equals(CheckStatus.warningType)) {
warningCount++;
}
for (final CheckStatus status : tests) {
logger.finest(() -> status + " on " + xpath);
if (status.getType() == CheckStatus.exampleType) {
continue; // does not count as an error or warning but included in payload
}
weHaveTests = true;
if (status.getType().equals(CheckStatus.errorType)) {
errorCount++;
} else if (status.getType().equals(CheckStatus.warningType)) {
warningCount++;
}
}
if (weHaveTests) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1253,10 +1253,6 @@ public STFactory(SurveyMain sm) {
throw new NullPointerException("getSupplementalDirectory() == null!");
}

progress.update("setup test cache");
getTestCache().setNameMatcher("(?!.*(CheckCoverage).*).*");
progress.update("setup disk test cache");
sm.getDiskFactory().getTestCache().setNameMatcher("(?!.*(CheckCoverage).*).*");
progress.update("reload all users");
sm.reg.getVoterInfoList();
progress.update("setup pathheader factory");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,15 @@ public CheckCoverage(Factory factory) {
public CheckCLDR handleCheck(
String path, String fullPath, String value, Options options, List<CheckStatus> result) {

if (!accept(result)) return this;

CLDRFile resolvedCldrFileToCheck = getResolvedCldrFileToCheck();

// skip if we are not the winning path
if (!resolvedCldrFileToCheck.isWinningPath(path)) {
return this;
}

if (!accept(result)) return this;

Status status = new Status();

/*
Expand Down

0 comments on commit 5e91b63

Please sign in to comment.