Documentation
¶
Index ¶
Constants ¶
const ErrorActionPreferenceRuleCode = rules.TallyRulePrefix + "powershell/error-action-preference"
ErrorActionPreferenceRuleCode is the full rule code.
const PreferShellInstructionRuleCode = rules.TallyRulePrefix + "powershell/prefer-shell-instruction"
PreferShellInstructionRuleCode is the full rule code for prefer-shell-instruction.
const ProgressPreferenceRuleCode = rules.TallyRulePrefix + "powershell/progress-preference"
ProgressPreferenceRuleCode is the full rule code.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ErrorActionPreferenceConfig ¶ added in v0.33.0
type ErrorActionPreferenceConfig struct {
// MinStatements is the minimum number of PowerShell statements to trigger the rule.
// Default is 2 (multi-statement RUNs). Set to 1 to also catch non-terminating
// errors on single-command RUNs.
MinStatements *int `json:"min-statements,omitempty" koanf:"min-statements"`
}
ErrorActionPreferenceConfig is the configuration for the rule.
func DefaultErrorActionPreferenceConfig ¶ added in v0.33.0
func DefaultErrorActionPreferenceConfig() ErrorActionPreferenceConfig
DefaultErrorActionPreferenceConfig returns the default configuration.
type ErrorActionPreferenceRule ¶ added in v0.33.0
type ErrorActionPreferenceRule struct{}
ErrorActionPreferenceRule warns when multi-statement PowerShell RUN instructions lack $ErrorActionPreference = 'Stop' and $PSNativeCommandUseErrorActionPreference = $true.
func NewErrorActionPreferenceRule ¶ added in v0.33.0
func NewErrorActionPreferenceRule() *ErrorActionPreferenceRule
NewErrorActionPreferenceRule creates a new rule instance.
func (*ErrorActionPreferenceRule) Check ¶ added in v0.33.0
func (r *ErrorActionPreferenceRule) Check(input rules.LintInput) []rules.Violation
Check runs the rule.
func (*ErrorActionPreferenceRule) DefaultConfig ¶ added in v0.33.0
func (r *ErrorActionPreferenceRule) DefaultConfig() any
DefaultConfig returns the default configuration.
func (*ErrorActionPreferenceRule) Metadata ¶ added in v0.33.0
func (r *ErrorActionPreferenceRule) Metadata() rules.RuleMetadata
Metadata returns the rule metadata.
type PreferShellInstructionRule ¶
type PreferShellInstructionRule struct{}
PreferShellInstructionRule recommends using SHELL for repeated PowerShell RUN wrappers.
func NewPreferShellInstructionRule ¶
func NewPreferShellInstructionRule() *PreferShellInstructionRule
NewPreferShellInstructionRule creates a new rule instance.
func (*PreferShellInstructionRule) Check ¶
func (r *PreferShellInstructionRule) Check(input rules.LintInput) []rules.Violation
Check runs the rule.
func (*PreferShellInstructionRule) Metadata ¶
func (r *PreferShellInstructionRule) Metadata() rules.RuleMetadata
Metadata returns the rule metadata.
type ProgressPreferenceRule ¶ added in v0.35.0
type ProgressPreferenceRule struct{}
ProgressPreferenceRule warns when PowerShell RUN instructions invoke Invoke-WebRequest (or its alias iwr) without setting $ProgressPreference = 'SilentlyContinue'. The per-response progress bars tank build throughput on Windows containers.
func NewProgressPreferenceRule ¶ added in v0.35.0
func NewProgressPreferenceRule() *ProgressPreferenceRule
NewProgressPreferenceRule creates a new rule instance.
func (*ProgressPreferenceRule) Check ¶ added in v0.35.0
func (r *ProgressPreferenceRule) Check(input rules.LintInput) []rules.Violation
Check runs the rule.
func (*ProgressPreferenceRule) Metadata ¶ added in v0.35.0
func (r *ProgressPreferenceRule) Metadata() rules.RuleMetadata
Metadata returns the rule metadata.