Documentation
¶
Index ¶
- func FormatBreakingChangeReport(report *BreakingChangeReport) string
- func FormatImpactReport(impact *FileImpact) string
- func IsBreaking(report *BreakingChangeReport) bool
- type BreakingChange
- type BreakingChangeDetector
- type BreakingChangeReport
- type BreakingChangeType
- type FileImpact
- type Impact
- type ImpactAnalyzer
- func (a *ImpactAnalyzer) AnalyzeImpact(oldContent, newContent, filename string) (*FileImpact, error)
- func (a *ImpactAnalyzer) FindSymbol(name string) []Symbol
- func (a *ImpactAnalyzer) GetDependents(filename string) []string
- func (a *ImpactAnalyzer) GetSymbolReferences(symbolName string) []Reference
- func (a *ImpactAnalyzer) GetSymbolsInFile(filename string) []Symbol
- func (a *ImpactAnalyzer) IndexFile(filename string, content string) error
- type Language
- type Parser
- type Reference
- type Symbol
- type SymbolKind
- type SymbolTable
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatBreakingChangeReport ¶
func FormatBreakingChangeReport(report *BreakingChangeReport) string
FormatBreakingChangeReport generates a formatted report for PR comments
func FormatImpactReport ¶
func FormatImpactReport(impact *FileImpact) string
FormatImpactReport generates a human-readable impact report
func IsBreaking ¶
func IsBreaking(report *BreakingChangeReport) bool
IsBreaking returns true if the change is a breaking change (not just a warning)
Types ¶
type BreakingChange ¶
type BreakingChange struct {
Type BreakingChangeType `json:"type"`
Symbol Symbol `json:"symbol"`
OldValue string `json:"old_value,omitempty"`
NewValue string `json:"new_value,omitempty"`
FilePath string `json:"file_path"`
Line int `json:"line"`
Severity string `json:"severity"` // "warning", "error", "critical"
Description string `json:"description"`
Suggestion string `json:"suggestion,omitempty"`
}
BreakingChange represents a single breaking change
func GetBreakingChanges ¶
func GetBreakingChanges(report *BreakingChangeReport) []BreakingChange
GetBreakingChanges returns only the breaking changes (critical and error)
type BreakingChangeDetector ¶
type BreakingChangeDetector struct {
// contains filtered or unexported fields
}
BreakingChangeDetector detects breaking API changes
func NewBreakingChangeDetector ¶
func NewBreakingChangeDetector() *BreakingChangeDetector
NewBreakingChangeDetector creates a new breaking change detector
func (*BreakingChangeDetector) DetectBreakingChanges ¶
func (d *BreakingChangeDetector) DetectBreakingChanges(oldContent, newContent, filename string) (*BreakingChangeReport, error)
DetectBreakingChanges compares old and new code to find breaking changes
type BreakingChangeReport ¶
type BreakingChangeReport struct {
FileName string `json:"file_name"`
TotalChanges int `json:"total_changes"`
CriticalCount int `json:"critical_count"`
ErrorCount int `json:"error_count"`
WarningCount int `json:"warning_count"`
Changes []BreakingChange `json:"changes"`
Summary string `json:"summary"`
HasBreaking bool `json:"has_breaking"`
}
BreakingChangeReport contains all detected breaking changes
type BreakingChangeType ¶
type BreakingChangeType string
BreakingChangeType represents different types of breaking changes
const ( BreakingRemoval BreakingChangeType = "removal" BreakingSignatureChange BreakingChangeType = "signature_change" BreakingTypeChange BreakingChangeType = "type_change" BreakingVisibilityChange BreakingChangeType = "visibility_change" BreakingParameterChange BreakingChangeType = "parameter_change" BreakingReturnTypeChange BreakingChangeType = "return_type_change" BreakingRequiredParameter BreakingChangeType = "required_parameter" BreakingBehaviorChange BreakingChangeType = "behavior_change" )
type FileImpact ¶
type FileImpact struct {
FilePath string `json:"file_path"`
ChangedSymbols []Symbol `json:"changed_symbols"`
Impacts []Impact `json:"impacts"`
TotalReferences int `json:"total_references"`
AffectedFiles []string `json:"affected_files"`
OverallSeverity string `json:"overall_severity"`
}
FileImpact represents the impact analysis for a changed file
type Impact ¶
type Impact struct {
ChangedSymbol Symbol `json:"changed_symbol"`
AffectedFiles []string `json:"affected_files"`
AffectedSymbols []Symbol `json:"affected_symbols"`
References []Reference `json:"references"`
Severity string `json:"severity"` // "low", "medium", "high", "critical"
Description string `json:"description"`
}
Impact represents the impact of changing a symbol
type ImpactAnalyzer ¶
type ImpactAnalyzer struct {
// contains filtered or unexported fields
}
ImpactAnalyzer analyzes cross-file impact of code changes
func NewImpactAnalyzer ¶
func NewImpactAnalyzer() *ImpactAnalyzer
NewImpactAnalyzer creates a new impact analyzer
func (*ImpactAnalyzer) AnalyzeImpact ¶
func (a *ImpactAnalyzer) AnalyzeImpact(oldContent, newContent, filename string) (*FileImpact, error)
AnalyzeImpact analyzes the impact of changes in a diff
func (*ImpactAnalyzer) FindSymbol ¶
func (a *ImpactAnalyzer) FindSymbol(name string) []Symbol
FindSymbol finds a symbol by name
func (*ImpactAnalyzer) GetDependents ¶
func (a *ImpactAnalyzer) GetDependents(filename string) []string
GetDependents returns files that depend on the given file
func (*ImpactAnalyzer) GetSymbolReferences ¶
func (a *ImpactAnalyzer) GetSymbolReferences(symbolName string) []Reference
GetSymbolReferences returns all references to a symbol
func (*ImpactAnalyzer) GetSymbolsInFile ¶
func (a *ImpactAnalyzer) GetSymbolsInFile(filename string) []Symbol
GetSymbolsInFile returns all symbols in a file
type Language ¶
type Language string
Language represents a supported programming language
func DetectLanguage ¶
DetectLanguage determines the language from file extension
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
Parser extracts symbols from source code
func (*Parser) GetLanguageFromFilename ¶
GetLanguageFromFilename returns the language name as a string
type Reference ¶
type Reference struct {
FilePath string `json:"file_path"`
Line int `json:"line"`
Context string `json:"context"` // The line content
}
Reference represents a reference to a symbol
type Symbol ¶
type Symbol struct {
Name string `json:"name"`
Kind SymbolKind `json:"kind"`
StartLine int `json:"start_line"`
EndLine int `json:"end_line"`
Signature string `json:"signature,omitempty"`
Exported bool `json:"exported"`
Parameters []string `json:"parameters,omitempty"`
ReturnType string `json:"return_type,omitempty"`
Parent string `json:"parent,omitempty"` // For methods: the receiver type
FilePath string `json:"file_path"`
}
Symbol represents a code symbol (function, class, variable, etc.)
type SymbolKind ¶
type SymbolKind string
SymbolKind represents the type of symbol
const ( SymbolFunction SymbolKind = "function" SymbolMethod SymbolKind = "method" SymbolClass SymbolKind = "class" SymbolInterface SymbolKind = "interface" SymbolStruct SymbolKind = "struct" SymbolVariable SymbolKind = "variable" SymbolConstant SymbolKind = "constant" SymbolType SymbolKind = "type" SymbolImport SymbolKind = "import" )
type SymbolTable ¶
type SymbolTable struct {
Symbols map[string][]Symbol // symbol name -> symbols (can have multiple with same name)
ByFile map[string][]Symbol // file path -> symbols in that file
References map[string][]Reference // symbol name -> references to it
}
SymbolTable stores all symbols across the codebase