cln: hlint: Clean up == and elem related hlint warnings.
This commit is contained in:
parent
82872d261a
commit
e13239386f
@ -11,7 +11,6 @@
|
|||||||
- ignore: {name: "Use list literal"}
|
- ignore: {name: "Use list literal"}
|
||||||
- ignore: {name: "Move brackets to avoid $"}
|
- ignore: {name: "Move brackets to avoid $"}
|
||||||
- ignore: {name: "Redundant $"}
|
- ignore: {name: "Redundant $"}
|
||||||
- ignore: {name: "Use notElem"}
|
|
||||||
- ignore: {name: "Use <$>"}
|
- ignore: {name: "Use <$>"}
|
||||||
- ignore: {name: "Redundant bracket"}
|
- ignore: {name: "Redundant bracket"}
|
||||||
- ignore: {name: "Avoid reverse"}
|
- ignore: {name: "Avoid reverse"}
|
||||||
@ -19,7 +18,6 @@
|
|||||||
- ignore: {name: "Use $>"}
|
- ignore: {name: "Use $>"}
|
||||||
- ignore: {name: "Use unless"}
|
- ignore: {name: "Use unless"}
|
||||||
- ignore: {name: "Use any"}
|
- ignore: {name: "Use any"}
|
||||||
- ignore: {name: "Use /="}
|
|
||||||
- ignore: {name: "Use =<<"}
|
- ignore: {name: "Use =<<"}
|
||||||
- ignore: {name: "Use fmap"}
|
- ignore: {name: "Use fmap"}
|
||||||
- ignore: {name: "Use <&>"}
|
- ignore: {name: "Use <&>"}
|
||||||
@ -43,7 +41,6 @@
|
|||||||
- ignore: {name: "Use replicate"}
|
- ignore: {name: "Use replicate"}
|
||||||
- ignore: {name: "Use void"}
|
- ignore: {name: "Use void"}
|
||||||
- ignore: {name: "Use elemIndex"}
|
- ignore: {name: "Use elemIndex"}
|
||||||
- ignore: {name: "Use =="}
|
|
||||||
- ignore: {name: "Use lambda-case"}
|
- ignore: {name: "Use lambda-case"}
|
||||||
- ignore: {name: "Replace case with fromMaybe"}
|
- ignore: {name: "Replace case with fromMaybe"}
|
||||||
|
|
||||||
|
|||||||
2
Shake.hs
2
Shake.hs
@ -681,7 +681,7 @@ main = do
|
|||||||
maybePrependPackage s = maybe s (++("-"++s)) mpkg
|
maybePrependPackage s = maybe s (++("-"++s)) mpkg
|
||||||
toTag = maybePrependPackage
|
toTag = maybePrependPackage
|
||||||
isOldRelease rev = isReleaseVersion rev && toTag rev `elem` tags
|
isOldRelease rev = isReleaseVersion rev && toTag rev `elem` tags
|
||||||
isNewRelease rev = isReleaseVersion rev && not (toTag rev `elem` tags)
|
isNewRelease rev = isReleaseVersion rev && toTag rev `notElem` tags
|
||||||
-- git revision corresponding to the changelog version:
|
-- git revision corresponding to the changelog version:
|
||||||
-- a hash (a3f19c15), package release tag (hledger-ui-1.20), or project release tag (1.20)
|
-- a hash (a3f19c15), package release tag (hledger-ui-1.20), or project release tag (1.20)
|
||||||
lastrev
|
lastrev
|
||||||
|
|||||||
@ -130,7 +130,7 @@ postingSetDate md p@Posting{ptags,pcomment} = p{pdate=md, ptags=ptags'', pcommen
|
|||||||
Nothing -> ptags'
|
Nothing -> ptags'
|
||||||
Just d -> ptags'++[("date", T.pack $ show d)]
|
Just d -> ptags'++[("date", T.pack $ show d)]
|
||||||
where
|
where
|
||||||
ptags' = filter (not.(=="date").fst) ptags
|
ptags' = filter ((/="date").fst) ptags
|
||||||
|
|
||||||
pcomment' = case md of
|
pcomment' = case md of
|
||||||
Nothing -> pcomment
|
Nothing -> pcomment
|
||||||
|
|||||||
@ -409,7 +409,7 @@ journalAccountTypeQuery atypes fallbackregex Journal{jdeclaredaccounttypes} =
|
|||||||
|
|
||||||
differentlytypedsubs = concat
|
differentlytypedsubs = concat
|
||||||
[subs | (t,bs) <- M.toList jdeclaredaccounttypes
|
[subs | (t,bs) <- M.toList jdeclaredaccounttypes
|
||||||
, not $ t `elem` atypes
|
, t `notElem` atypes
|
||||||
, let subs = [b | b <- bs, any (`isAccountNamePrefixOf` b) as]
|
, let subs = [b | b <- bs, any (`isAccountNamePrefixOf` b) as]
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
@ -342,7 +342,7 @@ pricesShortestPath start end edges =
|
|||||||
| e <- nextedges
|
| e <- nextedges
|
||||||
, let path' = dbgpath "trying" $ path ++ [e] -- PERF prepend ?
|
, let path' = dbgpath "trying" $ path ++ [e] -- PERF prepend ?
|
||||||
, let pathnodes' = mpto e : pathnodes
|
, let pathnodes' = mpto e : pathnodes
|
||||||
, let remainingedges' = [r | r <- remainingedges, not $ mpto r `elem` pathnodes' ]
|
, let remainingedges' = [r | r <- remainingedges, mpto r `notElem` pathnodes' ]
|
||||||
]
|
]
|
||||||
|
|
||||||
-- debug helpers
|
-- debug helpers
|
||||||
|
|||||||
@ -202,7 +202,7 @@ useColorOnHandle h = unsafePerformIO $ do
|
|||||||
let coloroption = colorOption
|
let coloroption = colorOption
|
||||||
return $ and [
|
return $ and [
|
||||||
not no_color
|
not no_color
|
||||||
,not $ coloroption `elem` ["never","no"]
|
,coloroption `notElem` ["never","no"]
|
||||||
,coloroption `elem` ["always","yes"] || supports_color
|
,coloroption `elem` ["always","yes"] || supports_color
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -240,7 +240,7 @@ colorOption =
|
|||||||
-- {-# OPTIONS_GHC -fno-cse #-}
|
-- {-# OPTIONS_GHC -fno-cse #-}
|
||||||
-- {-# NOINLINE hasOutputFile #-}
|
-- {-# NOINLINE hasOutputFile #-}
|
||||||
hasOutputFile :: Bool
|
hasOutputFile :: Bool
|
||||||
hasOutputFile = not $ outputFileOption `elem` [Nothing, Just "-"]
|
hasOutputFile = outputFileOption `notElem` [Nothing, Just "-"]
|
||||||
|
|
||||||
-- Keep synced with output-file flag definition in hledger:CliOptions.
|
-- Keep synced with output-file flag definition in hledger:CliOptions.
|
||||||
-- Avoid using dbg*, pshow etc. in this function (infinite loop).
|
-- Avoid using dbg*, pshow etc. in this function (infinite loop).
|
||||||
|
|||||||
@ -265,7 +265,7 @@ asHandle ui0@UIState{
|
|||||||
VtyEvent (EvKey (KChar 'q') []) -> halt ui
|
VtyEvent (EvKey (KChar 'q') []) -> halt ui
|
||||||
-- EvKey (KChar 'l') [MCtrl] -> do
|
-- EvKey (KChar 'l') [MCtrl] -> do
|
||||||
VtyEvent (EvKey KEsc []) -> continue $ resetScreens d ui
|
VtyEvent (EvKey KEsc []) -> continue $ resetScreens d ui
|
||||||
VtyEvent (EvKey (KChar c) []) | c `elem` ['?'] -> continue $ setMode Help ui
|
VtyEvent (EvKey (KChar c) []) | c == '?' -> continue $ setMode Help ui
|
||||||
-- XXX AppEvents currently handled only in Normal mode
|
-- XXX AppEvents currently handled only in Normal mode
|
||||||
-- XXX be sure we don't leave unconsumed events piling up
|
-- XXX be sure we don't leave unconsumed events piling up
|
||||||
AppEvent (DateChange old _) | isStandardPeriod p && p `periodContainsDate` old ->
|
AppEvent (DateChange old _) | isStandardPeriod p && p `periodContainsDate` old ->
|
||||||
|
|||||||
@ -310,7 +310,7 @@ rsHandle ui@UIState{
|
|||||||
case ev of
|
case ev of
|
||||||
VtyEvent (EvKey (KChar 'q') []) -> halt ui
|
VtyEvent (EvKey (KChar 'q') []) -> halt ui
|
||||||
VtyEvent (EvKey KEsc []) -> continue $ resetScreens d ui
|
VtyEvent (EvKey KEsc []) -> continue $ resetScreens d ui
|
||||||
VtyEvent (EvKey (KChar c) []) | c `elem` ['?'] -> continue $ setMode Help ui
|
VtyEvent (EvKey (KChar c) []) | c == '?' -> continue $ setMode Help ui
|
||||||
AppEvent (DateChange old _) | isStandardPeriod p && p `periodContainsDate` old ->
|
AppEvent (DateChange old _) | isStandardPeriod p && p `periodContainsDate` old ->
|
||||||
continue $ regenerateScreens j d $ setReportPeriod (DayPeriod d) ui
|
continue $ regenerateScreens j d $ setReportPeriod (DayPeriod d) ui
|
||||||
where
|
where
|
||||||
|
|||||||
@ -154,7 +154,7 @@ tsHandle ui@UIState{aScreen=TransactionScreen{tsTransaction=(i,t), tsTransaction
|
|||||||
case ev of
|
case ev of
|
||||||
VtyEvent (EvKey (KChar 'q') []) -> halt ui
|
VtyEvent (EvKey (KChar 'q') []) -> halt ui
|
||||||
VtyEvent (EvKey KEsc []) -> continue $ resetScreens d ui
|
VtyEvent (EvKey KEsc []) -> continue $ resetScreens d ui
|
||||||
VtyEvent (EvKey (KChar c) []) | c `elem` ['?'] -> continue $ setMode Help ui
|
VtyEvent (EvKey (KChar c) []) | c == '?' -> continue $ setMode Help ui
|
||||||
VtyEvent (EvKey (KChar 'E') []) -> suspendAndResume $ void (runEditor pos f) >> uiReloadJournalIfChanged copts d j ui
|
VtyEvent (EvKey (KChar 'E') []) -> suspendAndResume $ void (runEditor pos f) >> uiReloadJournalIfChanged copts d j ui
|
||||||
where
|
where
|
||||||
(pos,f) = case tsourcepos t of
|
(pos,f) = case tsourcepos t of
|
||||||
|
|||||||
@ -88,7 +88,7 @@ checkUIOpts :: UIOpts -> UIOpts
|
|||||||
checkUIOpts opts =
|
checkUIOpts opts =
|
||||||
either usageError (const opts) $ do
|
either usageError (const opts) $ do
|
||||||
case maybestringopt "theme" $ rawopts_ $ cliopts_ opts of
|
case maybestringopt "theme" $ rawopts_ $ cliopts_ opts of
|
||||||
Just t | not $ elem t themeNames -> Left $ "invalid theme name: "++t
|
Just t | t `notElem` themeNames -> Left $ "invalid theme name: "++t
|
||||||
_ -> Right ()
|
_ -> Right ()
|
||||||
|
|
||||||
-- XXX some refactoring seems due
|
-- XXX some refactoring seems due
|
||||||
|
|||||||
@ -245,10 +245,7 @@ shouldShowSidebar = do
|
|||||||
msidebarcookie <- lookup "showsidebar" . reqCookies <$> getRequest
|
msidebarcookie <- lookup "showsidebar" . reqCookies <$> getRequest
|
||||||
return $
|
return $
|
||||||
let disablevalues = ["","0"]
|
let disablevalues = ["","0"]
|
||||||
in maybe
|
in maybe True (`notElem` disablevalues) $ msidebarparam <|> msidebarcookie
|
||||||
(not $ msidebarcookie `elem` map Just disablevalues)
|
|
||||||
(not . (`elem` disablevalues))
|
|
||||||
msidebarparam
|
|
||||||
|
|
||||||
-- | Update our copy of the journal if the file changed. If there is an
|
-- | Update our copy of the journal if the file changed. If there is an
|
||||||
-- error while reloading, keep the old one and return the error, and set a
|
-- error while reloading, keep the old one and return the error, and set a
|
||||||
|
|||||||
@ -188,7 +188,7 @@ main = do
|
|||||||
|
|
||||||
-- addon commands
|
-- addon commands
|
||||||
| isExternalCommand = do
|
| isExternalCommand = do
|
||||||
let externalargs = argsbeforecmd ++ filter (not.(=="--")) argsaftercmd
|
let externalargs = argsbeforecmd ++ filter (/="--") argsaftercmd
|
||||||
let shellcmd = printf "%s-%s %s" progname cmd (unwords' externalargs) :: String
|
let shellcmd = printf "%s-%s %s" progname cmd (unwords' externalargs) :: String
|
||||||
dbgIO "external command selected" cmd
|
dbgIO "external command selected" cmd
|
||||||
dbgIO "external command arguments" (map quoteIfNeeded externalargs)
|
dbgIO "external command arguments" (map quoteIfNeeded externalargs)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user