terraformlinter

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package terraformlinter contains a linter implementation that verifies terraform files against our internal style guide and reports on all violations.

Index

Constants

View Source
const (
	None tokenPosition = iota
	LeadingStart
	LeadingEnd
	ProviderStart
	ProviderCenter
	ProviderEnd
	Ignored
	Trailing
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config added in v0.2.0

type Config struct {
	ExcludePaths []string
	IgnoreRules  []string
}

Config is the input to creating a new linter.

type Finding added in v0.2.0

type Finding struct {
	// contains filtered or unexported fields
}

func (*Finding) String added in v0.2.0

func (f *Finding) String() string

String reports a human-friendly version of the finding in the format:

<path>:<line>:<column>: <rule-id>: <message>
<snippet>
^

For example:

folder/file.tf:37:8: TF001: Things are broken
resource "foo" "bar-baz" {
                   ^

type Linter added in v0.2.0

type Linter struct {
	// contains filtered or unexported fields
}

Linter is an instance of a linter type.

func New added in v0.2.0

func New(c *Config) (*Linter, error)

New creates a new instance of a linter with the given config.

func (*Linter) AddFinding added in v0.2.0

func (l *Linter) AddFinding(r *rules.Rule, lines [][]byte, t hclsyntax.Token)

AddFinding adds a finding to the linter, skipping any ignored rules. It is safe for calling concurrently.

func (*Linter) Findings added in v0.2.0

func (l *Linter) Findings() []*Finding

Findings returns a all the findings, sorted by filename and then Rule ID.

func (*Linter) Run added in v0.2.0

func (l *Linter) Run(ctx context.Context, paths []string) error

Run executes the specified linter for a set of files.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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