linter

package
v0.3.27 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunLinter

func RunLinter(ctx context.Context, paths []string, linter Linter) error

RunLinter run executes the linter for a set of files.

Types

type GitHubActionLinter

type GitHubActionLinter struct{}

func (*GitHubActionLinter) FindViolations

func (tfl *GitHubActionLinter) FindViolations(content []byte, path string) ([]*ViolationInstance, error)

FindViolations inspects a set of bytes that represent a YAML document that defines a GitHub action workflow looking for steps that use the 'hashicorp/setup-terraform' action.

func (*GitHubActionLinter) Selectors

func (tfl *GitHubActionLinter) Selectors() []string

type Linter

type Linter interface {
	// Selectors provides a set of file suffixes to search for. '.tf', '.yml', etc.
	Selectors() []string

	// FindViolations is the specific linter implementation that is applied to each
	// file to find any lint violations.
	FindViolations(content []byte, path string) ([]*ViolationInstance, error)
}

Linter defines an interface selecting a set of files to apply lint rules against.

type TerraformLinter

type TerraformLinter struct{}

func (*TerraformLinter) FindViolations

func (tfl *TerraformLinter) FindViolations(content []byte, path string) ([]*ViolationInstance, error)

FindViolations inspects a set of bytes that represent hcl from a terraform configuration file looking for calls to the 'local-exec' provider.

func (*TerraformLinter) Selectors

func (tfl *TerraformLinter) Selectors() []string

type ViolationInstance

type ViolationInstance struct {
	ViolationType string
	Path          string
	Line          int
}

ViolationInstance is an object that contains a reference to a location in a file where a lint violation was detected.

Jump to

Keyboard shortcuts

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