config

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package config contains helpers, defaults for linter

Index

Constants

View Source
const (
	// ConfFileName represent config file name
	ConfFileName = "commitlint.yaml"
)

Variables

This section is empty.

Functions

func DefaultConfToFile

func DefaultConfToFile(isOnlyEnabled bool) error

DefaultConfToFile writes default config to given file

func GetConfig

func GetConfig(flagConfPath string) (*lint.Config, error)

GetConfig returns parses config file and returns Config instance

func GetConfigPath

func GetConfigPath(confFilePath string) (string, bool, error)

GetConfigPath returns config file path, follwing below

  1. check for conf in current directory
  2. check for conf flag
  3. load default conf

func GetEnabledRules added in v0.4.0

func GetEnabledRules(conf *lint.Config) ([]lint.Rule, error)

GetEnabledRules forms Rule object for rules which are enabled in config

func GetFormatter

func GetFormatter(conf *lint.Config) (lint.Formatter, error)

GetFormatter returns the formatter as defined in conf

func GetLinter

func GetLinter(conf *lint.Config) (*lint.Linter, error)

GetLinter returns Linter for given confFilePath

func Parse

func Parse(confPath string) (*lint.Config, error)

Parse parse Config from given file

func RegisterFormatter added in v0.4.0

func RegisterFormatter(format lint.Formatter) error

RegisterFormatter registers a custom formatter if formatter already exists, returns error

func RegisterRule added in v0.4.0

func RegisterRule(rule lint.Rule) error

RegisterRule registers a custom rule if rule already exists, returns error

func Validate

func Validate(conf *lint.Config) error

Validate parses Config from given data

func WriteConfToFile

func WriteConfToFile(outFilePath string, conf *lint.Config) (retErr error)

WriteConfToFile util func to write config object to given file

Types

This section is empty.

Jump to

Keyboard shortcuts

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