syntax

package
v0.30.0 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2026 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package syntax provides fail-fast AST-level correctness checks that run before the full lint pipeline. If any check fires, linting is aborted.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClosestInstruction

func ClosestInstruction(input string) string

ClosestInstruction returns the closest valid Dockerfile instruction to input within Levenshtein distance 2, or "" if none is close enough. The comparison is case-insensitive; the returned value is lowercase (matching command.Commands).

func RuleCodes added in v0.14.0

func RuleCodes() []string

RuleCodes returns the rule codes for all syntax-level checks. These checks are not registered in the rules.Registry since they run before the lint pipeline, but they count toward the tally rule total.

Types

type CheckError

type CheckError struct {
	Errors []Error
}

CheckError wraps one or more syntax check failures for error propagation.

func (*CheckError) Error

func (e *CheckError) Error() string

type Error

type Error struct {
	File     string // path to the Dockerfile
	Message  string // e.g. `unknown instruction "FORM" (did you mean "FROM"?)`
	Line     int    // 1-based line number
	RuleCode string // e.g. "tally/unknown-instruction"
}

Error represents a single syntax-level diagnostic.

func Check

func Check(file string, ast *parser.Result, source []byte) []Error

Check runs syntax checks on a parsed AST in priority order and returns errors from the first check that fires. This is fail-fast: once a check produces errors, later checks are skipped. Returns nil if no issues are found.

func (Error) Error

func (e Error) Error() string

Jump to

Keyboard shortcuts

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