Ragex.Analysis.Suggestions.Patterns
(Ragex v0.3.0)
View Source
Pattern detection for common refactoring opportunities.
Detects 8 patterns:
- Extract Function - Long functions, duplicate code blocks
- Inline Function - Single-use functions, trivial wrappers
- Split Module - God modules, low cohesion
- Merge Modules - Similar modules, related functionality
- Remove Dead Code - Unused functions, unreachable code
- Reduce Coupling - High-coupling modules, circular dependencies
- Simplify Complexity - High cyclomatic complexity, deep nesting
- Extract Module - Related functions in different modules
Each detector returns suggestions with:
- Pattern type
- Confidence score (0.0-1.0)
- Target location
- Reason/justification
- Relevant metrics
Summary
Functions
Returns list of all available pattern types.
Detects a specific pattern in the analysis data.
Functions
Returns list of all available pattern types.
Detects a specific pattern in the analysis data.
Parameters
pattern- Pattern type to detectanalysis_data- Analysis data from Suggestions.gather_analysis_data/2opts- Additional options
Returns
{:ok, [suggestion]}- List of raw suggestions (not yet scored){:error, reason}- Error if detection fails