Skip to content
Snippets Groups Projects
Commit 2ffe0630 authored by Sven G. Brönstrup's avatar Sven G. Brönstrup
Browse files

Did some of the desired changes

parent c0685792
Branches
Tags
1 merge request!1Extended scripts support
......@@ -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 <> "."
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment