Documentation
¶
Index ¶
- Constants
- func AllProfiles() []string
- func AllowedProfile(p string) bool
- func DelegatesToShared(ruleID string) bool
- func EnableUnderProfile(p Profile, id string)
- func NormalizeOption(option Option, value any) (any, error)
- type AnalysisLevel
- type Context
- func (ctx *Context) Assignments(function *parser.Node) []*parser.Node
- func (ctx *Context) Callbacks() map[string]api.Callback
- func (ctx *Context) Constant(node *parser.Node) (int64, bool)
- func (ctx *Context) Constants() map[string]api.Constant
- func (ctx *Context) Eval(node *parser.Node) (int64, bool)
- func (ctx *Context) ExpressionTag(node *parser.Node) (string, bool)
- func (ctx *Context) ExpressionTags(node *parser.Node) []string
- func (ctx *Context) FunctionEffects(declaration project.Declaration) (project.FunctionEffects, bool)
- func (ctx *Context) FunctionSymbols(function *parser.Node) []*semantic.Symbol
- func (ctx *Context) Functions() map[string]api.Function
- func (ctx *Context) Natives() map[string]api.Native
- func (ctx *Context) Pure(node *parser.Node) bool
- func (ctx *Context) PureCall(call *parser.Node) (string, bool)
- type Engine
- type File
- type Metadata
- type Option
- type OptionType
- type Profile
- type Registrar
- func (reg *Registrar) Aliases() []RuleAlias
- func (reg *Registrar) All() []Metadata
- func (reg *Registrar) EnabledForProfile(p Profile) (enabled map[string]diagnostic.Severity)
- func (reg *Registrar) IDs() []string
- func (reg *Registrar) Lookup(id string) (Metadata, bool)
- func (reg *Registrar) MustRegister(r Rule)
- func (reg *Registrar) MustRegisterAlias(deprecated, replacement string)
- func (reg *Registrar) Register(r Rule) error
- func (reg *Registrar) RegisterAlias(deprecated, replacement string) error
- func (reg *Registrar) ResolveID(id string) (string, bool, bool)
- func (reg *Registrar) Rule(id string) (Rule, bool)
- func (reg *Registrar) Sorted() []Metadata
- type Requirements
- type Rule
- type RuleAlias
- type RuleScope
- type Stability
- type TimingEvent
- type TimingStage
Constants ¶
View Source
const DeprecatedRuleID = "deprecated-rule-id"
View Source
const InternalErrorID = "internal-error"
View Source
const ParseErrorID = "parse-error"
View Source
const SuppressionID = "unknown-suppression"
Variables ¶
This section is empty.
Functions ¶
func AllProfiles ¶
func AllProfiles() []string
func AllowedProfile ¶
func DelegatesToShared ¶ added in v1.5.0
DelegatesToShared reports rules owned by pawn-analysis in editor runs.
func EnableUnderProfile ¶
Types ¶
type AnalysisLevel ¶
type AnalysisLevel uint8
const ( SyntaxAnalysis AnalysisLevel = iota SemanticAnalysis ControlFlowAnalysis ProjectAnalysis )
type Context ¶
type Context struct {
File *File
Report func(diagnostic.Diagnostic)
Level AnalysisLevel
Walk *walk.Model
Tokens func(k token.Kind) []*token.Token
Supp []suppress.Directive
Known map[string]struct{}
PerRule map[string]map[string]any
Semantic *semantic.Model
Flow *controlflow.Model
Project *project.Model
ProjectFile *project.File
Target string
API *api.Metadata
// contains filtered or unexported fields
}
func (*Context) Assignments ¶ added in v1.3.0
func (*Context) FunctionEffects ¶ added in v1.8.0
func (ctx *Context) FunctionEffects(declaration project.Declaration) (project.FunctionEffects, bool)
func (*Context) FunctionSymbols ¶ added in v1.3.0
type Engine ¶
type Engine struct {
Reg *Registrar
Defines []string
Target string
Project *project.Model
API *api.Metadata
ObserveTiming func(TimingEvent)
Context context.Context
}
func (*Engine) LintFile ¶
func (e *Engine) LintFile(path string, src []byte, maxLevel AnalysisLevel, ruleSet map[string]diagnostic.Severity, known map[string]struct{}, perRule map[string]map[string]any) []diagnostic.Diagnostic
func (*Engine) LintProjectFile ¶
func (e *Engine) LintProjectFile(projectFile *project.File, maxLevel AnalysisLevel, ruleSet map[string]diagnostic.Severity, known map[string]struct{}, perRule map[string]map[string]any) []diagnostic.Diagnostic
type Metadata ¶
type Metadata struct {
ID string
Name string
Summary string
Explanation string
Category diagnostic.Category
DefaultSeverity diagnostic.Severity
AnalysisLevel AnalysisLevel
Requirements Requirements
Scope RuleScope
Stability Stability
DefaultEnabled bool
Fixable bool
UnsafeFix bool
Tags []string
Options []Option
ConfigExample string
}
type OptionType ¶
type OptionType uint8
const ( OptionBoolean OptionType = iota OptionInteger OptionString OptionStringList OptionObjectList )
func (OptionType) String ¶
func (t OptionType) String() string
type Registrar ¶
type Registrar struct {
// contains filtered or unexported fields
}
func NewRegistrar ¶
func NewRegistrar() *Registrar
func (*Registrar) EnabledForProfile ¶
func (reg *Registrar) EnabledForProfile(p Profile) (enabled map[string]diagnostic.Severity)
func (*Registrar) MustRegister ¶
func (*Registrar) MustRegisterAlias ¶
func (*Registrar) RegisterAlias ¶
type Requirements ¶ added in v1.2.0
type Requirements uint16
const ( NeedSyntax Requirements = 1 << iota NeedPreprocessor NeedLocalSymbols NeedNames NeedTags NeedConstants NeedControlFlow NeedAPI NeedWorkspace )
func (Requirements) Has ¶ added in v1.2.0
func (r Requirements) Has(requirement Requirements) bool
type TimingEvent ¶
type TimingEvent struct {
Stage TimingStage
RuleID string
Duration time.Duration
}
type TimingStage ¶
type TimingStage string
const ( TimingParse TimingStage = "parse" TimingSemantic TimingStage = "semantic" TimingControlFlow TimingStage = "control-flow" TimingRule TimingStage = "rule" )
Source Files
¶
Click to show internal directories.
Click to hide internal directories.