From efc79c641bb33e2dcafd174f7f3671fbf3c57369 Mon Sep 17 00:00:00 2001 From: macchiati Date: Mon, 17 Jun 2024 13:07:08 -0700 Subject: [PATCH] CLDR-17736 Suppress width errors during Build phase --- .../java/org/unicode/cldr/test/CheckDates.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/test/CheckDates.java b/tools/cldr-code/src/main/java/org/unicode/cldr/test/CheckDates.java index 4d57dd8baae..c61170383c4 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/test/CheckDates.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/test/CheckDates.java @@ -376,7 +376,7 @@ public CheckCLDR handleCheck( CheckStatus item = new CheckStatus() .setCause(this) - .setMainType(CheckStatus.errorType) + .setMainType(errorOrIfBuildWarning()) .setSubtype(Subtype.abbreviatedDateFieldTooWide) .setMessage( "Abbreviated value \"{0}\" can't be longer than the corresponding wide value \"{1}\"", @@ -468,7 +468,7 @@ && isTooMuchWiderThan(value, abbrValue) CheckStatus item = new CheckStatus() .setCause(this) - .setMainType(CheckStatus.errorType) + .setMainType(errorOrIfBuildWarning()) .setSubtype(Subtype.shortDateFieldInconsistentLength) .setMessage(message, value, compareValue); result.add(item); @@ -481,7 +481,7 @@ && isTooMuchWiderThan(value, abbrValue) CheckStatus item = new CheckStatus() .setCause(this) - .setMainType(CheckStatus.errorType) + .setMainType(errorOrIfBuildWarning()) .setSubtype(Subtype.narrowDateFieldTooWide) .setMessage( "Narrow value \"{0}\" can't be longer than the corresponding abbreviated value \"{1}\"", @@ -496,7 +496,7 @@ && isTooMuchWiderThan(value, abbrValue) CheckStatus item = new CheckStatus() .setCause(this) - .setMainType(CheckStatus.errorType) + .setMainType(errorOrIfBuildWarning()) .setSubtype(Subtype.abbreviatedDateFieldTooWide) .setMessage( "Abbreviated value \"{0}\" can't be longer than the corresponding wide value \"{1}\"", @@ -510,7 +510,7 @@ && isTooMuchWiderThan(value, abbrValue) result.add( new CheckStatus() .setCause(this) - .setMainType(CheckStatus.errorType) + .setMainType(errorOrIfBuildWarning()) .setSubtype(Subtype.illegalDatePattern) .setMessage(failure)); } @@ -729,6 +729,10 @@ && isTooMuchWiderThan(value, abbrValue) return this; } + public org.unicode.cldr.test.CheckCLDR.CheckStatus.Type errorOrIfBuildWarning() { + return getPhase() != Phase.BUILD ? CheckStatus.errorType : CheckStatus.warningType; + } + private boolean isTooMuchWiderThan(String shortString, String longString) { // We all 1/3 the width of the reference character as a "fudge factor" in determining the // allowable width