patterns

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package patterns provides architectural pattern detection in code graphs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AntiPattern

type AntiPattern struct {
	Type        string   `json:"type"`
	Severity    string   `json:"severity"` // high, medium, low
	Description string   `json:"description"`
	Nodes       []string `json:"nodes"`
	Suggestion  string   `json:"suggestion"`
}

AntiPattern represents a detected anti-pattern.

type ArchPattern

type ArchPattern struct {
	Type        string   `json:"type"`
	Name        string   `json:"name"`
	Description string   `json:"description"`
	Nodes       []string `json:"nodes"`
	Confidence  float64  `json:"confidence"`
	Location    string   `json:"location,omitempty"`
}

ArchPattern represents an architectural pattern instance.

type Detector

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

Detector identifies common architectural patterns in a code graph.

func NewDetector

func NewDetector(nodes []*graph.Node, edges []*graph.Edge) *Detector

NewDetector creates a new pattern detector.

func (*Detector) Detect

func (d *Detector) Detect() *PatternReport

Detect runs all pattern detection algorithms.

type PatternReport

type PatternReport struct {
	Architectural []ArchPattern   `json:"architectural"`
	Structural    []StructPattern `json:"structural"`
	AntiPatterns  []AntiPattern   `json:"anti_patterns"`
	Summary       PatternSummary  `json:"summary"`
}

PatternReport contains all detected patterns.

type PatternSummary

type PatternSummary struct {
	TotalPatterns    int            `json:"total_patterns"`
	ByType           map[string]int `json:"by_type"`
	AntiPatternCount int            `json:"anti_pattern_count"`
	HealthScore      float64        `json:"health_score"` // 0-100
}

PatternSummary provides aggregate statistics.

type StructPattern

type StructPattern struct {
	Type        string   `json:"type"`
	Description string   `json:"description"`
	Nodes       []string `json:"nodes"`
	Edges       int      `json:"edge_count"`
}

StructPattern represents a structural graph pattern.

Jump to

Keyboard shortcuts

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