linters

package
v0.12.2 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2022 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

ByCategory contains a linter for each implemented category.

View Source
var Disabled = map[api.Category]api.Linter{}

Disabled contains all the linters for categories that have been disabled using Disable or DisableAll.

Functions

func ConfigureAll

func ConfigureAll(conf *config.Config) error

Configures all the linters in linters.ByCategory with the given config.

func Disable

func Disable(slug string) int

Disables the linter for a specific category or rule by the category's or rule's slug. In case of a Rule slug, this should include the category name, e.g. 'version-control/code/git-no-big-files', such that the accompanying linter can be found and the rule can be disabled on it using linters.DisableRule. Returns the amount of linting rules disabled.

func DisableAll

func DisableAll(slugs []string) int

Disables the linters for all categories or rules referenced by the given slugs. Basically just a for-loop around linters.Disable() Returns the amount of linting rules disabled.

func DisableCategory

func DisableCategory(cat api.Category) int

DisableCategory disables the linter for a specific category, if a linter for that category is known in linters.ByCategory. Given a category `cat`, this method will remove linters.ByCategory[cat] and add it to linters.Disabled[cat]

func DisableRule

func DisableRule(linter api.Linter, slug string) int

DisableRule disables a rule on the linter by means of the rule's slug. The slug used here should be the same as one of the `linter.Rules()[i].Slug`

func FindRules

func FindRules(slug string) []*api.Rule

FindRules finds all rules that match (start with) the given slug. E.g. `version-control/data` will return all the rules corresponding to data version control.

func GetCategory

func GetCategory(slug string) (api.Category, bool)

GetCategory parses the category from the given slug and returns the matched category and whether it matched. The category is the part of the slug up to the first `/`

func GetLinter

func GetLinter(slug string) (api.Linter, bool)

GetLinter gets linter for the category of the rule referenced by the given slug.

func GetRule

func GetRule(slug string) *api.Rule

GetRule returns the exact rule referenced by the given slug, or nil if it is not found.

Types

This section is empty.

Jump to

Keyboard shortcuts

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