fix: implement refactoring_opportunity_finder API (#210) #221
Reference in New Issue
Block a user
Delete Branch "burn/210-1776305000"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Fixes
scripts/refactoring_opportunity_finder.py— the test file importscompute_file_complexity,calculate_refactoring_score, andFileMetrics, but the script only had a stubgenerate_proposals().Implementation
compute_file_complexity(filepath)— AST-based cyclomatic complexity analysis. Returns(avg_complexity, max_complexity, function_count, class_count, line_count). Handles syntax errors gracefully (returns zeros).calculate_refactoring_score(metrics)— Weighted scoring (0-100):FileMetrics— Dataclass with all required fields.generate_proposals()— Scans directories, computes metrics, filters by score threshold.Test Results
Also added
.gitignorefor__pycache__/.Closes #210