Documentation
¶
Index ¶
- func BuildInsertAfterSubcommandFix(file string, cmd shell.CommandInfo, runStartLine int, sm *sourcemap.SourceMap, ...) *rules.SuggestedFix
- func CheckCommandFlag(input rules.LintInput, meta rules.RuleMetadata, config CommandFlagRuleConfig) []rules.Violation
- func FindCommands(run *instructions.RunCommand, shellVariant shell.Variant, ...) ([]shell.CommandInfo, int)
- func ScanRunCommandsWithPOSIXShell(input rules.LintInput, callback RunCommandCallback) []rules.Violation
- type CommandFlagRuleConfig
- type InsertAfterSubcommandFixOptions
- type RunCommandCallback
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.