base

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 11, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package base holds the rule scaffolding types embedded by every rule implementation: BaseRule (name/ruleset/severity/description metadata and the Finding emit-helper), FlatDispatchBase (marker for flat-dispatch rules), and LineBase (marker for line-pass rules).

This package exists so domain-specific rule subpackages (internal/rules/<domain>/) can embed these types without importing the main rules package — which would create a cycle, since rules imports the subpackages for side-effect registration.

Anything that lives outside the rule struct itself (config glue, exclude matching, registry plumbing) stays in the rules package, not here.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseRule

type BaseRule struct {
	RuleName    string
	RuleSetName string
	Sev         string
	Desc        string
}

BaseRule provides common fields embedded in every rule implementation. It carries the canonical name/ruleset/severity/description metadata and the Finding helper that rules use to construct emit-boundary scanner.Finding values.

The name intentionally stutters as base.BaseRule — the parent rules package re-exports it via `type BaseRule = base.BaseRule`, and renaming here would break every embed and literal in the codebase (hundreds of sites) without changing the rule scaffolding semantics.

func (BaseRule) Description

func (b BaseRule) Description() string

func (BaseRule) Finding

func (b BaseRule) Finding(file *scanner.File, line, col int, msg string) scanner.Finding

Finding constructs a scanner.Finding pre-populated with the rule's identity. Callers fill the message and any fix. line and col are 1-indexed.

func (BaseRule) Name

func (b BaseRule) Name() string

func (BaseRule) RuleSet

func (b BaseRule) RuleSet() string

func (BaseRule) Severity

func (b BaseRule) Severity() string

type FlatDispatchBase

type FlatDispatchBase struct{}

FlatDispatchBase is embedded by flat-dispatch rule implementations.

type LineBase

type LineBase struct{}

LineBase is embedded by line-rule implementations.

Jump to

Keyboard shortcuts

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