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
a572b9e1
Commit
a572b9e1
authored
3 years ago
by
stuebinm
Browse files
Options
Downloads
Patches
Plain Diff
exit with code 1 if maximum lint level exceeded
parent
7b079ff7
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
config.json
+1
-1
1 addition, 1 deletion
config.json
lib/CheckDir.hs
+18
-8
18 additions, 8 deletions
lib/CheckDir.hs
lib/LintConfig.hs
+1
-1
1 addition, 1 deletion
lib/LintConfig.hs
lib/WriteRepo.hs
+6
-5
6 additions, 5 deletions
lib/WriteRepo.hs
with
26 additions
and
15 deletions
config.json
+
1
−
1
View file @
a572b9e1
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
"AssemblyTag"
:
"assemblyname"
,
"AssemblyTag"
:
"assemblyname"
,
"ScriptInject"
:
null
,
"ScriptInject"
:
null
,
"AllowScripts"
:
true
,
"AllowScripts"
:
true
,
"Max
Warn
Level"
:
"Suggestion"
,
"Max
Lint
Level"
:
"Suggestion"
,
"DontCopyAssets"
:
true
,
"DontCopyAssets"
:
true
,
"LinkPrefix"
:
"https://exit.rc3.world?link="
"LinkPrefix"
:
"https://exit.rc3.world?link="
}
}
This diff is collapsed.
Click to expand it.
lib/CheckDir.hs
+
18
−
8
View file @
a572b9e1
...
@@ -4,32 +4,33 @@
...
@@ -4,32 +4,33 @@
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TupleSections #-}
{-# LANGUAGE TupleSections #-}
{-# LANGUAGE TypeFamilies #-}
-- | Module that contains high-level checking for an entire directory
-- | Module that contains high-level checking for an entire directory
module
CheckDir
(
recursiveCheckDir
,
DirResult
(
..
),
resultIsFatal
)
where
module
CheckDir
(
recursiveCheckDir
,
DirResult
(
..
),
resultIsFatal
)
where
import
CheckMap
(
MapResult
(
mapresultProvides
),
import
CheckMap
(
MapResult
(
..
),
loadAndLintMap
)
loadAndLintMap
,
mapresultDepends
)
import
Control.Monad
(
void
)
import
Control.Monad
(
void
)
import
Control.Monad.Extra
(
mapMaybeM
)
import
Control.Monad.Extra
(
mapMaybeM
)
import
Data.Aeson
(
ToJSON
,
(
.=
))
import
Data.Aeson
(
ToJSON
,
(
.=
))
import
qualified
Data.Aeson
as
A
import
qualified
Data.Aeson
as
A
import
Data.Foldable
(
fold
)
import
Data.Foldable
(
fold
)
import
Data.Functor
((
<&>
))
import
Data.Functor
((
<&>
))
import
Data.Map
(
Map
)
import
Data.Map
(
Map
,
elems
,
keys
)
import
qualified
Data.Map
as
M
import
qualified
Data.Map
as
M
import
Data.Map.Strict
(
mapKeys
,
(
\\
))
import
Data.Map.Strict
(
mapKeys
,
(
\\
))
import
Data.Maybe
(
mapMaybe
)
import
Data.Maybe
(
mapMaybe
)
import
Data.Text
(
Text
)
import
Data.Text
(
Text
)
import
qualified
Data.Text
as
T
import
qualified
Data.Text
as
T
import
GHC.Generics
(
Generic
)
import
GHC.Generics
(
Generic
)
import
LintConfig
(
LintConfig
'
)
import
LintConfig
(
LintConfig
'
,
configMaxLintLevel
)
import
Paths
(
normalise
,
normaliseWithFrag
)
import
Paths
(
normalise
,
normaliseWithFrag
)
import
System.Directory.Extra
(
doesFileExist
)
import
System.Directory.Extra
(
doesFileExist
)
import
System.FilePath
(
splitPath
,
(
</>
))
import
System.FilePath
(
splitPath
,
(
</>
))
import
qualified
System.FilePath
as
FP
import
qualified
System.FilePath
as
FP
import
System.FilePath.Posix
(
takeDirectory
)
import
System.FilePath.Posix
(
takeDirectory
)
import
Types
(
Dep
(
Local
,
LocalMap
),
Level
)
import
Types
(
Dep
(
Local
,
LocalMap
),
Level
(
..
),
hintLevel
)
import
Util
(
PrettyPrint
(
prettyprint
))
import
Util
(
PrettyPrint
(
prettyprint
))
...
@@ -59,9 +60,18 @@ data MissingDep = MissingDep
...
@@ -59,9 +60,18 @@ data MissingDep = MissingDep
newtype
MissingAsset
=
MissingAsset
MissingDep
newtype
MissingAsset
=
MissingAsset
MissingDep
resultIsFatal
::
DirResult
->
Bool
resultIsFatal
::
LintConfig'
->
DirResult
->
Bool
resultIsFatal
res
=
resultIsFatal
config
res
=
not
$
null
(
dirresultMissingAssets
res
)
(
not
(
null
(
dirresultMissingAssets
res
)))
&&
(
configMaxLintLevel
config
)
<=
maxObservedLevel
where
maxObservedLevel
=
maximum
.
map
hintLevel
.
concatMap
keys
.
map
mapresultLayer
.
elems
.
dirresultMaps
$
res
...
...
This diff is collapsed.
Click to expand it.
lib/LintConfig.hs
+
1
−
1
View file @
a572b9e1
...
@@ -34,7 +34,7 @@ data LintConfig f = LintConfig
...
@@ -34,7 +34,7 @@ data LintConfig f = LintConfig
-- ^ Link to Script that should be injected
-- ^ Link to Script that should be injected
,
configAssemblyTag
::
HKD
f
Text
,
configAssemblyTag
::
HKD
f
Text
-- ^ Assembly name (used for jitsiRoomAdminTag)
-- ^ Assembly name (used for jitsiRoomAdminTag)
,
configMax
Warn
Level
::
HKD
f
Level
,
configMax
Lint
Level
::
HKD
f
Level
-- ^ Maximum warn level allowed before the lint fails
-- ^ Maximum warn level allowed before the lint fails
,
configDontCopyAssets
::
HKD
f
Bool
,
configDontCopyAssets
::
HKD
f
Bool
-- ^ Don't copy map assets (mostly useful for development)
-- ^ Don't copy map assets (mostly useful for development)
...
...
This diff is collapsed.
Click to expand it.
lib/WriteRepo.hs
+
6
−
5
View file @
a572b9e1
...
@@ -5,9 +5,8 @@
...
@@ -5,9 +5,8 @@
-- | Module for writing an already linted map Repository back out again.
-- | Module for writing an already linted map Repository back out again.
module
WriteRepo
where
module
WriteRepo
where
import
CheckDir
(
DirResult
(
dirresultMaps
),
import
CheckDir
(
DirResult
(
..
),
resultIsFatal
)
resultIsFatal
)
import
CheckMap
(
MapResult
(
..
))
import
CheckMap
(
MapResult
(
mapresultAdjusted
,
mapresultDepends
))
import
Control.Monad
(
forM_
,
unless
)
import
Control.Monad
(
forM_
,
unless
)
import
Data.Aeson
(
encodeFile
)
import
Data.Aeson
(
encodeFile
)
import
Data.Map.Strict
(
toList
)
import
Data.Map.Strict
(
toList
)
...
@@ -25,11 +24,13 @@ import System.FilePath.Posix ((</>))
...
@@ -25,11 +24,13 @@ import System.FilePath.Posix ((</>))
import
Types
(
Dep
(
Local
))
import
Types
(
Dep
(
Local
))
writeAdjustedRepository
::
LintConfig'
->
FilePath
->
FilePath
->
DirResult
->
IO
ExitCode
writeAdjustedRepository
::
LintConfig'
->
FilePath
->
FilePath
->
DirResult
->
IO
ExitCode
writeAdjustedRepository
config
inPath
outPath
result
writeAdjustedRepository
config
inPath
outPath
result
|
resultIsFatal
result
&&
not
(
configDontCopyAssets
config
)
=
do
|
resultIsFatal
config
result
=
-- putStrLn "FATAL: Repository has missing assets; cannot write to outPath"
pure
(
ExitFailure
1
)
pure
(
ExitFailure
1
)
|
not
(
configDontCopyAssets
config
)
=
pure
(
ExitSuccess
)
|
otherwise
=
do
|
otherwise
=
do
createDirectoryIfMissing
True
outPath
createDirectoryIfMissing
True
outPath
...
...
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