check

package
v0.13.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 10, 2026 License: Apache-2.0 Imports: 8 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
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,
}
View Source
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

func AddCommands(rootCmd *cobra.Command)

Types

type IssueSeverity added in v0.12.0

type IssueSeverity string
const (
	SeverityError   IssueSeverity = "ERROR"
	SeverityWarning IssueSeverity = "WARN"
)

type LintError added in v0.12.0

type LintError struct {
	Count int
}

func (*LintError) Error added in v0.12.0

func (e *LintError) Error() string

func (*LintError) Is added in v0.12.0

func (e *LintError) Is(target error) bool

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

func LintPolicy(content string) ([]LintIssue, error)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL