rules

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ArchitectureRule

type ArchitectureRule struct {
	Rules []config.ArchitectureRule
}

ArchitectureRule checks layer import violations.

func (ArchitectureRule) Category

func (r ArchitectureRule) Category() string

func (ArchitectureRule) Description

func (r ArchitectureRule) Description() string

func (ArchitectureRule) ID

func (r ArchitectureRule) ID() string

func (ArchitectureRule) Name

func (r ArchitectureRule) Name() string

func (ArchitectureRule) Run

func (ArchitectureRule) Severity

func (r ArchitectureRule) Severity() report.Severity

type Context

type Context struct {
	ProjectRoot string
	Language    string
	GoVersion   string
	Extra       map[string]any
}

Context carries shared state for rule evaluation.

type DockerRule

type DockerRule struct{}

func (DockerRule) Category

func (DockerRule) Category() string

func (DockerRule) Description

func (DockerRule) Description() string

func (DockerRule) ID

func (DockerRule) ID() string

func (DockerRule) Name

func (DockerRule) Name() string

func (DockerRule) Run

func (DockerRule) Severity

func (DockerRule) Severity() report.Severity

type EnvFileRule

type EnvFileRule struct{}

func (EnvFileRule) Category

func (EnvFileRule) Category() string

func (EnvFileRule) Description

func (EnvFileRule) Description() string

func (EnvFileRule) ID

func (EnvFileRule) ID() string

func (EnvFileRule) Name

func (EnvFileRule) Name() string

func (EnvFileRule) Run

func (EnvFileRule) Severity

func (EnvFileRule) Severity() report.Severity

type GitRule

type GitRule struct{}

func (GitRule) Category

func (GitRule) Category() string

func (GitRule) Description

func (GitRule) Description() string

func (GitRule) ID

func (GitRule) ID() string

func (GitRule) Name

func (GitRule) Name() string

func (GitRule) Run

func (GitRule) Severity

func (GitRule) Severity() report.Severity

type GoModRule

type GoModRule struct{}

func (GoModRule) Category

func (GoModRule) Category() string

func (GoModRule) Description

func (GoModRule) Description() string

func (GoModRule) ID

func (GoModRule) ID() string

func (GoModRule) Name

func (GoModRule) Name() string

func (GoModRule) Run

func (GoModRule) Run(_ context.Context, rctx Context) ([]report.Finding, error)

func (GoModRule) Severity

func (GoModRule) Severity() report.Severity

type GoVersionRule

type GoVersionRule struct{}

func (GoVersionRule) Category

func (GoVersionRule) Category() string

func (GoVersionRule) Description

func (GoVersionRule) Description() string

func (GoVersionRule) ID

func (GoVersionRule) ID() string

func (GoVersionRule) Name

func (GoVersionRule) Name() string

func (GoVersionRule) Run

func (GoVersionRule) Severity

func (GoVersionRule) Severity() report.Severity

type GracefulShutdownRule

type GracefulShutdownRule struct{}

func (GracefulShutdownRule) Category

func (GracefulShutdownRule) Category() string

func (GracefulShutdownRule) Description

func (GracefulShutdownRule) Description() string

func (GracefulShutdownRule) ID

func (GracefulShutdownRule) Name

func (GracefulShutdownRule) Run

func (GracefulShutdownRule) Severity

type Registry

type Registry struct {
	// contains filtered or unexported fields
}

Registry holds ordered rules.

func AnalyzeRules

func AnalyzeRules(cfg configLoader) *Registry

func CheckRules

func CheckRules(cfg configLoader) *Registry

func DoctorRules

func DoctorRules() *Registry

func NewRegistry

func NewRegistry(rules ...Rule) *Registry

func (*Registry) Add

func (r *Registry) Add(rule Rule)

func (*Registry) Rules

func (r *Registry) Rules() []Rule

func (*Registry) Run

func (r *Registry) Run(ctx context.Context, rctx Context) ([]report.Finding, error)

type Rule

type Rule interface {
	ID() string
	Name() string
	Description() string
	Category() string
	Severity() report.Severity
	Run(ctx context.Context, rctx Context) ([]report.Finding, error)
}

Rule is a pluggable diagnostic rule.

type SecurityCORSRule

type SecurityCORSRule struct{}

SecurityCORSRule detects permissive CORS patterns in source.

func (SecurityCORSRule) Category

func (SecurityCORSRule) Category() string

func (SecurityCORSRule) Description

func (SecurityCORSRule) Description() string

func (SecurityCORSRule) ID

func (SecurityCORSRule) ID() string

func (SecurityCORSRule) Name

func (SecurityCORSRule) Name() string

func (SecurityCORSRule) Run

func (SecurityCORSRule) Severity

func (SecurityCORSRule) Severity() report.Severity

type SecuritySecretsRule

type SecuritySecretsRule struct{}

SecuritySecretsRule detects potential hardcoded secrets. Limit: heuristic only — many false positives possible on placeholders.

func (SecuritySecretsRule) Category

func (SecuritySecretsRule) Category() string

func (SecuritySecretsRule) Description

func (SecuritySecretsRule) Description() string

func (SecuritySecretsRule) ID

func (SecuritySecretsRule) Name

func (SecuritySecretsRule) Name() string

func (SecuritySecretsRule) Run

func (SecuritySecretsRule) Severity

func (SecuritySecretsRule) Severity() report.Severity

type SecuritySensitiveFilesRule

type SecuritySensitiveFilesRule struct{}

SecuritySensitiveFilesRule warns when sensitive files may be committed.

func (SecuritySensitiveFilesRule) Category

func (SecuritySensitiveFilesRule) Description

func (SecuritySensitiveFilesRule) Description() string

func (SecuritySensitiveFilesRule) ID

func (SecuritySensitiveFilesRule) Name

func (SecuritySensitiveFilesRule) Run

func (SecuritySensitiveFilesRule) Severity

type StaticConfigLoader

type StaticConfigLoader struct {
	Rules []config.ArchitectureRule
}

StaticConfigLoader wraps fixed rules for tests.

func (StaticConfigLoader) ArchitectureRules

func (s StaticConfigLoader) ArchitectureRules() []config.ArchitectureRule

Jump to

Keyboard shortcuts

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