Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
walint
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
hub
walint
Commits
65e496a8
Commit
65e496a8
authored
3 years ago
by
stuebinm
Browse files
Options
Downloads
Patches
Plain Diff
generalise unwrapURI a bit
parent
5c69c311
No related branches found
No related tags found
No related merge requests found
Pipeline
#10300
passed
3 years ago
Stage: build
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/Properties.hs
+19
-4
19 additions, 4 deletions
lib/Properties.hs
with
19 additions
and
4 deletions
lib/Properties.hs
+
19
−
4
View file @
65e496a8
...
...
@@ -566,13 +566,17 @@ unwrapBadgeToken str f = case parseToken str of
Nothing
->
complain
"invalid badge token."
unwrapURI
::
(
KnownSymbol
s
,
HasProperties
a
)
=>
Proxy
s
->
Property
->
(
Text
->
LintWriter
a
)
->
(
RelPath
->
LintWriter
a
)
->
LintWriter
a
unwrapURI
sym
p
@
(
Property
name
_
)
f
g
=
unwrapString
p
$
\
link
->
do
-- | unwraps a URI
unwrapURI'
::
(
KnownSymbol
s
)
=>
Proxy
s
->
Property
->
(
Text
->
LintWriter
a
)
->
(
RelPath
->
LintWriter
a
)
->
LintWriter
a
unwrapURI'
sym
p
@
(
Property
name
_
)
f
g
=
unwrapString
p
$
\
link
->
do
subst
<-
lintConfig
configUriSchemas
case
applySubst
sym
subst
link
of
Right
uri
->
do
setProperty
name
uri
f
uri
Left
NotALink
->
unwrapPath
link
g
Left
err
->
complain
$
case
err
of
...
...
@@ -588,6 +592,17 @@ unwrapURI sym p@(Property name _) f g = unwrapString p $ \link -> do
<>
intercalate
", "
(
fmap
(
<>
"://"
)
allowed
)
<>
"."
VarsDisallowed
->
"extended API links are disallowed in links"
-- | unwraps a URI and adjusts the linter's output
unwrapURI
::
(
KnownSymbol
s
,
HasProperties
a
)
=>
Proxy
s
->
Property
->
(
Text
->
LintWriter
a
)
->
(
RelPath
->
LintWriter
a
)
->
LintWriter
a
unwrapURI
sym
p
@
(
Property
name
_
)
f
=
unwrapURI'
sym
p
$
\
uri
->
setProperty
name
uri
>>
f
uri
-- | just asserts that this is a string
isString
::
Property
->
LintWriter
a
isString
=
flip
unwrapString
(
const
$
pure
()
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment