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
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
61e66f41
Commit
61e66f41
authored
3 years ago
by
stuebinm
Browse files
Options
Downloads
Patches
Plain Diff
add a severity attribute to the json output
parent
95323a5c
No related branches found
No related tags found
No related merge requests found
Pipeline
#8485
passed
3 years ago
Stage: build
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/CheckDir.hs
+16
-11
16 additions, 11 deletions
lib/CheckDir.hs
with
16 additions
and
11 deletions
lib/CheckDir.hs
+
16
−
11
View file @
61e66f41
...
@@ -57,28 +57,33 @@ data MissingDep = MissingDep
...
@@ -57,28 +57,33 @@ data MissingDep = MissingDep
,
neededBy
::
[
FilePath
]
,
neededBy
::
[
FilePath
]
}
deriving
(
Generic
,
ToJSON
)
}
deriving
(
Generic
,
ToJSON
)
-- | Missing assets are the same thing as missing dependencies,
-- but should not be confused (and also serialise differently
-- to json)
newtype
MissingAsset
=
MissingAsset
MissingDep
newtype
MissingAsset
=
MissingAsset
MissingDep
-- | given this config, should the result be considered to have failed?
resultIsFatal
::
LintConfig'
->
DirResult
->
Bool
resultIsFatal
::
LintConfig'
->
DirResult
->
Bool
resultIsFatal
config
res
=
resultIsFatal
config
res
=
not
(
null
(
dirresultMissingAssets
res
))
not
(
null
(
dirresultMissingAssets
res
))
&&
configMaxLintLevel
config
<=
maxObservedLevel
&&
configMaxLintLevel
config
<=
maximumLintLevel
res
where
maxObservedLevel
=
maximum
.
map
hintLevel
-- | maximum lint level that was observed anywhere in any map.
.
concatMap
(
keys
.
mapresultLayer
)
-- note that it really does go through all lints, so don't
.
elems
-- call it too often
.
dirresultMaps
maximumLintLevel
::
DirResult
->
Level
$
res
maximumLintLevel
=
maximum
.
map
hintLevel
.
concatMap
(
keys
.
mapresultLayer
)
.
elems
.
dirresultMaps
instance
ToJSON
DirResult
where
instance
ToJSON
DirResult
where
toJSON
res
=
A
.
object
toJSON
res
=
A
.
object
[
"missingDeps"
.=
dirresultDeps
res
[
"missingDeps"
.=
dirresultDeps
res
,
"missingAssets"
.=
dirresultMissingAssets
res
,
"missingAssets"
.=
dirresultMissingAssets
res
,
"mapLints"
.=
dirresultMaps
res
,
"mapLints"
.=
dirresultMaps
res
,
"severity"
.=
maximumLintLevel
res
]
]
instance
ToJSON
MissingAsset
where
instance
ToJSON
MissingAsset
where
...
...
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