Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
student-projects
mapro-2017-ss
Commits
4fdd08f8
Commit
4fdd08f8
authored
Oct 13, 2017
by
Jonas Busse
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
HPC check with filename in coverage text body
parent
f23af87e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
7 deletions
+7
-7
src/CodeCoverage/Coverage.hs
src/CodeCoverage/Coverage.hs
+6
-6
src/DrHaskellLint.hs
src/DrHaskellLint.hs
+1
-1
No files found.
src/CodeCoverage/Coverage.hs
View file @
4fdd08f8
...
...
@@ -19,22 +19,22 @@ import Trace.Hpc.Util
import
Util.ModifyAst
-- | Main interface for running the coverage analysis
getConverageOutput
::
ModifiedModule
->
IO
[
Lint
]
getConverageOutput
m
=
do
getConverageOutput
::
ModifiedModule
->
String
->
IO
[
Lint
]
getConverageOutput
m
file
=
do
let
plainFile
=
printModified
m
-- get plain filecontent
-- compile, run and check inside a temp dir
mixtix
<-
withSystemTempDirectory
"drhaskell-lint."
$
runInTempDir
plainFile
case
mixtix
of
Just
(
mix
,
tix
)
->
return
$
parseMT
mix
tix
-- parse the check output
Just
(
mix
,
tix
)
->
return
$
parseMT
mix
tix
file
-- parse the check output
Nothing
->
return
[]
-- | Takes the Mix and the Tix information provided by the hpc impl
-- and converts it into coverage information
-- readable by the linter
-- Mix FilePath UTCTime Hash Int [MixEntry]
parseMT
::
Mix
->
Tix
->
[
Lint
]
parseMT
mix
@
(
Mix
_
_
hash1
_
mixpos
)
(
Tix
(
TixModule
_
hash2
_
tixpos
:
xs
))
parseMT
::
Mix
->
Tix
->
String
->
[
Lint
]
parseMT
mix
@
(
Mix
_
_
hash1
_
mixpos
)
(
Tix
(
TixModule
_
hash2
_
tixpos
:
xs
))
file
|
hash1
==
hash2
=
-- get the right mix tix combination
let
zipped
=
zip
tixpos
mixpos
filtered
=
filter
(
\
(
i
,
_
)
->
i
/=
0
)
zipped
...
...
@@ -44,7 +44,7 @@ parseMT mix@(Mix _ _ hash1 _ mixpos) (Tix (TixModule _ hash2 _ tixpos:xs))
|
otherwise
=
parseMT
mix
(
Tix
xs
)
-- next tix if hashed dont match
where
loopMixPos
::
[
MixEntry
]
->
[
Lint
]
-- build the lintoutput
loopMixPos
[]
=
[]
loopMixPos
((
pos
,
_
)
:
mes
)
=
Lint
"HPC"
loopMixPos
((
pos
,
_
)
:
mes
)
=
Lint
file
(
restorePosition
$
fromHpcPos
pos
)
Warning
"Covered"
:
loopMixPos
mes
...
...
src/DrHaskellLint.hs
View file @
4fdd08f8
...
...
@@ -66,7 +66,7 @@ runWithRepl hlintHints file format = do
(
True
,
Left
e
)
->
let
pos
=
posOfTIError
e
in
[
TypeError
pos
e
]
(
_
,
_
)
->
[]
coverage
<-
getConverageOutput
m2
-- run coverage
coverage
<-
getConverageOutput
m2
file
-- run coverage
output
<-
manipulatePathWithHostvarREV
(
lintErrorHlint
(
hlintHints
++
coverage
)
format
(
Just
lvl
)
(
errs
++
errs'
++
if
null
errs'
then
tiErrors
else
[]
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment