File tree Expand file tree Collapse file tree 4 files changed +9
-7
lines changed Expand file tree Collapse file tree 4 files changed +9
-7
lines changed Original file line number Diff line number Diff line change
1
+ {-# LANGUAGE CPP #-}
2
+
1
3
{-|
2
4
3
5
Helpers for the /security-advisories/ file system.
@@ -24,7 +26,10 @@ module Security.Advisories.Filesystem
24
26
, parseComponentIdentifier
25
27
) where
26
28
29
+ #if MIN_VERSION_base(4,18,0)
30
+ #else
27
31
import Control.Applicative (liftA2 )
32
+ #endif
28
33
import Data.Bifunctor (bimap )
29
34
import Data.Foldable (fold )
30
35
import Data.Semigroup (Max (Max , getMax ))
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ module Security.Advisories.Git
19
19
20
20
import Data.Char (isSpace )
21
21
import Data.List (dropWhileEnd )
22
+ import qualified Data.List.NonEmpty as NE
22
23
import Data.Time (UTCTime , zonedTimeToUTC )
23
24
import Data.Time.Format.ISO8601 (iso8601ParseM )
24
25
import System.Exit (ExitCode (ExitSuccess ))
@@ -110,10 +111,10 @@ getAdvisoryGitInfo path = do
110
111
" " -- standard input
111
112
let timestamps = filter (not . null ) $ lines stdout
112
113
case status of
113
- ExitSuccess | not ( null timestamps) ->
114
+ ExitSuccess | Just timestamps' <- NE. nonEmpty timestamps ->
114
115
pure $ AdvisoryGitInfo
115
- <$> parseTime (last timestamps) -- first commit is last line
116
- <*> parseTime (head timestamps) -- most recent commit is first line
116
+ <$> parseTime (NE. last timestamps' ) -- first commit is last line
117
+ <*> parseTime (NE. head timestamps' ) -- most recent commit is first line
117
118
_ ->
118
119
-- `null lines` should not happen, but if it does we treat it
119
120
-- the same as `ExitFailure`
Original file line number Diff line number Diff line change @@ -26,9 +26,6 @@ import Data.Foldable (toList)
26
26
import Data.Maybe (fromMaybe )
27
27
import Data.Monoid (First (.. ))
28
28
29
- import Data.Tuple (swap )
30
- import Control.Applicative ((<|>) )
31
-
32
29
import GHC.Generics (Generic )
33
30
34
31
import Data.Sequence (Seq ((:<|) ))
Original file line number Diff line number Diff line change 4
4
5
5
module Spec.FormatSpec (spec ) where
6
6
7
- import Data.Fixed (Fixed (MkFixed ))
8
7
import Data.Function (on )
9
8
import qualified Data.Map.Strict as Map
10
9
import Data.Text (Text )
You can’t perform that action at this time.
0 commit comments