summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSven G. Brönstrup2021-12-21 22:23:09 +0100
committerSven G. Brönstrup2021-12-21 22:23:09 +0100
commit2ffe06300acdfbfecde7e7c1b5e4006544ef9b2b (patch)
treebf826db1fe8b57d925c67b0cee53b2ff30aa002a
parentc06857929529f48b2b4b63a7e8742b246042bf20 (diff)
Did some of the desired changes
-rw-r--r--lib/Properties.hs17
1 files 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 <> "."