From b9852d228e200f00ef63fbe5eca484bc1500196f Mon Sep 17 00:00:00 2001 From: Ian Flanigan Date: Wed, 14 Sep 2016 17:48:08 -0700 Subject: [PATCH] Suppress warning messages for whitelisted properties. Tweak the CSS compiler to not complain about recognized properties with warnings if they are whitelisted with --allowed_unrecognized_properties. Property warnings are already disabled with the --allow_unrecognized_properties flag (see com.google.common.css.compiler.passes.PassRunner:177) so it makes sense to overload this flag to also whitelist flags that are *technically* recognized, but not supported. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=133199104 MOE_MIGRATED_REVID=133703695 --- .../passes/VerifyRecognizedProperties.java | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/com/google/common/css/compiler/passes/VerifyRecognizedProperties.java b/src/com/google/common/css/compiler/passes/VerifyRecognizedProperties.java index 46120b0c..f6c846f4 100644 --- a/src/com/google/common/css/compiler/passes/VerifyRecognizedProperties.java +++ b/src/com/google/common/css/compiler/passes/VerifyRecognizedProperties.java @@ -76,17 +76,19 @@ public boolean enterDeclaration(CssDeclarationNode declarationNode) { property = Property.byName(propertyName); } - if (!property.isRecognizedProperty() && - !allowedUnrecognizedProperties.contains(property.getName())) { - reportError(String.format("%s is an unrecognized property", - property.getName()), propertyNode); - } else if (property.hasWarning()) { - errorManager.reportWarning(new GssError( - String.format( - "WARNING for use of CSS property %s: %s\n", - property.getName(), property.getWarning()), - propertyNode.getSourceCodeLocation())); + if (!allowedUnrecognizedProperties.contains(property.getName())) { + if (!property.isRecognizedProperty()) { + reportError(String.format("%s is an unrecognized property", + property.getName()), propertyNode); + } else if (property.hasWarning()) { + errorManager.reportWarning(new GssError( + String.format( + "WARNING for use of CSS property %s: %s\n", + property.getName(), property.getWarning()), + propertyNode.getSourceCodeLocation())); + } } + return true; }