linter

package
v0.0.0-...-a4d1c73 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2019 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package linter provides revision of templates. Linter configuration is in default/style.yaml.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckStyle

func CheckStyle(ctx *context.Context) (err error)

CheckStyle gets linter configuration and run checking.

Types

type AllowedLists

type AllowedLists struct {
	Inline bool `yaml:"inline"`
	Dash   bool `yaml:"dash"`
}

AllowedLists describes which types of lists are correct.

type Check

type Check struct {
	Required bool        `yaml:"required"`
	Value    interface{} `yaml:"value"`
}

Check stores information about if something is required or not and value e.g indent.

type GlobalLinterConfiguration

type GlobalLinterConfiguration struct {
	LineLength        Check             `yaml:"lineLength"`
	Indent            Check             `yaml:"indent"`
	RequiredFields    RequiredFields    `yaml:"requiredFields"`
	NamingConventions NamingConventions `yaml:"namingConventions"`
	BlankLinesAllowed bool              `yaml:"blankLinesAllowed"`
}

GlobalLinterConfiguration describes global configuration. It's used in LinterConfiguration as one of type of Linter.

type JsonLinterConfiguration

type JsonLinterConfiguration struct {
	Spaces SpacesConfiguration `yaml:"spaces"`
}

JsonLinterConfiguration describes where should be spaces.

type LinterConfiguration

type LinterConfiguration struct {
	Yaml   YamlLinterConfiguration   `yaml:"yaml"`
	Json   JsonLinterConfiguration   `yaml:"json"`
	Global GlobalLinterConfiguration `yaml:"global"`
}

LinterConfiguration contains configuration for two types - Yaml and JSON, and global.

func GetLinterConfiguration

func GetLinterConfiguration(ctx *context.Context) (err error, lintConf LinterConfiguration)

GetLinterConfiguration gets configuration from file.

func (LinterConfiguration) CheckLogicalName

func (this LinterConfiguration) CheckLogicalName(name string) bool

CheckLogicalName checks name. It use NamingConventions.

type NamingConventions

type NamingConventions struct {
	LogicalNames string `yaml:"logicalNames"`
}

NamingConventions describes how should looks names.

type Parameter

type Parameter struct {
	Type          string   `json:"Type"`
	Default       string   `json:"Default"`
	AllowedValues []string `json:"AllowedValues"`
	Description   string   `json:"Description"`
}

Parameter describes all element which parameter in template should have.

type Quotes

type Quotes struct {
	Single   bool `yaml:"single"`
	Double   bool `yaml:"double"`
	Noquotes bool `yaml:"noquotes"`
}

Quotes describes types of quotes.

type RequiredFields

type RequiredFields struct {
	TemplateDescription   bool `yaml:"templateDescription"`
	ParametersDescription bool `yaml:"parametersDescription"`
}

RequiredFields says which elements in template are required.

type SpacesConfiguration

type SpacesConfiguration struct {
	After  []string `yaml:"after"`
	Before []string `yaml:"before"`
}

SpacesConfiguration stores information about spaces before and after something.

type YamlLinterConfiguration

type YamlLinterConfiguration struct {
	AllowedQuotes      Quotes       `yaml:"allowedQuotes"`
	AllowedLists       AllowedLists `yaml:"allowedLists"`
	ContinuationIndent Check        `yaml:"continuationIndent"`
}

YamlLinterConfiguration describes configuration for Yaml - what type of quotes, lists and indent is used.

Jump to

Keyboard shortcuts

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