Crate rustledger_validate

Crate rustledger_validate 

Source
Expand description

Beancount validation rules.

This crate implements validation checks for beancount ledgers:

  • Account lifecycle (opened before use, not used after close)
  • Balance assertions
  • Transaction balancing
  • Currency constraints
  • Booking validation (lot matching, sufficient units)

§Error Codes

All error codes follow the spec in spec/validation.md:

CodeDescription
E1001Account not opened
E1002Account already open
E1003Account already closed
E1004Account close with non-zero balance
E1005Invalid account name
E2001Balance assertion failed
E2002Balance exceeds explicit tolerance
E2003Pad without subsequent balance
E2004Multiple pads for same balance
E3001Transaction does not balance
E3002Multiple missing amounts in transaction
E3003Transaction has no postings
E3004Transaction has single posting (warning)
E4001No matching lot for reduction
E4002Insufficient units in lot
E4003Ambiguous lot match
E4004Reduction would create negative inventory
E5001Currency not declared
E5002Currency not allowed in account
E6001Duplicate metadata key
E6002Invalid metadata value
E7001Unknown option
E7002Invalid option value
E7003Duplicate option
E8001Document file not found
E10001Date out of order (info)
E10002Entry dated in the future (warning)

Structs§

LedgerState
Ledger state for validation.
ValidationError
A validation error.
ValidationOptions
Validation options.

Enums§

ErrorCode
Validation error codes.
Severity
Severity level for validation messages.

Functions§

validate
Validate a stream of directives.
validate_with_options
Validate a stream of directives with custom options.