Documentation
¶
Overview ¶
Package language contains configuration structures and helpers for language definitions.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewLanguageConfigFile ¶
NewLanguageConfigFile Creates the project file locally
func Schema ¶
func Schema() *jsonschema.Schema
Schema is used to generate a complete jsonschema for the Languages struct
Types ¶
type Language ¶
type Language struct {
FileMatch *Regex `json:"match,flow" yaml:"match,flow" jsonschema:"a regex to match files against to know they are the target of this language"`
Fmt Linter `json:"fmt,omitzero" yaml:"fmt" jsonschema:"used for the given language when formatting"`
Chk Linter `json:"chk,omitzero" yaml:"chk" jsonschema:"used for the given language when linting/checking"`
}
Language is used to map customer yaml decoders for implementations of Crie linters
func (Language) ToRunFormat ¶ added in v1.0.6
func (l Language) ToRunFormat() (runner.LinterMatch, error)
ToRunFormat will convert the yaml friendly version to an internal representation used by crie
type Languages ¶
type Languages struct {
Languages map[string]Language `json:"languages" yaml:"languages" jsonschema:"a map of languages that crie should be able to run"`
}
Languages is the schema for a projects' project file
func DefaultLanguageConfig ¶ added in v1.0.6
func DefaultLanguageConfig() Languages
DefaultLanguageConfig returns the default language config
func LoadFile ¶
LoadFile will attempt to parse a Language schema compatible file and use it to overwrite the builtin defaults
func (Languages) ToRunFormat ¶ added in v1.0.6
func (l Languages) ToRunFormat() (runner.NamedMatches, error)
ToRunFormat converts the yaml friendly version to an internal representation used by crie
type Linter ¶
Linter attaches a type discriminator field to make a Crie Linter implementation yaml parsable
func (Linter) JSONSchema ¶
func (l Linter) JSONSchema() *jsonschema.Schema
JSONSchema is used to parse a valid jsonschema just for a Linter
type Regex ¶
Regex wraps regexp.Regexp with custom YAML unmarshaling
func (Regex) JSONSchema ¶ added in v1.0.7
func (cr Regex) JSONSchema() *jsonschema.Schema
JSONSchema returns the JSON schema for the Regex type