config

package
v0.8.3 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadModFile

func ReadModFile() (*modfile.File, error)

ReadModFile return info from file go.mod.

Types

type Config

type Config struct {
	NoNoLint     NoNoLint      `yaml:"NoNoLint"`
	NoGoroutine  DefaultLinter `yaml:"NoGoroutine"`
	NoLength     DefaultLinter `yaml:"NoLength"`
	NoDefer      DefaultLinter `yaml:"NoDefer"`
	NoDoc        DefaultLinter `yaml:"NoDoc"`
	NoInit       DefaultLinter `yaml:"NoInit"`
	NoGeneric    DefaultLinter `yaml:"NoGeneric"`
	NoPrefix     DefaultLinter `yaml:"NoPrefix"`
	NoUnderscore DefaultLinter `yaml:"NoUnderscore"`
	NoObject     DefaultLinter `yaml:"NoObject"`
	NoEmbedding  DefaultLinter `yaml:"NoEmbedding"`
}

func ReadFromBytes

func ReadFromBytes(body []byte) (*Config, error)

ReadFromBytes load config from bytes.

func ReadFromFile

func ReadFromFile(path string) (*Config, error)

ReadFromFile load config file `.golimiter.yaml` or stdin.

type DefaultLinter

type DefaultLinter struct {
	ExcludeHashs   []ExcludeHash `yaml:"ExcludeHashs"`
	ExcludeNames   []ExcludeName `yaml:"ExcludeNames"`
	ExcludeFiles   []string      `yaml:"ExcludeFiles"`
	ExcludeFolders []string      `yaml:"ExcludeFolders"`
	Info           `yaml:"Info"`
}

func (DefaultLinter) IsVerifyHash

func (c DefaultLinter) IsVerifyHash(hash string) bool

func (DefaultLinter) IsVerifyName

func (c DefaultLinter) IsVerifyName(path, name string) bool

type ExcludeHash

type ExcludeHash struct {
	Hash    string    `yaml:"Hash"`
	Before  time.Time `yaml:"Before"`
	Comment string    `yaml:"Comment"`
}

func (ExcludeHash) IsVerify

func (eh ExcludeHash) IsVerify(hash string) bool

type ExcludeName

type ExcludeName struct {
	Name    string    `yaml:"Name"`
	Path    string    `yaml:"Path"`
	Before  time.Time `yaml:"Before"`
	Comment string    `yaml:"Comment"`
}

func (ExcludeName) IsVerify

func (en ExcludeName) IsVerify(path, name string) bool

type ExcludeNameNoNoLint

type ExcludeNameNoNoLint struct {
	Position ExcludeName `yaml:"Position"`
	Linters  []string    `yaml:"Linters"`
}

type Global

type Global struct {
	ExcludeFiles   []string         `yaml:"ExcludeFiles"`
	ExcludeFolders []string         `yaml:"ExcludeFolders"`
	Linters        map[string]*Info `yaml:"Linters"`
}

type Info

type Info struct {
	Severity string `yaml:"Severity"`
	Disable  bool   `yaml:"Disable"`
	Type     string `yaml:"Type"`
}

func GetGlobalConfigForLinter

func GetGlobalConfigForLinter(global map[string]*Info, name string) Info

type NoNoLint

type NoNoLint struct {
	ExcludeHashs   []ExcludeHash         `yaml:"ExcludeHashs"`
	ExcludeNames   []ExcludeNameNoNoLint `yaml:"ExcludeNames"`
	ExcludeFiles   []string              `yaml:"ExcludeFiles"`
	ExcludeFolders []string              `yaml:"ExcludeFolders"`
	Info           `yaml:"Info"`
}

func (NoNoLint) IsVerifyHash

func (c NoNoLint) IsVerifyHash(hash string) bool

func (NoNoLint) IsVerifyName

func (c NoNoLint) IsVerifyName(path, name string, linters []string) bool

type Settings

type Settings struct {
	Global Global            `yaml:"global"`
	Module map[string]Config `yaml:"module"`
}

Jump to

Keyboard shortcuts

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