cln: hlint: Remove cons warnings.

This commit is contained in:
Stephen Morgan 2021-08-16 15:38:25 +10:00 committed by Simon Michael
parent 435fbf001e
commit 71032c637e
5 changed files with 28 additions and 35 deletions

View File

@ -21,7 +21,6 @@
- ignore: {name: "Use unless"}
- ignore: {name: "Use any"}
- ignore: {name: "Use /="}
- ignore: {name: "Use :"}
- ignore: {name: "Use =<<"}
- ignore: {name: "Use fmap"}
- ignore: {name: "Use curry"}

View File

@ -400,8 +400,7 @@ journalAccountTypeQuery atypes fallbackregex Journal{jdeclaredaccounttypes} =
concat $ mapMaybe (`M.lookup` jdeclaredaccounttypes) atypes
in case declaredacctsoftype of
[] -> Acct fallbackregex
as -> And $ [ Or acctnameRegexes ]
++ if null differentlyTypedRegexes then [] else [ Not $ Or differentlyTypedRegexes ]
as -> And $ Or acctnameRegexes : if null differentlyTypedRegexes then [] else [ Not $ Or differentlyTypedRegexes ]
where
-- XXX Query isn't able to match account type since that requires extra info from the journal.
-- So we do a hacky search by name instead.

View File

@ -576,11 +576,7 @@ defaultOutputFormat :: String
defaultOutputFormat = "txt"
outputFormats :: [String]
outputFormats =
[defaultOutputFormat] ++
["csv"
,"html"
]
outputFormats = [defaultOutputFormat, "csv", "html"]
-- | Get the output format from the --output-format option,
-- otherwise from a recognised file extension in the --output-file option,

View File

@ -119,18 +119,18 @@ close CliOpts{rawopts_=rawopts, reportspec_=rspec} j = do
closingtxn = nulltransaction{tdate=closingdate, tdescription=closingdesc, tpostings=closingps}
closingps =
concat [
[posting{paccount = a
,pamount = mixedAmount . precise $ negate b
-- after each commodity's last posting, assert 0 balance (#1035)
-- balance assertion amounts are unpriced (#824)
,pbalanceassertion =
if islast
then Just nullassertion{baamount=precise b{aquantity=0, aprice=Nothing}}
else Nothing
}
]
posting{paccount = a
,pamount = mixedAmount . precise $ negate b
-- after each commodity's last posting, assert 0 balance (#1035)
-- balance assertion amounts are unpriced (#824)
,pbalanceassertion =
if islast
then Just nullassertion{baamount=precise b{aquantity=0, aprice=Nothing}}
else Nothing
}
-- maybe an interleaved posting transferring this balance to equity
++ [posting{paccount=closingacct, pamount=mixedAmount $ precise b} | interleaved]
: [posting{paccount=closingacct, pamount=mixedAmount $ precise b} | interleaved]
| -- get the balances for each commodity and transaction price
(a,mb) <- acctbals
@ -149,15 +149,14 @@ close CliOpts{rawopts_=rawopts, reportspec_=rspec} j = do
openingtxn = nulltransaction{tdate=openingdate, tdescription=openingdesc, tpostings=openingps}
openingps =
concat [
[posting{paccount = a
,pamount = mixedAmount $ precise b
,pbalanceassertion =
case mcommoditysum of
Just s -> Just nullassertion{baamount=precise s{aprice=Nothing}}
Nothing -> Nothing
}
]
++ [posting{paccount=openingacct, pamount=mixedAmount . precise $ negate b} | interleaved]
posting{paccount = a
,pamount = mixedAmount $ precise b
,pbalanceassertion =
case mcommoditysum of
Just s -> Just nullassertion{baamount=precise s{aprice=Nothing}}
Nothing -> Nothing
}
: [posting{paccount=openingacct, pamount=mixedAmount . precise $ negate b} | interleaved]
| (a,mb) <- acctbals
, let bs = amounts $ normaliseMixedAmount mb

View File

@ -278,13 +278,13 @@ compoundBalanceReportAsHtml ropts cbr =
blankrow = tr_ $ td_ [colspanattr] $ toHtmlRaw ("&nbsp;"::String)
titlerows =
[tr_ $ th_ [colspanattr, leftattr] $ h2_ $ toHtml title]
++ [thRow $
"" : ["Commodity" | commodity_column_ ropts] ++
map (reportPeriodName (balanceaccum_ ropts) colspans) colspans
++ (if row_total_ ropts then ["Total"] else [])
++ (if average_ ropts then ["Average"] else [])
]
(tr_ $ th_ [colspanattr, leftattr] $ h2_ $ toHtml title)
: [thRow $
"" : ["Commodity" | commodity_column_ ropts] ++
map (reportPeriodName (balanceaccum_ ropts) colspans) colspans
++ (if row_total_ ropts then ["Total"] else [])
++ (if average_ ropts then ["Average"] else [])
]
thRow :: [T.Text] -> Html ()
thRow = tr_ . mconcat . map (th_ . toHtml)