language

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2026 License: MIT Imports: 16 Imported by: 0

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

func NewLanguageConfigFile(path string) error

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

func LoadFile(path string) (*Languages, error)

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

type Linter struct {
	linter.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

func (*Linter) UnmarshalYAML

func (l *Linter) UnmarshalYAML(value *yaml.Node) error

UnmarshalYAML implements custom YAML unmarshalling

type Regex

type Regex struct {
	*regexp.Regexp
}

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

func (*Regex) UnmarshalYAML

func (cr *Regex) UnmarshalYAML(value *yaml.Node) error

UnmarshalYAML implements custom YAML unmarshalling

Jump to

Keyboard shortcuts

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