linters

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: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxLengthObject = 30
	MaxSegmentCount = 6
)

Variables

All lintres for analysis.

Functions

func FindIdentsWithPartialPrefix

func FindIdentsWithPartialPrefix(prefixSource string, idents []string) (commonPrefix string, found []string)

func FirstToLower added in v0.3.17

func FirstToLower(s string) string

func FirstToUpper added in v0.3.17

func FirstToUpper(s string) string

func FixName added in v0.3.19

func FixName(text string) string

func FixNameFromFuncDecl added in v0.3.19

func FixNameFromFuncDecl(fn *ast.FuncDecl) string

func ForFuncType

func ForFuncType(n *ast.FuncType) *ast.FieldList

ForFuncType returns TypeParams.

func ForTypeSpec

func ForTypeSpec(n *ast.TypeSpec) *ast.FieldList

ForTypeSpec returns TypeParams.

func GetObjectName

func GetObjectName(node ast.Node) string

func GetParamsFromFunc added in v0.4.0

func GetParamsFromFunc(funcType *ast.FuncType) []string

func GetReturnsFromFunc added in v0.4.0

func GetReturnsFromFunc(funcType *ast.FuncType) []string

func GetSegmentCount

func GetSegmentCount(text string) int

func GetSegments

func GetSegments(ident string) (segments []string)

func IsGeneric

func IsGeneric(node ast.Node, info *types.Info) bool

IsGeneric check code on generic.

func IsLower added in v0.3.17

func IsLower(b byte) bool

func NewEmbedding added in v0.8.0

func NewEmbedding() *analysis.Linter

NewEmbedding create instance linter for check embedding.

func NewNoDefer

func NewNoDefer() *analysis.Linter

NewNoDefer create instance linter for check defer.

func NewNoDoc added in v0.6.0

func NewNoDoc() *analysis.Linter

NewNoDoc create instance linter for check docs.

func NewNoGeneric

func NewNoGeneric() *analysis.Linter

NewNoGeneric create instance linter for check generic. Please more info in https://cs.opensource.google/go/x/tools/+/master:go/analysis/passes/usesgenerics/

func NewNoGoroutine

func NewNoGoroutine() *analysis.Linter

NewNoGoroutine create instance linter for check goroutines.

func NewNoInit

func NewNoInit() *analysis.Linter

NewNoInit create instance linter for check func init.

func NewNoLength

func NewNoLength() *analysis.Linter

NewNoLength create instance linter for length object.

func NewNoNoLint

func NewNoNoLint() *analysis.Linter

NewNoNoLint create instance linter for check func nolint.

func NewNoObject added in v0.5.0

func NewNoObject() *analysis.Linter

func NewNoPrefix

func NewNoPrefix() *analysis.Linter

NewNoPrefix create instance linter for check func prefix.

func NewNoUnderscore added in v0.4.0

func NewNoUnderscore() *analysis.Linter

func ReadLine

func ReadLine(path string, line int) string

Types

type BodyVariable added in v0.4.0

type BodyVariable struct {
	Name     string
	Position token.Pos
}

func GetVarFromBody added in v0.4.0

func GetVarFromBody(block *ast.BlockStmt) []BodyVariable

type EmbeddedFields added in v0.8.0

type EmbeddedFields struct {
	Name string
	Pos  token.Pos
	Tag  string
}

EmbeddedFields info about embedded fields.

type FuncComment

type FuncComment struct {
	Text     string
	Line     int
	Filename string
	IsDoc    bool
}

func GetCommentsByFunc

func GetCommentsByFunc(fn *ast.FuncDecl, fileComments []*ast.CommentGroup, fset *token.FileSet) []FuncComment

Jump to

Keyboard shortcuts

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