astutil

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package astutil contains shared, type-aware helpers for analysis passes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DisabledRulesInDomain

func DisabledRulesInDomain(domain string) []string

DisabledRulesInDomain returns calibrated-off rule IDs in domain order.

func ExprStmtCall

func ExprStmtCall(n ast.Node) (*ast.CallExpr, bool)

ExprStmtCall extracts a call expression from an expression statement.

func FilesScanned

func FilesScanned(pkgs []*packages.Package) int

FilesScanned counts unique compiled files across packages.

func FuncName

func FuncName(decl *ast.FuncDecl) string

FuncName returns a stable function or method name.

func IsMethodOn

func IsMethodOn(pass *analysis.Pass, call *ast.CallExpr, pkgPath, typeName, methodName string) bool

IsMethodOn reports whether call resolves to a method on the named type.

func IsPkgFunc

func IsPkgFunc(pass *analysis.Pass, call *ast.CallExpr, pkgPath, name string) bool

IsPkgFunc reports whether call resolves to a package-level function.

func RegisterDisabledRule

func RegisterDisabledRule(rule, name string, severity finding.Severity, reason string)

RegisterDisabledRule records a calibrated rule without exposing or emitting it.

func RegisterRule

func RegisterRule(rule, name string, severity finding.Severity)

RegisterRule registers one domain rule and panics on conflicting metadata.

func Report

func Report(pass *analysis.Pass, pos token.Pos, rule, tmpl string, args ...any)

Report emits a diagnostic with validated rule metadata.

func RuleName

func RuleName(rule string) string

RuleName returns the registered display name for rule.

func RuleSeverity

func RuleSeverity(rule string) finding.Severity

RuleSeverity returns the registered severity for rule.

func RulesInDomain

func RulesInDomain(domain string) []string

RulesInDomain returns registered rule IDs in domain order.

func StringLit

func StringLit(e ast.Expr) (string, bool)

StringLit decodes a literal string expression.

func TypeString

func TypeString(pass *analysis.Pass, e ast.Expr) string

TypeString returns the type-checker's string form for e.

Types

This section is empty.

Jump to

Keyboard shortcuts

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