cqlinters

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2021 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypePylint api.CQLinterType = "pylint"
	TypeMypy   api.CQLinterType = "mypy"
	TypeBlack  api.CQLinterType = "black"
	TypeISort  api.CQLinterType = "isort"
	TypeBandit api.CQLinterType = "bandit"
)

Variables

MessageTypes is the list of all message types emitted by Pylint, but then as strings for easy appending to a string array.

View Source
var Symbols = []string{}/* 282 elements not displayed */

Symbols is a list of all 282 linting warnings / errors / messages that Pylint emits in its default configuration. To regenerate this list, use `pylint --list-msgs-enabled`, then copy the enabled messages and use `cut -d " " -f1` to cut off the symbol ID.

Functions

func Detect

func Detect(project api.Project) []api.CQLinter

Detect finds all CQLinters that are used within the project.

func DetectLinter

func DetectLinter(linter api.CQLinter, project api.Project) bool

DetectLinter returns true if this is CQLinter is being used in the project, i.e. when either linter.IsConfigured() is true, or when the project's main dependency manager has the linter in its dependencies.

func DetectType

func DetectType(typ api.CQLinterType, project api.Project) bool

DetectType returns true if this CQLinterType is being used in the project.

func FromConfig

func FromConfig(conf config.CodeQualityConfig) ([]api.CQLinter, error)

FromConfig returns a list of CQLinters based on the CodeQualityConfig from the mllint configuration. Always returns a non-nil list of CQLinters containing all correctly named linters, even when there is an error.

Types

type Bandit

type Bandit struct{}

func (Bandit) DependencyName

func (p Bandit) DependencyName() string

func (Bandit) IsConfigured

func (p Bandit) IsConfigured(project api.Project) bool

func (Bandit) IsInstalled

func (p Bandit) IsInstalled() bool

func (Bandit) IsProperlyConfigured

func (p Bandit) IsProperlyConfigured(project api.Project) bool

func (Bandit) Run

func (p Bandit) Run(project api.Project) ([]api.CQLinterResult, error)

func (Bandit) String

func (p Bandit) String() string

func (Bandit) Type

func (p Bandit) Type() api.CQLinterType

type BanditMessage

type BanditMessage struct {
	TestID      string `yaml:"test_id"`
	TestName    string `yaml:"test_name"`
	Confidence  string `yaml:"issue_confidence"`
	Severity    string `yaml:"issue_severity"`
	Text        string `yaml:"issue_text"`
	MoreInfo    string `yaml:"more_info"`
	CodeSnippet string `yaml:"code"`
	Filename    string `yaml:"filename"`
	Line        int32  `yaml:"line_number"`
}

func (BanditMessage) String

func (msg BanditMessage) String() string

type Black

type Black struct{}

func (Black) DependencyName

func (p Black) DependencyName() string

func (Black) IsConfigured

func (p Black) IsConfigured(project api.Project) bool

func (Black) IsInstalled

func (p Black) IsInstalled() bool

func (Black) IsProperlyConfigured

func (p Black) IsProperlyConfigured(project api.Project) bool

func (Black) Run

func (p Black) Run(project api.Project) ([]api.CQLinterResult, error)

func (Black) String

func (p Black) String() string

func (Black) Type

func (p Black) Type() api.CQLinterType

type ISort

type ISort struct{}

func (ISort) DependencyName

func (p ISort) DependencyName() string

func (ISort) IsConfigured

func (p ISort) IsConfigured(project api.Project) bool

func (ISort) IsInstalled

func (p ISort) IsInstalled() bool

func (ISort) IsProperlyConfigured

func (p ISort) IsProperlyConfigured(project api.Project) bool

func (ISort) Run

func (p ISort) Run(project api.Project) ([]api.CQLinterResult, error)

func (ISort) String

func (p ISort) String() string

func (ISort) Type

func (p ISort) Type() api.CQLinterType

type ISortProblem

type ISortProblem struct {
	Path    string
	Message string
}

func (ISortProblem) String

func (msg ISortProblem) String() string

type MessageType

type MessageType string

MessageType is the type of Pylint message that is emitted See: https://code.visualstudio.com/docs/python/linting#_pylint

const (
	// TypeConvention indicates a programming standard violation, i.e. stylistic issue.
	TypeConvention MessageType = "convention"

	// TypeRefactor indicates a bad code smell
	TypeRefactor MessageType = "refactor"

	// TypeWarning can include various Python-specific warnings
	TypeWarning MessageType = "warning"

	// TypeError is for "likely code bugs" that will probably definitely give bugs
	TypeError MessageType = "error"

	// TypeFatal is for errors preventing further Pylint processing.
	TypeFatal MessageType = "fatal"
)

type Mypy

type Mypy struct{}

func (Mypy) DependencyName

func (p Mypy) DependencyName() string

func (Mypy) IsConfigured

func (p Mypy) IsConfigured(project api.Project) bool

func (Mypy) IsInstalled

func (p Mypy) IsInstalled() bool

func (Mypy) IsProperlyConfigured

func (p Mypy) IsProperlyConfigured(project api.Project) bool

func (Mypy) Run

func (p Mypy) Run(project api.Project) ([]api.CQLinterResult, error)

func (Mypy) String

func (p Mypy) String() string

func (Mypy) Type

func (p Mypy) Type() api.CQLinterType

type MypyMessage

type MypyMessage struct {
	Severity string
	Message  string
	Filename string
	Line     int
	Column   int
}

func (MypyMessage) String

func (msg MypyMessage) String() string

type Pylint

type Pylint struct{}

func (Pylint) DependencyName

func (p Pylint) DependencyName() string

func (Pylint) IsConfigured

func (p Pylint) IsConfigured(project api.Project) bool

func (Pylint) IsInstalled

func (p Pylint) IsInstalled() bool

func (Pylint) IsProperlyConfigured

func (p Pylint) IsProperlyConfigured(project api.Project) bool

func (Pylint) Run

func (p Pylint) Run(project api.Project) ([]api.CQLinterResult, error)

func (Pylint) String

func (p Pylint) String() string

func (Pylint) Type

func (p Pylint) Type() api.CQLinterType

type PylintMessage

type PylintMessage struct {
	Type      MessageType `json:"type" yaml:"type"`
	Symbol    string      `json:"symbol" yaml:"symbol"`
	Message   string      `json:"message" yaml:"message"`
	MessageID string      `json:"message-id" yaml:"symbolId"`
	Path      string      `json:"path" yaml:"path"`
	Line      int32       `json:"line" yaml:"line"`
	Column    int16       `json:"column" yaml:"column"`
}

PylintMessage represents a Pylint error / warning message (in JSON)

func (PylintMessage) String

func (msg PylintMessage) String() string

Jump to

Keyboard shortcuts

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