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
687e2369
Commit
687e2369
authored
3 years ago
by
stuebinm
Browse files
Options
Downloads
Plain Diff
missing entrypoints can be non-fatal
parents
ee61cc5c
f992cb79
No related branches found
No related tags found
No related merge requests found
Pipeline
#11959
passed
3 years ago
Stage: build
Stage: trigger
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/CheckDir.hs
+8
-7
8 additions, 7 deletions
lib/CheckDir.hs
with
8 additions
and
7 deletions
lib/CheckDir.hs
+
8
−
7
View file @
687e2369
...
...
@@ -19,8 +19,8 @@ import Data.Functor ((<&>))
import
Data.Map
(
Map
,
elems
,
keys
)
import
qualified
Data.Map
as
M
import
Data.Map.Strict
(
mapKeys
,
mapWithKey
,
(
\\
))
import
Data.Maybe
(
mapMaybe
)
import
Data.Text
(
Text
)
import
Data.Maybe
(
mapMaybe
,
isJust
)
import
Data.Text
(
Text
,
isInfixOf
)
import
qualified
Data.Text
as
T
import
Dirgraph
(
graphToDot
,
invertGraph
,
resultToGraph
,
unreachableFrom
)
...
...
@@ -57,7 +57,8 @@ data DirResult = DirResult
}
deriving
(
Generic
)
data
MissingDep
=
MissingDep
{
entrypoint
::
Text
{
depFatal
::
Maybe
Bool
,
entrypoint
::
Text
,
neededBy
::
[
FilePath
]
}
deriving
(
Generic
,
ToJSON
)
...
...
@@ -69,7 +70,7 @@ newtype MissingAsset = MissingAsset MissingDep
-- | given this config, should the result be considered to have failed?
resultIsFatal
::
LintConfig'
->
DirResult
->
Bool
resultIsFatal
config
res
=
not
(
null
$
dirresultMissingAssets
res
)
not
(
null
(
dirresultMissingAssets
res
)
||
not
(
any
(
isJust
.
depFatal
)
(
dirresultDeps
res
)))
||
maximumLintLevel
res
>
configMaxLintLevel
config
-- | maximum lint level that was observed anywhere in any map.
...
...
@@ -124,7 +125,7 @@ instance PrettyPrint (Level, DirResult) where
"
\n
in "
<>
T
.
pack
p
<>
":
\n
"
<>
prettyprint
(
level
,
lint
)
instance
PrettyPrint
MissingDep
where
prettyprint
(
MissingDep
f
n
)
=
prettyprint
(
MissingDep
_
f
n
)
=
" - "
<>
f
<>
" does not exist, but is required by "
<>
prettyDependents
<>
"
\n
"
where
...
...
@@ -172,7 +173,7 @@ recursiveCheckDir config prefix root = do
missingDeps
::
FilePath
->
Map
FilePath
MapResult
->
[
MissingDep
]
missingDeps
entrypoint
maps
=
let
simple
=
M
.
insert
(
T
.
pack
entrypoint
)
[]
used
\\
M
.
union
defined
trivial
in
M
.
foldMapWithKey
(
\
f
n
->
[
MissingDep
f
n
])
simple
in
M
.
foldMapWithKey
(
\
f
n
->
[
MissingDep
(
Just
$
not
(
"#"
`
isInfixOf
`
f
))
f
n
])
simple
where
-- which maps are linked somewhere?
used
::
Map
Text
[
FilePath
]
...
...
@@ -201,7 +202,7 @@ missingAssets prefix maps =
let
asset
=
normalise
(
takeDirectory
path
)
relpath
in
doesFileExist
(
prefix
</>
asset
)
<&>
\
case
True
->
Nothing
False
->
Just
$
MissingDep
(
T
.
pack
asset
)
[
path
]
False
->
Just
$
MissingDep
Nothing
(
T
.
pack
asset
)
[
path
]
_
->
pure
Nothing
)
(
mapresultDepends
mapres
)
...
...
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