lint

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(rootDir string, source []byte, configurationPath string) (*internal.Engine, error)

export the function NewEngine to be used in other packages

func ProcessCyclomaticComplexity

func ProcessCyclomaticComplexity(path string, threshold int) ([]tt.Issue, error)

func ProcessFile

func ProcessFile(engine LintEngine, filePath string) ([]tt.Issue, error)

func ProcessFiles

func ProcessFiles(
	ctx context.Context,
	logger *zap.Logger,
	engine LintEngine,
	paths []string,
	processor func(LintEngine, string) ([]tt.Issue, error),
) ([]tt.Issue, error)

func ProcessPath

func ProcessPath(
	_ context.Context,
	logger *zap.Logger,
	engine LintEngine,
	path string,
	processor func(LintEngine, string) ([]tt.Issue, error),
) ([]tt.Issue, error)

func ProcessSource

func ProcessSource(engine LintEngine, source []byte) ([]tt.Issue, error)

func ProcessSources

func ProcessSources(
	ctx context.Context,
	logger *zap.Logger,
	engine LintEngine,
	sources [][]byte,
	processor func(LintEngine, []byte) ([]tt.Issue, error),
) ([]tt.Issue, error)

Types

type Config

type Config struct {
	Name  string                   `yaml:"name"`
	Rules map[string]tt.ConfigRule `yaml:"rules"`
}

Config represents the overall configuration with a name and a slice of rules.

type LintEngine

type LintEngine interface {
	Run(filePath string) ([]tt.Issue, error)
	RunSource(source []byte) ([]tt.Issue, error)
	IgnoreRule(rule string)
}

Jump to

Keyboard shortcuts

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