| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Hledger.Data.JournalChecks
Description
Various additional validation checks that can be performed on a Journal. Some are called as part of reading a file in strict mode, others can be called only via the check command.
Synopsis
- journalStrictChecks :: Journal -> Either String ()
- journalCheckAsserts :: Day -> Journal -> Either String ()
- journalCheckAccounts :: Journal -> Either String ()
- journalCheckBalanceAssertions :: Journal -> Either String ()
- journalCheckCommodities :: Journal -> Either String ()
- journalUndeclaredCommodities :: Journal -> [CommoditySymbol]
- journalCheckLots :: Journal -> Either String ()
- journalCheckPayees :: Journal -> Either String ()
- journalCheckPairedConversionPostings :: Journal -> Either String ()
- journalCheckRecentAssertions :: Journal -> Either String ()
- journalCheckTags :: Journal -> Either String ()
- module Hledger.Data.JournalChecks.Ordereddates
- module Hledger.Data.JournalChecks.Uniqueleafnames
Documentation
journalStrictChecks :: Journal -> Either String () Source #
Run the extra -s/--strict checks on a journal, in order of priority, returning the first error message if any of them fail.
journalCheckAsserts :: Day -> Journal -> Either String () Source #
Check the rules of all this journal's assert directives, in parse order, returning an error message for the first failure. The day is today's date, for resolving relative dates in queries.
journalCheckAccounts :: Journal -> Either String () Source #
Check that all the journal's postings are to accounts with account directives, returning an error message otherwise. Postings which hledger generated, to an account it chose, are exempt.
journalCheckBalanceAssertions :: Journal -> Either String () Source #
Check all balance assertions in the journal and return an error message if any of them fail. (Technically, this also tries to balance the journal and can return balancing failure errors; ensure the journal is already balanced (with journalBalanceTransactions) to avoid this.)
journalCheckCommodities :: Journal -> Either String () Source #
Check that all the commodities used in this journal's postings and P directives have been declared by commodity directives, returning an error message otherwise.
journalUndeclaredCommodities :: Journal -> [CommoditySymbol] Source #
The commodities referenced by this journal's postings and P directives that
have not been declared by a commodity directive, nor as an alias: of one.
These are exactly the commodities that make journalCheckCommodities (hledger
check commodities, and -s) fail. The synthetic 1:1 price directives inferred
from alias: tags contribute only aliases, so they never appear here.
journalCheckLots :: Journal -> Either String () Source #
Check all lot tracking calculations. Validation runs during journalFinalise
(unless --ignore-lots/-I is in effect), so any valid Journal reaching this point
has already passed the checks. This stub exists so hledger check lots remains
a valid command, and also re-enables the validation when -I was passed.
journalCheckPayees :: Journal -> Either String () Source #
Check that all the journal's transactions have payees declared with payee directives, returning an error message otherwise.
journalCheckPairedConversionPostings :: Journal -> Either String () Source #
In each tranaction, check that any conversion postings occur in adjacent pairs.
journalCheckRecentAssertions :: Journal -> Either String () Source #
Check that accounts with balance assertions have no posting more than maxlag days after their latest balance assertion.
journalCheckTags :: Journal -> Either String () Source #
Check that all the journal's tags (on accounts, commodities, transactions, postings..) have been declared with tag directives, returning an error message otherwise.