7 files changed,
14 insertions(+),
21 deletions(-)
Author:
Oleksandr Smirnov
olexsmir@gmail.com
Committed at:
2026-06-22 18:00:13 +0300
Authored at:
2026-06-20 15:17:46 +0300
Change ID:
yznrlslpsnkyqqsumkusqwxonntvunsv
Parent:
a45934c
M
internal/linter/rule_account_depth.go
··· 13 13 14 14 func (AccountDepthLimit) ID() RuleID { return "account-depth" } 15 15 func (AccountDepthLimit) Severity() Severity { return SeverityWarning } 16 -func (AccountDepthLimit) Description() string { return "account name depth exceeds limit" } 17 16 func (a *AccountDepthLimit) CheckEntry(entry ast.Entry) []Find { 18 17 var finds []Find 19 18 switch e := entry.(type) {
M
internal/linter/rule_empty_postings.go
··· 7 7 8 8 func (EmptyPostings) ID() RuleID { return "empty-postings" } 9 9 func (EmptyPostings) Severity() Severity { return SeverityError } 10 -func (EmptyPostings) Description() string { return "transaction has no postings" } 11 10 func (e *EmptyPostings) CheckEntry(entry ast.Entry) []Find { 12 11 txn, ok := entry.(*ast.Transaction) 13 12 if !ok { ··· 17 16 return []Find{{ 18 17 Code: e.ID(), 19 18 Severity: e.Severity(), 20 - Message: e.Description(), 19 + Message: "transaction has no postings", 21 20 Span: txn.Span, 22 21 }} 23 22 }
M
internal/linter/rule_missing_commodity.go
··· 5 5 // MissingCommodity flags amounts with a missing commodity. 6 6 type MissingCommodity struct{} 7 7 8 -func (MissingCommodity) ID() RuleID { return "missing-commodity" } 9 -func (MissingCommodity) Severity() Severity { return SeverityWarning } 10 -func (MissingCommodity) Description() string { return "amount missing commodity" } 8 +func (MissingCommodity) ID() RuleID { return "missing-commodity" } 9 +func (MissingCommodity) Severity() Severity { return SeverityWarning } 11 10 func (m *MissingCommodity) CheckEntry(entry ast.Entry) []Find { 12 11 txn, ok := entry.(*ast.Transaction) 13 12 if !ok || (txn.Postings != nil && len(txn.Postings) == 0) { ··· 23 22 finds = append(finds, Find{ 24 23 Code: m.ID(), 25 24 Severity: m.Severity(), 26 - Message: m.Description(), 25 + Message: "amount missing commodity", 27 26 Span: posting.Amount.Span, 28 27 }) 29 28 }
M
internal/linter/rule_missing_status.go
··· 5 5 // MissingStatus flags transactions with missing status. 6 6 type MissingStatus struct{} 7 7 8 -func (MissingStatus) ID() RuleID { return "missing-status" } 9 -func (MissingStatus) Severity() Severity { return SeverityWarning } 10 -func (MissingStatus) Description() string { return "transaction has no status" } 8 +func (MissingStatus) ID() RuleID { return "missing-status" } 9 +func (MissingStatus) Severity() Severity { return SeverityWarning } 11 10 func (m *MissingStatus) CheckEntry(entry ast.Entry) []Find { 12 11 tnx, ok := entry.(*ast.Transaction) 13 12 if !ok { ··· 18 17 return []Find{{ 19 18 Code: m.ID(), 20 19 Severity: m.Severity(), 21 - Message: m.Description(), 20 + Message: "transaction has no status", 22 21 Span: tnx.Status.Span, 23 22 }} 24 23 }
M
internal/linter/rule_omitted_precision.go
··· 5 5 // OmittedPrecision flags amounts with insufficient decimal precision (<2 digits). 6 6 type OmittedPrecision struct{} 7 7 8 -func (OmittedPrecision) ID() RuleID { return "omitted-precision" } 9 -func (OmittedPrecision) Severity() Severity { return SeverityWarning } 10 -func (OmittedPrecision) Description() string { return "amount has insufficient precision" } 8 +func (OmittedPrecision) ID() RuleID { return "omitted-precision" } 9 +func (OmittedPrecision) Severity() Severity { return SeverityWarning } 11 10 func (o *OmittedPrecision) CheckEntry(entry ast.Entry) []Find { 12 11 txn, ok := entry.(*ast.Transaction) 13 12 if !ok || (txn.Postings != nil && len(txn.Postings) == 0) { ··· 23 22 finds = append(finds, Find{ 24 23 Code: o.ID(), 25 24 Severity: o.Severity(), 26 - Message: o.Description(), 25 + Message: "amount has insufficient precision", 27 26 Span: posting.Amount.Span, 28 27 }) 29 28 }
M
internal/linter/rule_parse_error.go
··· 5 5 // ParseError wraps parser errors into lint findings. 6 6 type ParseError struct{} 7 7 8 -func (ParseError) ID() RuleID { return "parse-error" } 9 -func (ParseError) Severity() Severity { return SeverityError } 10 -func (ParseError) Description() string { return "parse error" } 8 +func (ParseError) ID() RuleID { return "parse-error" } 9 +func (ParseError) Severity() Severity { return SeverityError } 11 10 func (e *ParseError) CheckJournal(j *ast.Journal) []Find { 12 11 var finds []Find 13 12 for _, err := range j.Errors {
M
internal/linter/rules.go
··· 8 8 type Rule interface { 9 9 ID() RuleID 10 10 Severity() Severity 11 - Description() string 12 11 } 13 12 14 13 // EntryChecker implements pre entry linting during. 15 14 type EntryChecker interface { 16 - CheckEntry(entry ast.Entry) []Find 17 15 Rule 16 + CheckEntry(entry ast.Entry) []Find 18 17 } 19 18 20 19 // JournalChecker implements whole journal linting. 21 20 type JournalChecker interface { 22 - CheckJournal(journal *ast.Journal) []Find 23 21 Rule 22 + CheckJournal(journal *ast.Journal) []Find 24 23 } 25 24 26 25 // Rules is list of all available rules.