fix: 3 syntax errors blocking pytest collection (#212, #211, #210) #224

Open
Rockachopa wants to merge 5 commits from fix/212-dependency-graph-dot-quoting into main
Owner

Closes #212, #211, #210

Three syntax bugs were blocking pytest collection in compounding-intelligence. All three fixed.

#212: dependency_graph.py — invalid quoting in DOT renderer

to_dot() used unescaped double quotes inside Python string literals:

# before
lines.append("  node [shape=box, style=filled, fillcolor=\"#1a1a2e\", fontcolor=\"#e6edf3\"];")
# after
lines.append('  node [shape=box, style=filled, fillcolor="#1a1a2e", fontcolor="#e6edf3"];')

Switched to single-quoted outer strings so inner double quotes don't conflict.

#211: perf_bottleneck_finder.py — 3 syntax errors

  1. Regex quoting (L116): r"open\\([^)]*['\\"]w['\\"]\" — raw string with \" doesn't escape. Split into two separate patterns.
  2. Literal newline in string (L510): return "\\n".join(lines) had a real newline byte instead of \\n. Fixed.
  3. Global declaration order (L524): global SLOW_TEST_THRESHOLD_S was after first use. Moved to top of main().

#210: refactoring_opportunity_finder.py — missing API

Test expected compute_file_complexity(), calculate_refactoring_score(), FileMetrics but script only had a stub. Implemented:

  • compute_file_complexity(filepath) — AST-based cyclomatic complexity analysis
  • FileMetrics dataclass — path, lines, complexity, churn, coverage, etc.
  • calculate_refactoring_score(metrics) — 0-100 priority score from complexity + size + churn + coverage + structure

Verification

python3 -m py_compile scripts/dependency_graph.py      # PASS
python3 -m py_compile scripts/perf_bottleneck_finder.py # PASS
python3 -m py_compile scripts/refactoring_opportunity_finder.py # PASS
Closes #212, #211, #210 Three syntax bugs were blocking `pytest` collection in compounding-intelligence. All three fixed. ## #212: dependency_graph.py — invalid quoting in DOT renderer `to_dot()` used unescaped double quotes inside Python string literals: ```python # before lines.append(" node [shape=box, style=filled, fillcolor=\"#1a1a2e\", fontcolor=\"#e6edf3\"];") # after lines.append(' node [shape=box, style=filled, fillcolor="#1a1a2e", fontcolor="#e6edf3"];') ``` Switched to single-quoted outer strings so inner double quotes don't conflict. ## #211: perf_bottleneck_finder.py — 3 syntax errors 1. **Regex quoting** (L116): `r"open\\([^)]*['\\"]w['\\"]\"` — raw string with `\"` doesn't escape. Split into two separate patterns. 2. **Literal newline in string** (L510): `return "\\n".join(lines)` had a real newline byte instead of `\\n`. Fixed. 3. **Global declaration order** (L524): `global SLOW_TEST_THRESHOLD_S` was after first use. Moved to top of `main()`. ## #210: refactoring_opportunity_finder.py — missing API Test expected `compute_file_complexity()`, `calculate_refactoring_score()`, `FileMetrics` but script only had a stub. Implemented: - `compute_file_complexity(filepath)` — AST-based cyclomatic complexity analysis - `FileMetrics` dataclass — path, lines, complexity, churn, coverage, etc. - `calculate_refactoring_score(metrics)` — 0-100 priority score from complexity + size + churn + coverage + structure ## Verification ```bash python3 -m py_compile scripts/dependency_graph.py # PASS python3 -m py_compile scripts/perf_bottleneck_finder.py # PASS python3 -m py_compile scripts/refactoring_opportunity_finder.py # PASS ```
Rockachopa added 5 commits 2026-04-21 11:35:29 +00:00
Owner

🚫 Cannot merge PR #224 - Merge failed. Reason:

🚫 Cannot merge PR #224 - **Merge failed**. Reason:
Author
Owner

🔎 Merge sweep 2026-04-21: not merging this PR in the current sweep. Blocked by merge conflicts / non-mergeable branch state against main. Rebase/refresh onto the base branch and rerun checks.

🔎 Merge sweep 2026-04-21: not merging this PR in the current sweep. Blocked by merge conflicts / non-mergeable branch state against `main`. Rebase/refresh onto the base branch and rerun checks.
Rockachopa reviewed 2026-04-22 13:52:56 +00:00
Rockachopa left a comment
Author
Owner

Changes suggested — 3 file(s), +114/-13 lines.

Duplicate PR: Duplicate — multiple PRs fix same syntax error (#211). Keep only the most complete.

**Changes suggested** — 3 file(s), +114/-13 lines. **Duplicate PR:** Duplicate — multiple PRs fix same syntax error (#211). Keep only the most complete.
Rockachopa reviewed 2026-04-22 13:55:49 +00:00
Rockachopa left a comment
Author
Owner

Bundles 3 unrelated changes: perf_bottleneck_finder syntax fix (#211), dependency_graph quote fix (#212), and refactoring_opportunity_finder implementation (#210). Should be split into separate PRs.

The syntax fix is a duplicate of #226 and 5 others. The refactoring finder is a duplicate of #223 and #222.

Recommendation: Close this PR. Merge #226 for #211, and #223 for #210.

Bundles 3 unrelated changes: perf_bottleneck_finder syntax fix (#211), dependency_graph quote fix (#212), and refactoring_opportunity_finder implementation (#210). Should be split into separate PRs. The syntax fix is a duplicate of #226 and 5 others. The refactoring finder is a duplicate of #223 and #222. **Recommendation:** Close this PR. Merge #226 for #211, and #223 for #210.
Rockachopa reviewed 2026-04-22 14:14:19 +00:00
Rockachopa left a comment
Author
Owner

Verdict: REQUEST_CHANGES -- DUPLICATE. One of 7 PRs fixing perf_bottleneck_finder.py SyntaxError (issue #211). This PR also fixes dependency_graph.py quote escaping and adds a full refactoring_opportunity_finder.py implementation, making it larger in scope than the other duplicates. The perf_bottleneck_finder fix splits the problematic regex into two separate patterns which works but is less elegant than #226. The refactoring_opportunity_finder work should be extracted to its own PR. Also duplicates with #222 and #223 on refactoring_opportunity_finder.

Verdict: REQUEST_CHANGES -- DUPLICATE. One of 7 PRs fixing perf_bottleneck_finder.py SyntaxError (issue #211). This PR also fixes dependency_graph.py quote escaping and adds a full refactoring_opportunity_finder.py implementation, making it larger in scope than the other duplicates. The perf_bottleneck_finder fix splits the problematic regex into two separate patterns which works but is less elegant than #226. The refactoring_opportunity_finder work should be extracted to its own PR. Also duplicates with #222 and #223 on refactoring_opportunity_finder.
claude reviewed 2026-04-22 16:14:19 +00:00
claude left a comment
Member

Fixes syntax errors across three files plus implements the refactoring opportunity finder. The scope is larger than needed for the syntax fix. The refactoring finder implementation is solid (AST complexity visitor, weighted scoring, file metrics). However, this bundles bug fixes with new features. Consider splitting: merge #226 for the syntax fixes and submit the refactoring finder as a separate PR.

Fixes syntax errors across three files plus implements the refactoring opportunity finder. The scope is larger than needed for the syntax fix. The refactoring finder implementation is solid (AST complexity visitor, weighted scoring, file metrics). However, this bundles bug fixes with new features. Consider splitting: merge #226 for the syntax fixes and submit the refactoring finder as a separate PR.
Some checks failed
Test / pytest (pull_request) Failing after 24s
This pull request has changes conflicting with the target branch.
  • scripts/perf_bottleneck_finder.py
  • scripts/refactoring_opportunity_finder.py
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin fix/212-dependency-graph-dot-quoting:fix/212-dependency-graph-dot-quoting
git checkout fix/212-dependency-graph-dot-quoting
Sign in to join this conversation.