hledger can check your data in various ways.
Here's another way to check for undeclared accounts, that works with older hledger versions, showing some diff tricks:
$ diff -U0 --label "Unused Accounts" --label "Undeclared Accounts" <(hledger accounts --declared) <(hledger accounts --used)
Save the output of a report, and later use
diff to compare the
output of the same report, revealing any changes.
$ hledger COMMAND > report.txt $ hledger COMMAND > report2.txt $ diff report.txt report2.txt
Or, periodically commit a report's output into your version control system, then use the VCS to detect any changes since the last commit.
$ hledger COMMAND > report.txt; git add report.txt; git commit -m 'report' report.txt $ hledger COMMAND > report.txt; git diff -- report.txt
Version control systems often support a "pre-commit hook", a script which is required to succeed before each commit. Eg:
#!/bin/bash set -e hledger check -s
If you use Emacs, you can configure flycheck to run your preferred checks when you edit a journal file. This integration is currently quite basic, but it still gives very useful real-time feedback. Setup tips:
- in Emacs, install the
flycheck-hledgerpackage and customise the
hledgerto the list
- customise the
Here are some checks we don't support, but could:
- accountsactive - for each account used, if there is posting with an
open:tag, it must have a corresponding posting with a
close:tag, and all other postings must be chronologically between (and if on the same date, textually between) open and close postings. ("Accounts are posted to only within their declared active period.")
- explicitamounts - all transaction amounts have been recorded explicitly