powershell

package
v0.35.0 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: 15 Imported by: 0

Documentation

Index

Constants

View Source
const ErrorActionPreferenceRuleCode = rules.TallyRulePrefix + "powershell/error-action-preference"

ErrorActionPreferenceRuleCode is the full rule code.

View Source
const PreferShellInstructionRuleCode = rules.TallyRulePrefix + "powershell/prefer-shell-instruction"

PreferShellInstructionRuleCode is the full rule code for prefer-shell-instruction.

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

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

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

Check runs the rule.

func (*PreferShellInstructionRule) Metadata

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

Check runs the rule.

func (*ProgressPreferenceRule) Metadata added in v0.35.0

Metadata returns the rule metadata.

Jump to

Keyboard shortcuts

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