Skip to content

Commit c5780ad

Browse files
authored
Merge pull request #5728 from mpilgrem/fix5727
Fix #5727 Remove inconsistency in pretty formatting of `--coverage`
2 parents 9be49d0 + 3955d6a commit c5780ad

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

ChangeLog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ Bug fixes:
1717

1818
* Fix `stack clean --full`, so that the files to be deleted are not in use. See
1919
[#5714](https://github.com/commercialhaskell/stack/issues/5714)
20+
* Fix an inconsistency in the pretty formatting of the output of
21+
`stack build --coverage`
2022

2123
## v2.7.5
2224

src/Stack/Coverage.hs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ generateHpcReport pkgDir package tests = do
144144
Just includeNames -> "--include" : intersperse "--include" (map (\n -> n ++ ":") includeNames)
145145
Nothing -> []
146146
mreportPath <- generateHpcReportInternal tixSrc reportDir report extraArgs extraArgs
147-
forM_ mreportPath (displayReportPath report . pretty)
147+
forM_ mreportPath (displayReportPath "The" report . pretty)
148148

149149
generateHpcReportInternal :: HasEnvConfig env
150150
=> Path Abs File -> Path Abs Dir -> Text -> [String] -> [String]
@@ -273,7 +273,7 @@ generateHpcReportForTargets opts tixFiles targetNames = do
273273
then do
274274
prettyInfo $ "Opening" <+> pretty reportPath <+> "in the browser."
275275
void $ liftIO $ openBrowser (toFilePath reportPath)
276-
else displayReportPath report (pretty reportPath)
276+
else displayReportPath "The" report (pretty reportPath)
277277

278278
generateHpcUnifiedReport :: HasEnvConfig env => RIO env ()
279279
generateHpcUnifiedReport = do
@@ -297,7 +297,7 @@ generateHpcUnifiedReport = do
297297
else do
298298
let report = "unified report"
299299
mreportPath <- generateUnionReport report reportDir tixFiles
300-
forM_ mreportPath (displayReportPath report . pretty)
300+
forM_ mreportPath (displayReportPath "The" report . pretty)
301301

302302
generateUnionReport :: HasEnvConfig env
303303
=> Text -> Path Abs Dir -> [Path Abs File]
@@ -386,8 +386,8 @@ generateHpcMarkupIndex = do
386386
"</tbody></table>") <>
387387
"</body></html>"
388388
unless (null rows) $
389-
logInfo $ "\nAn index of the generated HTML coverage reports is available at " <>
390-
fromString (toFilePath outputFile)
389+
displayReportPath "\nAn" "index of the generated HTML coverage reports"
390+
(pretty outputFile)
391391

392392
generateHpcErrorReport :: MonadIO m => Path Abs Dir -> Utf8Builder -> m ()
393393
generateHpcErrorReport dir err = do
@@ -478,9 +478,10 @@ findPackageFieldForBuiltPackage pkgDir pkgId internalLibs field = do
478478
T.pack (toFilePath inplaceDir) <> ". Maybe try 'stack clean' on this package?"
479479

480480
displayReportPath :: (HasTerm env)
481-
=> Text -> StyleDoc -> RIO env ()
482-
displayReportPath report reportPath =
483-
prettyInfo $ "The" <+> fromString (T.unpack report) <+> "is available at" <+> reportPath
481+
=> StyleDoc -> Text -> StyleDoc -> RIO env ()
482+
displayReportPath prefix report reportPath =
483+
prettyInfo $ prefix <+> fromString (T.unpack report) <+>
484+
"is available at" <+> reportPath
484485

485486
findExtraTixFiles :: HasEnvConfig env => RIO env [Path Abs File]
486487
findExtraTixFiles = do

0 commit comments

Comments
 (0)