Documentation
¶
Overview ¶
Package check implements the `mkit check` and `mkit lint` subcommands: load, parse, compile, and lint a Datalog policy without running a query.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var CheckCmd = &cobra.Command{ Use: "check <policy.mg>", Short: "Load, compile, and lint a policy without running a query", Long: `Load, compile, and lint a policy without running a query. Checks that the file parses and compiles against the manglekit engine (including predicate declarations and mode checks). With --lint (default), it checks for ungrounded negated variables and dead rule premises.`, Args: cobra.ExactArgs(1), RunE: runCheck, }
var LintCmd = &cobra.Command{ Use: "lint <policy.mg>", Short: "Lint a Datalog policy for ungrounded variables and dead rules", Long: "Alias for `mkit check --lint`.", Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) error { lintFlag = true return runCheck(cmd, args) }, }
Functions ¶
func AddCommands ¶
Types ¶
type IssueSeverity ¶ added in v0.12.0
type IssueSeverity string
const ( SeverityError IssueSeverity = "ERROR" SeverityWarning IssueSeverity = "WARN" )
type LintIssue ¶ added in v0.12.0
type LintIssue struct {
Severity IssueSeverity `json:"severity"`
Rule string `json:"rule,omitempty"`
Message string `json:"message"`
}
LintIssue represents a static analysis warning or error in a Datalog policy.
func LintPolicy ¶ added in v0.12.0
LintPolicy analyzes Datalog policy source for common pitfalls: 1. Unbound variables in negated atoms (fails stratification / mode check). 2. Wildcard variables in negated atoms. 3. Unreachable/dead rules referencing predicates that are never declared or derived.