lint

package
v1.35.1-aplha Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2021 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PlainTextOutput string = "plain-text"
	JSONOutput      string = "json"
)

Variables

View Source
var DockerfileLinters = []Linter{
	&RegExpLinter{},
	&DockerfileCommandLinter{},
}
View Source
var K8sManifestLinters = []Linter{
	&RegExpLinter{},
	&YamlFieldLinter{},
}
View Source
var SkaffoldYamlLinters = []Linter{
	&RegExpLinter{},
	&YamlFieldLinter{},
}

Functions

func GetDockerfilesLintResults added in v1.34.1

func GetDockerfilesLintResults(ctx context.Context, opts Options, dockerCfg docker.Config) (*[]Result, error)

func GetK8sManifestsLintResults added in v1.34.1

func GetK8sManifestsLintResults(ctx context.Context, opts Options) (*[]Result, error)

func GetSkaffoldYamlsLintResults

func GetSkaffoldYamlsLintResults(ctx context.Context, opts Options) (*[]Result, error)

func Lint

func Lint(ctx context.Context, out io.Writer, opts Options, dockerCfg docker.Config) error

func OutputFormatter

func OutputFormatter(out io.Writer, opt string) format.Formatter

Types

type ConfigFile

type ConfigFile struct {
	AbsPath string
	RelPath string
	Text    string
}

type DockerCommandFilter added in v1.34.1

type DockerCommandFilter struct {
	DockerCommand          string
	DockerCopyDestRegExp   string
	DockerCopySourceRegExp string
}

type DockerfileCommandLinter added in v1.34.1

type DockerfileCommandLinter struct{}

func (*DockerfileCommandLinter) Lint added in v1.34.1

func (*DockerfileCommandLinter) Lint(params InputParams, rules *[]Rule) (*[]Result, error)

type InputParams added in v1.34.1

type InputParams struct {
	ConfigFile               ConfigFile
	DockerfileToDepMap       map[string][]string
	DockerfileToFromToToDeps map[string]map[string][]string
	SkaffoldConfig           *parser.SkaffoldConfigEntry
	DockerCopyCommandInfo    docker.FromTo
	WorkspacePath            string
	DockerConfig             docker.Config
}

type Linter

type Linter interface {
	Lint(InputParams, *[]Rule) (*[]Result, error)
}

type Options

type Options struct {
	// Filename is the `skaffold.yaml` file path
	Filename string
	// RepoCacheDir is the directory for the remote git repository cache
	RepoCacheDir string
	// OutFormat is the output format. One of: json
	OutFormat string
	// Modules is the module filter for specific commands
	Modules []string
	// Profiles is the slice of profile names to activate.
	Profiles []string
}

Options holds flag values for the various `skaffold lint` commands

type RegExpLinter

type RegExpLinter struct{}

func (*RegExpLinter) Lint

func (*RegExpLinter) Lint(lintInputs InputParams, rules *[]Rule) (*[]Result, error)

type Result

type Result struct {
	Rule        *Rule
	AbsFilePath string
	RelFilePath string
	Explanation string
	Line        int
	Column      int
}

type Rule

type Rule struct {
	RuleID               RuleID
	RuleType             RuleType
	ExplanationTemplate  string
	Severity             protocol.DiagnosticSeverity
	Filter               interface{}
	ExplanationPopulator func(InputParams) (explanationInfo, error) `json:"-"`
	LintConditions       []func(InputParams) bool                   `json:"-"`
}

type RuleID

type RuleID int
const (
	DummyRuleIDForTesting RuleID = iota

	SkaffoldYamlAPIVersionOutOfDate
	SkaffoldYamlUseStaticPort
	SkaffoldYamlSyncPython

	DockerfileCopyOver1000Files
	DockerfileCopyContainsGitDir

	K8sManifestManagedByLabelInUse
)

func (RuleID) String

func (a RuleID) String() string

type RuleType

type RuleType int
const (
	RegExpLintLintRule RuleType = iota
	YamlFieldLintRule
	DockerfileCommandLintRule
)

func (RuleType) String

func (a RuleType) String() string

type YamlFieldFilter

type YamlFieldFilter struct {
	Filter      yaml.Filter
	FieldMatch  string
	InvertMatch bool
}

type YamlFieldLinter

type YamlFieldLinter struct{}

func (*YamlFieldLinter) Lint

func (*YamlFieldLinter) Lint(lintInputs InputParams, rules *[]Rule) (*[]Result, error)

Jump to

Keyboard shortcuts

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