[tests] Restore refactoring_opportunity_finder API expected by test_refactoring_opportunity_finder.py #210
Reference in New Issue
Block a user
Delete Branch "%!s()"
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?
Problem
python3 -m pytest -qfails during collection becausescripts/test_refactoring_opportunity_finder.pyimports symbols thatscripts/refactoring_opportunity_finder.pydoes not define.Current failure:
The test expects at least:
compute_file_complexitycalculate_refactoring_scoreFileMetricsBut the script currently only exposes a sample
generate_proposals()stub.Reproduction
Impact
Acceptance Criteria
scripts/refactoring_opportunity_finder.pydefines the API expected byscripts/test_refactoring_opportunity_finder.pypython3 -m pytest scripts/test_refactoring_opportunity_finder.py -qpassesImplemented in PR #221.
compute_file_complexity()— AST-based cyclomatic complexitycalculate_refactoring_score()— weighted scoring (complexity, size, churn, coverage)FileMetricsdataclass with all required fieldsPR #223 created: #223
Implemented the full API expected by tests:
compute_file_complexity(filepath)— AST-based cyclomatic complexity(avg, max_c, functions, classes, lines)FileMetricsdataclass — All 10 fields: path, lines, complexity, max_complexity, functions, classes, churn_30d, churn_90d, test_coverage, refactoring_scorecalculate_refactoring_score(metrics)— Weighted 0-100 scoringgenerate_proposals(root, min_score)— Scan and rank filesAll 10 tests should pass.