Harden parser, speed up graph ops, add incremental cache#27
Merged
Conversation
LeTuR
enabled auto-merge (rebase)
July 11, 2026 10:42
Parser correctness: - Strip comments and triple-quoted strings before matching preload/load/ extends so commented-out or in-string references no longer create edges - Expand builtin class set to cut false "broken inheritance" edges Performance: - Lazily build a reverse-adjacency index for get_dependents (was O(V*E)) - Walk the project tree once, bucketing files by suffix - Convert Tarjan cycle detection to an iterative stack (no RecursionError) Design: - Share type_label/short_path/to_res_path helpers; drop the Patterns class - Dispatch formatters through a registry; escape DOT/Mermaid labels Features & robustness: - Incremental parse cache keyed by mtime+size (--cache/--cache-file) - Warn on unknown config keys and bad severity values - Surface duplicate class_name collisions; tolerate malformed project.godot and non-UTF-8 source files instead of aborting Adds 36 regression tests (176 total).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Correctness, performance, design, and robustness improvements across the analyzer, with 36 new regression tests (176 total, ruff clean).
Parser correctness
preload/load/extends— commented-out or in-string references no longer create phantom graph edges (which could manufacture false cycles/rule violations).Performance
get_dependentsnow uses a lazily-built reverse-adjacency index (was O(V·E) per call, quadratic in the orphan check).RecursionErroron deep chains.Design
type_label/short_path/to_res_pathhelpers; deleted the boilerplatePatternsclass; formatter registry; DOT/Mermaid label escaping.Features & robustness
--cache/--cache-file); symbol resolution and cycle detection always run fresh so output is identical to an uncached run.severityvalues.class_namecollisions surfaced as warnings; malformedproject.godotand non-UTF-8 files no longer abort the run.Test plan
uv run pytest→ 176 passed (36 new: parser edge cases, cache hit/miss/invalidation, dependents index, deep-graph cycles, scanner, output escaping, symbol collisions, malformed input, config semantics).uv run ruff check .→ clean.