summaryrefslogtreecommitdiff
path: root/lib/Properties.hs
diff options
context:
space:
mode:
authorstuebinm2021-10-17 21:33:36 +0200
committerstuebinm2021-10-30 15:44:25 +0200
commit9e3e10ae5f960d4e544a2792318c3fbf5c44d812 (patch)
tree99144a8f5b4d175fac21734aeb0a226e3bd5144a /lib/Properties.hs
parenta74cc87b085fa15213f8901f091db2631fee10db (diff)
more sensible msg for "property required by"-lints
the previous state appears to have been an oversight and made no sense at all.
Diffstat (limited to '')
-rw-r--r--lib/Properties.hs9
1 files changed, 8 insertions, 1 deletions
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