From 9e3e10ae5f960d4e544a2792318c3fbf5c44d812 Mon Sep 17 00:00:00 2001 From: stuebinm Date: Sun, 17 Oct 2021 21:33:36 +0200 Subject: more sensible msg for "property required by"-lints the previous state appears to have been an oversight and made no sense at all. --- lib/Properties.hs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/Properties.hs b/lib/Properties.hs index ee774c8..ed97355 100644 --- a/lib/Properties.hs +++ b/lib/Properties.hs @@ -163,6 +163,7 @@ checkLayerProperty p@(Property name _value) = case name of complain $ "unknown property type " <> prettyprint name where isForbidden = forbidProperty name + requireProperty req = propertyRequiredBy req name -- | this property can only be used on a layer that contains at least one tiles forbidEmptyLayer = do @@ -208,7 +209,13 @@ forbidProperty name = do requireProperty :: HasProperties a => Text -> LintWriter a requireProperty name = unlessHasProperty name - $ complain $ "property "<>prettyprint name<>" requires property "<>prettyprint name + $ complain $ "property "<>prettyprint name<>" is required" + +propertyRequiredBy :: HasProperties a => Text -> Text -> LintWriter a +propertyRequiredBy req by = + unlessHasProperty req + $ complain $ "property "<>prettyprint req<>" is required by property "<> prettyprint by + -- | suggest some value for another property if that property does not -- also already exist -- cgit v1.2.3