GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||
GeezerVison is showing github.com — feat(res-to-affine): walker parity for raw-js, untyped-exception, mutable-global (Phase 2c, Refs #57) by hyperpolymath · Pull Request #385 · hyperpolymath/affinescript Conversation
Owner
SummaryBrings the tree-sitter AST walker (Phase 2b, #322) to feature parity with the Phase-1 line-regex scanner across all four anti-patterns. Walker and scanner now emit the same
New walker detectors
Shared helper Phase 2c follow-ups remaining (not in this PR)
Test plan
Refs #57 (multi-phase; this is Phase 2c parity port). 🤖 Generated with Claude Code
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions…able-global (Phase 2c, Refs #57) Brings the tree-sitter AST walker (Phase 2b, #322) to feature parity with the Phase-1 line-regex scanner across all four anti-patterns. Walker and scanner now emit the same (kind, line) pairs on the synthetic fixture, locked in by a new `walker / scanner parity` alcotest. New walker detectors: - `raw_js` — extension_expression whose extension_identifier is "raw" or "bs.raw". Reaches inside ERROR subtrees so the older `[%bs.raw ...]` syntax (which the pinned grammar can't parse cleanly) is still flagged. - `untyped_exception` — three structural triggers: 1. any try_expression (try/catch block); 2. value_identifier_path OR module_identifier_path whose surface text starts with `Js.Exn` or `Promise.catch` (catches the path in both expression and pattern position — line 22 of sample.res `| Js.Exn.Error(_) =>` is the latter); 3. call_expression whose function child is the bare identifier `raise`. - `mutable_global` — mutation_expression that lives directly inside an expression_statement at module top level (ancestor chain is `expression_statement :: source_file` or `expression_statement :: block :: module_declaration`). In-function `x := y` against a local ref is correctly NOT flagged — the structurally-stronger version of the column-0 regex anchor introduced in #319. Shared helper `push_finding` consolidates the slice/trim/truncate/cons boilerplate that all four detectors now use. The DFS is one pass with all detectors invoked per node. Phase 2c follow-ups remaining (not in this PR): - Two anti-patterns deferred from Phase 1 (inline lambda callback records, oversized 4+ tuple matches) — both need new Scanner.kind variants and emitter guidance. - Flipping the CLI default from --engine=scanner to --engine=walker (a behavior change deserving its own PR). - The two precision-pass deferrals in CORPUS-RUN.md (module-block nested side effects, top-level `let x = ref(...)` declarations). Test plan: - `dune build tools/res-to-affine` clean. - `dune test tools/res-to-affine/` — 9/9 (3 existing emitter + 6 walker cases, 4 of them new in this PR). - `dune build` + `dune test` clean repo-wide (327/327 tests pass). - Spot-checked end-to-end: walker emits 6 findings on sample.res, same (kind, line) set as scanner. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
hyperpolymath
enabled auto-merge (squash)
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. Uh oh!
There was an error while loading. Please reload this page.
This was referenced
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ReviewersNo reviewsUh oh!
There was an error while loading. Please reload this page. AssigneesNo one assignedLabels
None yet
ProjectsMilestoneNo milestoneDevelopmentSuccessfully merging this pull request may close these issues. Uh oh!
There was an error while loading. Please reload this page. 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. | |||||||||||||||||||||||||||||
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |