lint

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2024 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Controller

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

func NewController

func NewController(param *ParamController, fs afero.Fs, stdout io.Writer, moduleInstaller *module.Installer, importer *jsonnet.Importer) *Controller

func (*Controller) Lint

func (c *Controller) Lint(ctx context.Context, logE *logrus.Entry, param *ParamLint) error

func (*Controller) Output

func (c *Controller) Output(logE *logrus.Entry, errLevel errlevel.Level, results []*Result, outputters []Outputter, outputSuccess bool) error

func (*Controller) Test

func (c *Controller) Test(_ context.Context, logE *logrus.Entry, param *ParamLint) error

type Data

type Data struct {
	Text     string `json:"text"`
	Value    any    `json:"value"`
	FilePath string `json:"file_path"`
	FileType string `json:"file_type"`
	JSON     []byte `json:"-"`
}

type DataSet

type DataSet struct {
	File  string
	Files []string
}

type FailedResult

type FailedResult struct {
	Name         string `json:"name,omitempty"`
	LintFilePath string `json:"lint_file_path,omitempty"`
	TestFilePath string `json:"test_file_path,omitempty"`
	Param        any    `json:"param,omitempty"`
	Wanted       any    `json:"wanted,omitempty"`
	Got          any    `json:"got,omitempty"`
	Diff         string `json:"diff,omitempty"`
	Error        string `json:"error,omitempty"`
}

type FlatError

type FlatError struct {
	Name        string `json:"name,omitempty"`
	Description string `json:"description,omitempty"`
	Level       string `json:"level,omitempty"`
	Message     string `json:"message,omitempty"`
	LintFile    string `json:"lint_file,omitempty"`
	DataFile    string `json:"data_file,omitempty"`
	// DataFilePaths []string `json:"data_files,omitempty"`
	TargetID string `json:"target_id,omitempty"`
	Location any    `json:"location,omitempty"`
	Custom   any    `json:"custom,omitempty"`
}

func (*FlatError) Failed

func (e *FlatError) Failed(errLevel errlevel.Level) (bool, error)

type GitHub

type GitHub interface {
	GetArchiveLink(ctx context.Context, owner, repo string, archiveformat github.ArchiveFormat, opts *github.RepositoryContentGetOptions, maxRedirects int) (*url.URL, *github.Response, error)
}

type HTTPClient

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

type JsonnetEvaluateResult

type JsonnetEvaluateResult struct {
	// Key    string
	Result string
	Error  string
}

return of vm.Evaluate()

type JsonnetResult

type JsonnetResult struct {
	Name        string `json:"name,omitempty"`
	Description string `json:"description,omitempty"`
	Message     string `json:"message,omitempty"`
	Level       string `json:"level,omitempty"`
	Location    any    `json:"location,omitempty"`
	Custom      any    `json:"custom,omitempty"`
	Excluded    bool   `json:"excluded,omitempty"`
}

unmarshal Jsonnet as JSON

type LintFile

type LintFile struct {
	Path       string
	ModulePath string
	Config     map[string]any
}

type Node

type Node struct {
	Node   jsonnet.Node
	Config map[string]any
	Key    string
}

type Output

type Output struct {
	LintnetVersion string         `json:"lintnet_version"`
	Env            string         `json:"env"`
	Errors         []*FlatError   `json:"errors,omitempty"`
	Config         map[string]any `json:"config,omitempty"`
}

type Outputter

type Outputter interface {
	Output(result *Output) error
}

type ParamController

type ParamController struct {
	Version string
}

type ParamDownloadModule

type ParamDownloadModule struct {
	BaseDir string
}

type ParamLint

type ParamLint struct {
	ErrorLevel     string
	RootDir        string
	ConfigFilePath string
	TargetID       string
	FilePaths      []string
	Output         string
	OutputSuccess  bool
}

type Result

type Result struct {
	TargetID  string           `json:"target_id,omitempty"`
	LintFile  string           `json:"lint_file,omitempty"`
	DataFile  string           `json:"data_file,omitempty"`
	DataFiles []string         `json:"data_files,omitempty"`
	RawResult []*JsonnetResult `json:"-"`
	RawOutput string           `json:"-"`
	Interface any              `json:"result,omitempty"`
	Error     string           `json:"error,omitempty"`
}

func (*Result) FlatErrors

func (result *Result) FlatErrors() []*FlatError

type Target

type Target struct {
	ID        string
	Combine   bool
	LintFiles []*config.LintFile
	DataFiles []string
}

type TestData

type TestData struct {
	Name     string           `json:"name,omitempty"`
	DataFile string           `json:"data_file,omitempty"`
	Param    *TopLevelArgment `json:"param,omitempty"`
	Result   any              `json:"result,omitempty"`
}

type TestPair

type TestPair struct {
	LintFilePath string
	TestFilePath string
}

type TopLevelArgment

type TopLevelArgment struct {
	Data         *Data          `json:"data,omitempty"`
	CombinedData []*Data        `json:"combined_data,omitempty"`
	Config       map[string]any `json:"config"`
}

Jump to

Keyboard shortcuts

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