hledger-lib
Safe HaskellNone
LanguageGHC2021

Hledger.Data.JournalChecks.Assert

Description

Checking assert directives: standing rules declared in the journal, each a query which must match no rows, or some rows, of the equivalent balance report (over the whole journal, or in every period of a period expression). See the hledger manual's "assert directive" section, and doc/SPEC-assert.md.

The rows are calculated here by direct accumulation over the journal's postings, replicating what hledger bal -E QUERY would show, rather than by running the balance report, which would make journal reading depend on the reports code.

Synopsis

Documentation

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.