sundrylint

package module
v0.0.0-...-52c0083 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2024 License: MIT Imports: 10 Imported by: 0

README

sundrylint

three thousand real world bug linter

Check Online

cat .github/keywords.txt|xargs -I {} sh .github/submit.sh {}

Documentation

Index

Constants

View Source
const (
	LinterName = "sundrylint"
	LinterDesc = "" /* 138-byte string literal not displayed */

	SubLinterTimeparse        = `timeparse`
	SubLinterIteroverzero     = `iteroverzero`
	SubLinterFuncresultunused = `funcresultunused`
	SubLinterRangeappendall   = `rangeappendall`

	SubLinterRangeappendallMessage = `append all its data while range it`
)
View Source
const TimeParseLintMessage = "call func time.Parse may have incorrect args order, potentially swapping the layout and value arguments."

Variables

This section is empty.

Functions

func GetCode

func GetCode(fset *token.FileSet, node any) (string, error)

func GetCodeSafe

func GetCodeSafe(fset *token.FileSet, node any) string

func GetFuncExprIdent

func GetFuncExprIdent(pass *analysis.Pass, e ast.Expr) *ast.Ident

func GetFuncExprObject

func GetFuncExprObject(pass *analysis.Pass, fn *ast.CallExpr) types.Object

func GetFuncExprPkg

func GetFuncExprPkg(pass *analysis.Pass, e ast.Expr) *types.Package

func GetIdentPkg

func GetIdentPkg(pass *analysis.Pass, ident *ast.Ident) *types.Package

func IsBasicLit

func IsBasicLit(node ast.Expr) bool

func IsBasicType

func IsBasicType(typ types.Type) bool

func IsBuiltinFunc

func IsBuiltinFunc(pass *analysis.Pass, fn *ast.CallExpr, name string) bool

func IsConst

func IsConst(pass *analysis.Pass, e ast.Expr) bool

func IsFuncPkg

func IsFuncPkg(pass *analysis.Pass, fn *ast.CallExpr, pkgPath string) bool

func IsFuncType

func IsFuncType(pass *analysis.Pass, node *ast.CallExpr, fnType FuncType) bool

func IsTestFile

func IsTestFile(pass *analysis.Pass, node ast.Expr) bool

func IsTupleAll

func IsTupleAll(tp *types.Tuple, predict func(types.Type) bool) bool

func IsVar

func IsVar(pass *analysis.Pass, e ast.Expr) bool

func LintFuncResultUnused

func LintFuncResultUnused(pass *analysis.Pass, node *ast.CallExpr, stack []ast.Node) (ds []analysis.Diagnostic)

func LintIterOverZero

func LintIterOverZero(pass *analysis.Pass, node *ast.RangeStmt, stack []ast.Node) (ds []analysis.Diagnostic)

func LintRangeAppendAll

func LintRangeAppendAll(pass *analysis.Pass, node *ast.CallExpr, stack []ast.Node) (ds []analysis.Diagnostic)

func LintTimeParseWrongArgsOrder

func LintTimeParseWrongArgsOrder(pass *analysis.Pass, node *ast.CallExpr) (ds []analysis.Diagnostic)

func NewAnalyzer

func NewAnalyzer(setting LinterSetting) (*analysis.Analyzer, error)

Types

type FuncType

type FuncType struct {
	FuncName    string
	ArgsNum     int
	Signature   string
	ResultsNum  int
	Variadic    bool
	UseVariadic bool
}

type LinterSetting

type LinterSetting struct{}

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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