Skip to content

Commit

Permalink
[chore] apply suggestions by @hasufell
Browse files Browse the repository at this point in the history
  • Loading branch information
MangoIV committed Mar 31, 2024
1 parent 9b6117c commit 6dec222
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions code/cabal-audit/src/Distribution/Audit.hs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import System.Exit (exitFailure)
import System.IO.Temp (withSystemTempDirectory)
import System.Process (callProcess)
import Validation (validation)
import System.IO (stderr, hPutStrLn)

data AuditException
= -- | parsing the advisory database failed
Expand Down Expand Up @@ -89,7 +90,7 @@ auditMain =
, header (formatWith [bold, blue] "Welcome to cabal audit")
]
`catch` \(SomeException ex) -> do
putStrLn $
hPutStrLn stderr $
unlines
[ formatWith [red, bold] "cabal-audit failed:"
, formatWith [red] $ displayException ex
Expand All @@ -116,7 +117,7 @@ buildAdvisories MkAuditConfig {advisoriesPathOrURL, verbosity} flags = do
`catch` \ex -> throwIO $ CabalException "elaborating the install-plan" ex

when (verbosity > Verbosity.normal) do
putStrLn (formatWith [blue] "Finished building the cabal install plan, looking for advisories...")
hPutStrLn stderr (formatWith [blue] "Finished building the cabal install plan, looking for advisories...")

advisories <- do
let k realPath =
Expand All @@ -125,8 +126,8 @@ buildAdvisories MkAuditConfig {advisoriesPathOrURL, verbosity} flags = do
case advisoriesPathOrURL of
Left fp -> k fp
Right url -> withSystemTempDirectory "cabal-audit" \tmp -> do
putStrLn $ formatWith [blue] $ "trying to clone " <> url
callProcess "git" ["clone", url, tmp]
hPutStrLn stderr $ formatWith [blue] $ "trying to clone " <> url
callProcess "git" ["clone","--depth", "1",url, tmp]
k tmp

pure $ matchAdvisoriesForPlan plan advisories
Expand Down Expand Up @@ -191,7 +192,7 @@ auditCommandParser =
[ long "file-path"
, short 'p'
, metavar "FILE_PATH"
, help "the path the the repository containing an advisories directory"
, help "the path to the repository containing an advisories directory"
]
<|> Right
<$> strOption do
Expand Down

0 comments on commit 6dec222

Please sign in to comment.