From 2ffe06300acdfbfecde7e7c1b5e4006544ef9b2b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Sven=20G=2E=20Bro=CC=88nstrup?= <broenstrup@spom.net>
Date: Tue, 21 Dec 2021 22:23:09 +0100
Subject: [PATCH] Did some of the desired changes

---
 lib/Properties.hs | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/lib/Properties.hs b/lib/Properties.hs
index 1c81f87..62cb4f7 100644
--- a/lib/Properties.hs
+++ b/lib/Properties.hs
@@ -228,9 +228,12 @@ checkLayer = do
 checkObjectProperty :: Object -> Property -> LintWriter Layer
 checkObjectProperty obj p@(Property name _) = case name of
   "url" -> do
-    unwrapURI (Proxy @"website") p
+    unwrapURI' (Proxy @"website") p
       (dependsOn . Link)
       (const $ forbid "using \"url\" to open local html files is disallowed.")
+
+    -- | TODO: The uri should be rewritten if the unwrapURI' did add the wrapper
+
     unless (objectType obj == "website")
       $ complain "\"url\" can only be set for objects of type \"website\""
   "allowApi" -> forbidProperty name
@@ -257,7 +260,7 @@ checkObjectProperty obj p@(Property name _) = case name of
   "door" -> do
     isBool p
     unless (objectType obj == "variable") $
-      complain "Door variables must be of type \"variable\""
+      complain "the \"door\" property should only be set on objects of type \"variable\""
     when (null (objectName obj) || objectName obj == Just mempty) $
       complain "Door variables objects must have a name given"
 
@@ -276,7 +279,7 @@ checkObjectProperty obj p@(Property name _) = case name of
   "openSound" -> do
     isString p
 
-    unwrapURI (Proxy @"audio") p
+    unwrapURI' (Proxy @"audio") p
       (dependsOn . Link)
       (dependsOn . Local)
 
@@ -287,7 +290,7 @@ checkObjectProperty obj p@(Property name _) = case name of
   "closeSound" -> do
     isString p
 
-    unwrapURI (Proxy @"audio") p
+    unwrapURI' (Proxy @"audio") p
       (dependsOn . Link)
       (dependsOn . Local)
 
@@ -302,13 +305,13 @@ checkObjectProperty obj p@(Property name _) = case name of
   "bell" -> do
     isBool p
     unless (objectType obj == "variable") $
-      complain "Bell variables must be of type \"variable\""
+      complain "the \"bell\" property should only be set on objects of type \"variable\""
     when (null (objectName obj) || objectName obj == Just mempty) $
       complain "Bell variables objects must have a name given"
   "bellSound" -> do
     isString p
 
-    unwrapURI (Proxy @"audio") p
+    unwrapURI' (Proxy @"audio") p
       (dependsOn . Link)
       (dependsOn . Local)
 
@@ -317,7 +320,7 @@ checkObjectProperty obj p@(Property name _) = case name of
   -- | Applies to doors and bells as well
   "soundRadius" -> do
     isInt p
-    -- requireAnyProperty "door" "bell"
+    -- | maybe we should lint that this property is only used on door and bell variables
 
 
   _ -> warn $ "unknown object property " <> prettyprint name <> "."
-- 
GitLab