fix:check:tags: add date and date2 to the implicitly-declared special tags

And add tests/comments.
This commit is contained in:
Simon Michael 2024-02-17 12:43:48 -10:00
parent a964fd25c0
commit baca5f8b54
2 changed files with 55 additions and 15 deletions

View File

@ -198,22 +198,23 @@ journalCheckTags j = do
])
-- | Tag names which have special significance to hledger.
-- Keep synced with check-tags.test and hledger manual > Special tags.
builtinTags = [
"type" -- declares an account's type
,"t" -- declares the (user defined, single letter) type of a 15m unit of time parsed from timedot format
-- generated by close
,"balances" -- balance assertions transaction
,"retain" -- retain earnings transaction
,"start" -- opening balances, closing balances or balance assignment transaction
-- optionally generated on periodic transactions and auto postings
,"generated-transaction"
,"generated-posting"
,"modified"
-- used internally, not shown (but queryable)
,"_generated-transaction"
,"_generated-posting"
,"_modified"
,"_conversion-matched"
"date" -- overrides a posting's date
,"date2" -- overrides a posting's secondary date
,"type" -- declares an account's type
,"t" -- appears on postings generated by timedot letters
,"assert" -- appears on txns generated by close --assert
,"retain" -- appears on txns generated by close --retain
,"start" -- appears on txns generated by close --migrate/--close/--open/--assign
,"generated-transaction" -- with --verbose-tags, appears on generated periodic txns
,"generated-posting" -- with --verbose-tags, appears on generated auto postings
,"modified" -- with --verbose-tags, appears on txns which have had auto postings added
-- hidden tags used internally (and also queryable):
,"_generated-transaction" -- always exists on generated periodic txns
,"_generated-posting" -- always exists on generated auto postings
,"_modified" -- always exists on txns which have had auto postings added
,"_conversion-matched" -- exists on postings which have been matched with a nearby @/@@ cost notation
]
-- | In each tranaction, check that any conversion postings occur in adjacent pairs.

View File

@ -39,3 +39,42 @@ $ hledger -f - check tags
$ hledger -f - check tags
>2 /tag "ptag" has not been declared/
>=1
# ** 6. Built-in special tags are implicitly declared and won't make check tags fail.
# Keep synced with JournalChecks.builtinTags.
<
2024-01-01
; date:
; date2:
; type:
; t:
; assert:
; retain:
; start:
; generated-transaction:
; generated-posting:
; modified:
; _generated-transaction:
; _generated-posting:
; _modified:
; _conversion-matched:
$ hledger -f - check tags
# ** 7. Declaring the built-in special tags is harmless.
# Keep synced with JournalChecks.builtinTags.
<
tag date ; overrides a posting's date
tag date2 ; overrides a posting's secondary date
tag type ; declares an account's type
tag t ; generated by letters in timedot data (with the letter as tag value)
tag assert ; appears on txns generated by close --assert
tag retain ; appears on txns generated by close --retain
tag start ; appears on txns generated by close --migrate/--close/--open/--assign
tag generated-transaction ; with --verbose-tags, appears on generated periodic txns
tag generated-posting ; with --verbose-tags, appears on generated auto postings
tag modified ; with --verbose-tags, appears on txns which have had auto postings added
tag _generated-transaction ; always exists on generated periodic txns
tag _generated-posting ; always exists on generated auto postings
tag _modified ; always exists on txns which have had auto postings added
tag _conversion-matched ; exists on postings which have been matched with a nearby @/@@ cost notation
$ hledger -f - check tags