lint

package
v0.0.0-...-fdf2b85 Latest Latest
Warning

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

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

Documentation

Overview

Package lint contains the public API of the k6 extension linter.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Check

type Check struct {
	// Textual explanation of the check result.
	//
	Details string `json:"details,omitempty" yaml:"details,omitempty" mapstructure:"details,omitempty"`

	// The ID of the checker.
	//
	// It identifies the method of check, not the execution of the check.
	//
	ID Checker `json:"id" yaml:"id" mapstructure:"id"`

	// The result of the check.
	//
	// A true value of the passed property indicates a successful check, while a false
	// value indicates a failure.
	//
	Passed bool `json:"passed" yaml:"passed" mapstructure:"passed"`
}

The result of a particular inspection.

type Checker

type Checker string
const CheckerBuild Checker = "build"
const CheckerCodeowners Checker = "codeowners"
const CheckerExamples Checker = "examples"
const CheckerGit Checker = "git"
const CheckerLicense Checker = "license"
const CheckerModule Checker = "module"
const CheckerReadme Checker = "readme"
const CheckerReplace Checker = "replace"
const CheckerSecurity Checker = "security"
const CheckerSmoke Checker = "smoke"
const CheckerTypes Checker = "types"
const CheckerVersions Checker = "versions"
const CheckerVulnerability Checker = "vulnerability"

func ParseChecker

func ParseChecker(val string) (Checker, error)

ParseChecker parses checker name from string.

type Compliance

type Compliance struct {
	// Results of individual checks.
	//
	Checks []Check `json:"checks,omitempty" yaml:"checks,omitempty" mapstructure:"checks,omitempty"`

	// The results of the checks are in the form of a grade.
	//
	Grade Grade `json:"grade" yaml:"grade" mapstructure:"grade"`

	// Compliance expressed as a percentage.
	//
	Level int `json:"level" yaml:"level" mapstructure:"level"`

	// Compliance check timestamp.
	//
	// The timestamp property contains the start timestamp of the check in Unix time
	// format (the number of non-leap seconds that have elapsed since 00:00:00 UTC on
	// 1st January 1970).
	//
	Timestamp float64 `json:"timestamp" yaml:"timestamp" mapstructure:"timestamp"`
}

The result of the extension's k6 compliance checks.

func Lint

func Lint(ctx context.Context, dir string, opts *Options) (*Compliance, error)

Lint checks the directory specified in the dir parameter as the k6 extension source directory.

type Grade

type Grade string
const GradeA Grade = "A"
const GradeB Grade = "B"
const GradeC Grade = "C"
const GradeD Grade = "D"
const GradeE Grade = "E"
const GradeF Grade = "F"
const GradeG Grade = "G"
const GradeZ Grade = "Z"

func (*Grade) Set

func (g *Grade) Set(val string) error

Set implements cobra.Value#Set().

func (*Grade) String

func (g *Grade) String() string

func (*Grade) Type

func (g *Grade) Type() string

Type implements cobra.Value#Type().

type Options

type Options struct {
	// Passed contains a list of checkers that have already been marked as successful.
	Passed []Checker

	// Official can be set true to enable extra checkers (like codeowners) for official extensions.
	Official bool
}

Options contains settings that modify the linter's operation.

Jump to

Keyboard shortcuts

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