mirror of
https://github.com/simonmichael/hledger.git
synced 2024-12-25 19:31:44 +03:00
ref: move journal checking/pretty errors down further, to Hledger.Data
now at Hledger.Data.JournalChecks*, Hledger.Data.Errors
This commit is contained in:
parent
307f723b0a
commit
a9779b2377
@ -14,7 +14,9 @@ module Hledger.Data (
|
||||
module Hledger.Data.Amount,
|
||||
module Hledger.Data.Balancing,
|
||||
module Hledger.Data.Dates,
|
||||
module Hledger.Data.Errors,
|
||||
module Hledger.Data.Journal,
|
||||
module Hledger.Data.JournalChecks,
|
||||
module Hledger.Data.Json,
|
||||
module Hledger.Data.Ledger,
|
||||
module Hledger.Data.Period,
|
||||
@ -37,7 +39,9 @@ import Hledger.Data.AccountName
|
||||
import Hledger.Data.Amount
|
||||
import Hledger.Data.Balancing
|
||||
import Hledger.Data.Dates
|
||||
import Hledger.Data.Errors
|
||||
import Hledger.Data.Journal
|
||||
import Hledger.Data.JournalChecks
|
||||
import Hledger.Data.Json
|
||||
import Hledger.Data.Ledger
|
||||
import Hledger.Data.Period
|
||||
|
@ -4,7 +4,7 @@ Helpers for making error messages.
|
||||
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
|
||||
module Hledger.Read.Error (
|
||||
module Hledger.Data.Errors (
|
||||
makeTransactionErrorExcerpt,
|
||||
makePostingErrorExcerpt,
|
||||
transactionFindPostingIndex,
|
||||
@ -16,7 +16,8 @@ import Data.List (find)
|
||||
import Data.Text (Text)
|
||||
import qualified Data.Text as T
|
||||
|
||||
import Hledger.Data
|
||||
import Hledger.Data.Transaction (showTransaction)
|
||||
import Hledger.Data.Types
|
||||
import Hledger.Utils
|
||||
|
||||
-- | Given a problem transaction and a function calculating the best
|
@ -7,12 +7,12 @@ others can be called only via the check command.
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE NamedFieldPuns #-}
|
||||
|
||||
module Hledger.Read.Checks (
|
||||
module Hledger.Data.JournalChecks (
|
||||
journalCheckAccounts,
|
||||
journalCheckCommodities,
|
||||
journalCheckPayees,
|
||||
module Hledger.Read.Checks.Ordereddates,
|
||||
module Hledger.Read.Checks.Uniqueleafnames,
|
||||
module Hledger.Data.JournalChecks.Ordereddates,
|
||||
module Hledger.Data.JournalChecks.Uniqueleafnames,
|
||||
)
|
||||
where
|
||||
|
||||
@ -24,10 +24,14 @@ import qualified Data.Text as T
|
||||
import Safe (atMay)
|
||||
import Text.Printf (printf)
|
||||
|
||||
import Hledger.Data
|
||||
import Hledger.Read.Checks.Ordereddates
|
||||
import Hledger.Read.Checks.Uniqueleafnames
|
||||
import Hledger.Read.Error
|
||||
import Hledger.Data.Errors
|
||||
import Hledger.Data.Journal
|
||||
import Hledger.Data.JournalChecks.Ordereddates
|
||||
import Hledger.Data.JournalChecks.Uniqueleafnames
|
||||
import Hledger.Data.Posting (isVirtual)
|
||||
import Hledger.Data.Types
|
||||
import Hledger.Data.Amount (amountIsZero, amountsRaw, missingamt)
|
||||
import Hledger.Data.Transaction (transactionPayee, showTransactionLineFirstPart)
|
||||
|
||||
-- | Check that all the journal's postings are to accounts with
|
||||
-- account directives, returning an error message otherwise.
|
@ -1,4 +1,4 @@
|
||||
module Hledger.Read.Checks.Ordereddates (
|
||||
module Hledger.Data.JournalChecks.Ordereddates (
|
||||
journalCheckOrdereddates
|
||||
)
|
||||
where
|
||||
@ -8,8 +8,9 @@ import Data.List (groupBy)
|
||||
import Text.Printf (printf)
|
||||
import Data.Maybe (fromMaybe)
|
||||
|
||||
import Hledger.Data
|
||||
import Hledger.Read.Error
|
||||
import Hledger.Data.Errors (makeTransactionErrorExcerpt)
|
||||
import Hledger.Data.Transaction (transactionFile, transactionDateOrDate2)
|
||||
import Hledger.Data.Types
|
||||
|
||||
journalCheckOrdereddates :: WhichDate -> Journal -> Either String ()
|
||||
journalCheckOrdereddates whichdate j = do
|
@ -1,7 +1,7 @@
|
||||
{-# LANGUAGE NamedFieldPuns #-}
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
|
||||
module Hledger.Read.Checks.Uniqueleafnames (
|
||||
module Hledger.Data.JournalChecks.Uniqueleafnames (
|
||||
journalCheckUniqueleafnames
|
||||
)
|
||||
where
|
||||
@ -13,8 +13,11 @@ import qualified Data.Text as T
|
||||
import Text.Printf (printf)
|
||||
import Data.Maybe (fromMaybe)
|
||||
|
||||
import Hledger.Data
|
||||
import Hledger.Read.Error
|
||||
import Hledger.Data.AccountName (accountLeafName)
|
||||
import Hledger.Data.Errors (makePostingErrorExcerpt)
|
||||
import Hledger.Data.Journal (journalPostings, journalAccountNamesUsed)
|
||||
import Hledger.Data.Posting (isVirtual)
|
||||
import Hledger.Data.Types
|
||||
|
||||
-- | Check that all the journal's postings are to accounts with a unique leaf name.
|
||||
-- Otherwise, return an error message for the first offending posting.
|
@ -42,7 +42,6 @@ module Hledger.Read (
|
||||
findReader,
|
||||
splitReaderPrefix,
|
||||
runJournalParser,
|
||||
module Hledger.Read.Checks,
|
||||
module Hledger.Read.Common,
|
||||
module Hledger.Read.InputOptions,
|
||||
|
||||
@ -76,7 +75,6 @@ import System.IO (hPutStr, stderr)
|
||||
|
||||
import Hledger.Data.Dates (getCurrentDay, parsedateM, showDate)
|
||||
import Hledger.Data.Types
|
||||
import Hledger.Read.Checks
|
||||
import Hledger.Read.Common
|
||||
import Hledger.Read.InputOptions
|
||||
import Hledger.Read.JournalReader as JournalReader
|
||||
|
@ -148,7 +148,6 @@ import Hledger.Query (Query(..), filterQuery, parseQueryTerm, queryEndDate, quer
|
||||
import Hledger.Reports.ReportOptions (ReportOpts(..), queryFromFlags, rawOptsToReportOpts)
|
||||
import Hledger.Utils
|
||||
import Hledger.Read.InputOptions
|
||||
import Hledger.Read.Checks (journalCheckAccounts, journalCheckCommodities)
|
||||
|
||||
--- ** doctest setup
|
||||
-- $setup
|
||||
|
@ -47,8 +47,11 @@ library
|
||||
Hledger.Data.Amount
|
||||
Hledger.Data.Balancing
|
||||
Hledger.Data.Dates
|
||||
Hledger.Read.InputOptions
|
||||
Hledger.Data.Errors
|
||||
Hledger.Data.Journal
|
||||
Hledger.Data.JournalChecks
|
||||
Hledger.Data.JournalChecks.Ordereddates
|
||||
Hledger.Data.JournalChecks.Uniqueleafnames
|
||||
Hledger.Data.Json
|
||||
Hledger.Data.Ledger
|
||||
Hledger.Data.Period
|
||||
@ -63,11 +66,9 @@ library
|
||||
Hledger.Data.Valuation
|
||||
Hledger.Query
|
||||
Hledger.Read
|
||||
Hledger.Read.Checks
|
||||
Hledger.Read.Checks.Ordereddates
|
||||
Hledger.Read.Checks.Uniqueleafnames
|
||||
Hledger.Read.Common
|
||||
Hledger.Read.CsvReader
|
||||
Hledger.Read.InputOptions
|
||||
Hledger.Read.JournalReader
|
||||
Hledger.Read.TimedotReader
|
||||
Hledger.Read.TimeclockReader
|
||||
@ -89,7 +90,6 @@ library
|
||||
Hledger.Utils.Text
|
||||
Text.Tabular.AsciiWide
|
||||
other-modules:
|
||||
Hledger.Read.Error
|
||||
Text.Megaparsec.Custom
|
||||
Text.WideString
|
||||
Paths_hledger_lib
|
||||
|
@ -100,8 +100,11 @@ library:
|
||||
- Hledger.Data.Amount
|
||||
- Hledger.Data.Balancing
|
||||
- Hledger.Data.Dates
|
||||
- Hledger.Read.InputOptions
|
||||
- Hledger.Data.Errors
|
||||
- Hledger.Data.Journal
|
||||
- Hledger.Data.JournalChecks
|
||||
- Hledger.Data.JournalChecks.Ordereddates
|
||||
- Hledger.Data.JournalChecks.Uniqueleafnames
|
||||
- Hledger.Data.Json
|
||||
- Hledger.Data.Ledger
|
||||
- Hledger.Data.Period
|
||||
@ -116,11 +119,9 @@ library:
|
||||
- Hledger.Data.Valuation
|
||||
- Hledger.Query
|
||||
- Hledger.Read
|
||||
- Hledger.Read.Checks
|
||||
- Hledger.Read.Checks.Ordereddates
|
||||
- Hledger.Read.Checks.Uniqueleafnames
|
||||
- Hledger.Read.Common
|
||||
- Hledger.Read.CsvReader
|
||||
- Hledger.Read.InputOptions
|
||||
- Hledger.Read.JournalReader
|
||||
# - Hledger.Read.LedgerReader
|
||||
- Hledger.Read.TimedotReader
|
||||
|
Loading…
Reference in New Issue
Block a user