all repos

clerk @ 1b934a8ee8892eb089a019c5471238bdec1fcd18

missing tooling for ledger/hledger

clerk/internal/linter/rules.go (view raw)

Oleksandr Smirnov Oleksandr Smirnov
olexsmir@gmail.com
linter: add "more than one posting has omitted amount" rule, 1 month ago
1
package linter
2
3
import "olexsmir.xyz/clerk/journal/ast"
4
5
type RuleID string
6
7
// Rule is the best interface that every rule must implement.
8
type Rule interface {
9
	ID() RuleID
10
	Severity() Severity
11
}
12
13
// EntryChecker implements pre entry linting during.
14
type EntryChecker interface {
15
	Rule
16
	CheckEntry(entry ast.Entry) []Find
17
}
18
19
// JournalChecker implements whole journal linting.
20
type JournalChecker interface {
21
	Rule
22
	CheckJournal(journal *ast.Journal) []Find
23
}
24
25
// Rules is list of all available rules.
26
var Rules = []Rule{
27
	&ParseError{},
28
	&EmptyPostings{},
29
	&OmittedPrecision{},
30
	&MissingCommodity{},
31
	&MissingStatus{},
32
	&AccountDepthLimit{MaxDepth: 4},
33
	&MultipleOmittedAmounts{},
34
}