runcheck

package
v0.35.1 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2026 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildInsertAfterSubcommandFix

func BuildInsertAfterSubcommandFix(
	file string,
	cmd shell.CommandInfo,
	runStartLine int,
	sm *sourcemap.SourceMap,
	opts InsertAfterSubcommandFixOptions,
) *rules.SuggestedFix

BuildInsertAfterSubcommandFix inserts text immediately after a command subcommand when source-aware shell positions are available.

func CheckCommandFlag

func CheckCommandFlag(input rules.LintInput, meta rules.RuleMetadata, config CommandFlagRuleConfig) []rules.Violation

CheckCommandFlag checks commands that require a specific flag after matching a command name and subcommand.

func FindCommands

func FindCommands(
	run *instructions.RunCommand,
	shellVariant shell.Variant,
	sm *sourcemap.SourceMap,
	names ...string,
) ([]shell.CommandInfo, int)

FindCommands returns matching commands from a RUN instruction and the 1-based source start line when shell-form source positions are available.

func ScanRunCommandsWithPOSIXShell

func ScanRunCommandsWithPOSIXShell(input rules.LintInput, callback RunCommandCallback) []rules.Violation

ScanRunCommandsWithPOSIXShell walks RUN commands and skips shell-form RUNs in non-POSIX shells while still allowing exec-form RUNs through.

Types

type CommandFlagRuleConfig

type CommandFlagRuleConfig struct {
	CommandNames    []string
	Subcommands     []string
	HasRequiredFlag func(cmd *shell.CommandInfo) bool
	FixFlag         string
	FixDescription  string
	Detail          string
	FixSafety       rules.FixSafety
}

CommandFlagRuleConfig defines a common command+flag requirement pattern.

type InsertAfterSubcommandFixOptions

type InsertAfterSubcommandFixOptions struct {
	Text        string
	Description string
	Safety      rules.FixSafety
	Priority    int
}

BuildInsertAfterSubcommandFix inserts text immediately after a command subcommand when source-aware shell positions are available.

type RunCommandCallback

type RunCommandCallback func(run *instructions.RunCommand, shellVariant shell.Variant, file string) []rules.Violation

RunCommandCallback checks a RUN command with the given shell variant.

Jump to

Keyboard shortcuts

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