rules

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ArchitectureComplexityRule added in v0.3.1

type ArchitectureComplexityRule struct{}

ArchitectureComplexityRule checks for overly complex packages

func (ArchitectureComplexityRule) Category added in v0.3.1

func (ArchitectureComplexityRule) Description added in v0.3.1

func (ArchitectureComplexityRule) Description() string

func (ArchitectureComplexityRule) ID added in v0.3.1

func (ArchitectureComplexityRule) Name added in v0.3.1

func (ArchitectureComplexityRule) Run added in v0.3.1

func (ArchitectureComplexityRule) Severity added in v0.3.1

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 ConfigValidationRule added in v0.3.0

type ConfigValidationRule struct{}

ConfigValidationRule validates project configuration.

func (ConfigValidationRule) Category added in v0.3.0

func (ConfigValidationRule) Category() string

func (ConfigValidationRule) Description added in v0.3.0

func (ConfigValidationRule) Description() string

func (ConfigValidationRule) ID added in v0.3.0

func (ConfigValidationRule) Name added in v0.3.0

func (ConfigValidationRule) Run added in v0.3.0

func (ConfigValidationRule) Severity added in v0.3.0

type ConfigurationLintRule added in v0.3.1

type ConfigurationLintRule struct{}

ConfigurationLintRule checks for common configuration issues

func (ConfigurationLintRule) Category added in v0.3.1

func (ConfigurationLintRule) Category() string

func (ConfigurationLintRule) Description added in v0.3.1

func (ConfigurationLintRule) Description() string

func (ConfigurationLintRule) ID added in v0.3.1

func (ConfigurationLintRule) Name added in v0.3.1

func (ConfigurationLintRule) Run added in v0.3.1

func (ConfigurationLintRule) Severity added in v0.3.1

type Context

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

Context carries shared state for rule evaluation.

type DependenciesRule added in v0.3.0

type DependenciesRule struct{}

DependenciesRule checks Go module dependencies.

func (DependenciesRule) Category added in v0.3.0

func (DependenciesRule) Category() string

func (DependenciesRule) Description added in v0.3.0

func (DependenciesRule) Description() string

func (DependenciesRule) ID added in v0.3.0

func (DependenciesRule) ID() string

func (DependenciesRule) Name added in v0.3.0

func (DependenciesRule) Name() string

func (DependenciesRule) Run added in v0.3.0

func (DependenciesRule) Severity added in v0.3.0

func (DependenciesRule) Severity() report.Severity

type DockerBestPracticesRule added in v0.3.1

type DockerBestPracticesRule struct{}

DockerBestPracticesRule checks Docker configuration best practices

func (DockerBestPracticesRule) Category added in v0.3.1

func (DockerBestPracticesRule) Category() string

func (DockerBestPracticesRule) Description added in v0.3.1

func (DockerBestPracticesRule) Description() string

func (DockerBestPracticesRule) ID added in v0.3.1

func (DockerBestPracticesRule) Name added in v0.3.1

func (DockerBestPracticesRule) Run added in v0.3.1

func (DockerBestPracticesRule) Severity added in v0.3.1

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) Run(_ context.Context, rctx Context) ([]report.Finding, error)

func (DockerRule) Severity

func (DockerRule) Severity() report.Severity

type DocumentationCompletenessRule added in v0.3.1

type DocumentationCompletenessRule struct{}

DocumentationCompletenessRule checks documentation completeness

func (DocumentationCompletenessRule) Category added in v0.3.1

func (DocumentationCompletenessRule) Description added in v0.3.1

func (DocumentationCompletenessRule) Description() string

func (DocumentationCompletenessRule) ID added in v0.3.1

func (DocumentationCompletenessRule) Name added in v0.3.1

func (DocumentationCompletenessRule) Run added in v0.3.1

func (DocumentationCompletenessRule) Severity added in v0.3.1

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 FeaturesConsistencyRule added in v0.3.0

type FeaturesConsistencyRule struct{}

FeaturesConsistencyRule checks consistency of installed features.

func (FeaturesConsistencyRule) Category added in v0.3.0

func (FeaturesConsistencyRule) Category() string

func (FeaturesConsistencyRule) Description added in v0.3.0

func (FeaturesConsistencyRule) Description() string

func (FeaturesConsistencyRule) ID added in v0.3.0

func (FeaturesConsistencyRule) Name added in v0.3.0

func (FeaturesConsistencyRule) Run added in v0.3.0

func (FeaturesConsistencyRule) Severity added in v0.3.0

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 PostgreSQLRule added in v0.3.0

type PostgreSQLRule struct{}

PostgreSQLRule checks PostgreSQL connectivity and configuration.

func (PostgreSQLRule) Category added in v0.3.0

func (PostgreSQLRule) Category() string

func (PostgreSQLRule) Description added in v0.3.0

func (PostgreSQLRule) Description() string

func (PostgreSQLRule) ID added in v0.3.0

func (PostgreSQLRule) ID() string

func (PostgreSQLRule) Name added in v0.3.0

func (PostgreSQLRule) Name() string

func (PostgreSQLRule) Run added in v0.3.0

func (PostgreSQLRule) Severity added in v0.3.0

func (PostgreSQLRule) Severity() report.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 SecurityHardcodedIPRule added in v0.3.1

type SecurityHardcodedIPRule struct{}

SecurityHardcodedIPRule detects hardcoded IP addresses.

func (SecurityHardcodedIPRule) Category added in v0.3.1

func (SecurityHardcodedIPRule) Category() string

func (SecurityHardcodedIPRule) Description added in v0.3.1

func (SecurityHardcodedIPRule) Description() string

func (SecurityHardcodedIPRule) ID added in v0.3.1

func (SecurityHardcodedIPRule) Name added in v0.3.1

func (SecurityHardcodedIPRule) Run added in v0.3.1

func (SecurityHardcodedIPRule) Severity added in v0.3.1

type SecuritySQLInjectionRule added in v0.3.1

type SecuritySQLInjectionRule struct{}

func (SecuritySQLInjectionRule) Category added in v0.3.1

func (SecuritySQLInjectionRule) Category() string

func (SecuritySQLInjectionRule) Description added in v0.3.1

func (SecuritySQLInjectionRule) Description() string

func (SecuritySQLInjectionRule) ID added in v0.3.1

func (SecuritySQLInjectionRule) Name added in v0.3.1

func (SecuritySQLInjectionRule) Run added in v0.3.1

func (SecuritySQLInjectionRule) Severity added in v0.3.1

type SecuritySecretsRule

type SecuritySecretsRule struct{}

SecuritySecretsRule detects potential hardcoded secrets with reduced false positives.

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 SecurityWeakCryptoRule added in v0.3.1

type SecurityWeakCryptoRule struct{}

SecurityWeakCryptoRule detects weak cryptographic practices.

func (SecurityWeakCryptoRule) Category added in v0.3.1

func (SecurityWeakCryptoRule) Category() string

func (SecurityWeakCryptoRule) Description added in v0.3.1

func (SecurityWeakCryptoRule) Description() string

func (SecurityWeakCryptoRule) ID added in v0.3.1

func (SecurityWeakCryptoRule) Name added in v0.3.1

func (SecurityWeakCryptoRule) Run added in v0.3.1

func (SecurityWeakCryptoRule) Severity added in v0.3.1

type SecurityXSSRule added in v0.3.1

type SecurityXSSRule struct{}

SecurityXSSRule detects potential XSS vulnerabilities.

func (SecurityXSSRule) Category added in v0.3.1

func (SecurityXSSRule) Category() string

func (SecurityXSSRule) Description added in v0.3.1

func (SecurityXSSRule) Description() string

func (SecurityXSSRule) ID added in v0.3.1

func (SecurityXSSRule) ID() string

func (SecurityXSSRule) Name added in v0.3.1

func (SecurityXSSRule) Name() string

func (SecurityXSSRule) Run added in v0.3.1

func (SecurityXSSRule) Severity added in v0.3.1

func (SecurityXSSRule) Severity() report.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