config

package
v2.7.3 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package config contains functions and structs related to config

Index

Constants

This section is empty.

Variables

View Source
var DefaultExcludes = strings.Join(defaultExcludes, "|")

DefaultExcludes is the regular expression for ignored files

Functions

This section is empty.

Types

type Config

type Config struct {
	// CLI
	ShowVersion bool
	Help        bool
	DryRun      bool
	Path        string

	// CONFIG FILE
	Version             string
	Verbose             bool
	Debug               bool
	IgnoreDefaults      bool
	SpacesAftertabs     bool
	NoColor             bool
	Exclude             []string
	AllowedContentTypes []string
	PassedFiles         []string
	Disable             DisabledChecks

	// MISC
	Logger             logger.Logger
	EditorconfigConfig *editorconfig.Config
}

Config struct, contains everything a config can contain

func NewConfig

func NewConfig(configPath string) (*Config, error)

NewConfig initializes a new config

func (Config) GetAsString

func (c Config) GetAsString() string

GetAsString returns the config in a readable form

func (Config) GetExcludesAsRegularExpression

func (c Config) GetExcludesAsRegularExpression() string

GetExcludesAsRegularExpression returns the excludes as a combined regular expression

func (*Config) Merge

func (c *Config) Merge(config Config)

Merge merges a provided config with a config

func (*Config) Parse

func (c *Config) Parse() error

Parse parses a config at a given path

func (Config) Save

func (c Config) Save(version string) error

Save saves the config to it's Path

type DisabledChecks

type DisabledChecks struct {
	EndOfLine              bool
	Indentation            bool
	InsertFinalNewline     bool
	TrimTrailingWhitespace bool
	IndentSize             bool
	MaxLineLength          bool
}

DisabledChecks is a Struct which represents disabled checks

Jump to

Keyboard shortcuts

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