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
e2767b3b
Commit
e2767b3b
authored
3 years ago
by
stuebinm
Browse files
Options
Downloads
Patches
Plain Diff
add zoom function for LintWriter
parent
2ffe0630
No related branches found
No related tags found
1 merge request
!1
Extended scripts support
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/LintWriter.hs
+19
-2
19 additions, 2 deletions
lib/LintWriter.hs
with
19 additions
and
2 deletions
lib/LintWriter.hs
+
19
−
2
View file @
e2767b3b
...
@@ -16,6 +16,7 @@ module LintWriter
...
@@ -16,6 +16,7 @@ module LintWriter
,
LintWriter
'
,
LintWriter
'
,
LintResult
,
LintResult
,
invertLintResult
,
invertLintResult
,
zoom
-- * working with lint results
-- * working with lint results
,
resultToDeps
,
resultToDeps
,
resultToOffers
,
resultToOffers
...
@@ -43,9 +44,9 @@ module LintWriter
...
@@ -43,9 +44,9 @@ module LintWriter
import
Data.Text
(
Text
)
import
Data.Text
(
Text
)
import
Badges
(
Badge
)
import
Badges
(
Badge
)
import
Control.Monad.State
(
StateT
,
modify
)
import
Control.Monad.State
(
StateT
,
modify
,
MonadState
(
put
)
)
import
Control.Monad.Trans.Reader
(
Reader
,
asks
,
runReader
)
import
Control.Monad.Trans.Reader
(
Reader
,
asks
,
runReader
)
import
Control.Monad.Trans.State
(
runStateT
)
import
Control.Monad.Trans.State
(
runStateT
,
get
)
import
Control.Monad.Writer.Lazy
(
lift
)
import
Control.Monad.Writer.Lazy
(
lift
)
import
Data.Bifunctor
(
Bifunctor
(
second
))
import
Data.Bifunctor
(
Bifunctor
(
second
))
import
Data.Map
(
Map
,
fromListWith
)
import
Data.Map
(
Map
,
fromListWith
)
...
@@ -86,6 +87,22 @@ runLintWriter config context depth linter = LinterState
...
@@ -86,6 +87,22 @@ runLintWriter config context depth linter = LinterState
$
(
depth
,
context
,
config
)
$
(
depth
,
context
,
config
)
where
runstate
=
runStateT
linter
(
LinterState
(
[]
,
context
))
where
runstate
=
runStateT
linter
(
LinterState
(
[]
,
context
))
zoom
::
(
a
->
b
)
->
(
b
->
a
)
->
LintWriter
a
->
LintWriter'
b
a
zoom
embed
extract
operation
=
do
config
<-
lintConfig
id
depth
<-
askFileDepth
let
result
ctxt
=
runLintWriter
config
ctxt
depth
operation
LinterState
(
lints
,
a
)
<-
get
let
res
=
result
.
extract
$
a
put
$
LinterState
.
(
resultToLints
res
<>
lints
,)
.
embed
.
resultToAdjusted
$
res
pure
$
resultToAdjusted
res
-- | "invert" a linter's result, grouping lints by their messages
-- | "invert" a linter's result, grouping lints by their messages
invertLintResult
::
HasName
ctxt
=>
LintResult
ctxt
->
Map
Hint
[
ctxt
]
invertLintResult
::
HasName
ctxt
=>
LintResult
ctxt
->
Map
Hint
[
ctxt
]
invertLintResult
(
LinterState
(
lints
,
ctxt
))
=
invertLintResult
(
LinterState
(
lints
,
ctxt
))
=
...
...
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