clerk/internal/linter/rule_missing_payee.go (view raw)
| 1 | package linter |
| 2 | |
| 3 | import "olexsmir.xyz/clerk/journal/ast" |
| 4 | |
| 5 | // MissingPayee flags transactions with missing payee. |
| 6 | type MissingPayee struct{} |
| 7 | |
| 8 | func (MissingPayee) ID() RuleID { return "missing-payee" } |
| 9 | func (MissingPayee) Severity() Severity { return SeverityWarning } |
| 10 | func (m *MissingPayee) CheckEntry(entry ast.Entry) []Find { |
| 11 | txn, ok := entry.(*ast.Transaction) |
| 12 | if !ok { |
| 13 | return nil |
| 14 | } |
| 15 | if txn.Payee == nil { |
| 16 | return []Find{{ |
| 17 | Code: m.ID(), |
| 18 | Severity: m.Severity(), |
| 19 | Message: "transaction has no payee", |
| 20 | Span: txn.Date.Span, |
| 21 | }} |
| 22 | } |
| 23 | return nil |
| 24 | } |