Rust: Implement herb-analysis crate based on Rubydex - #1993
Draft
marcoroth wants to merge 7 commits into
Draft
Conversation
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> Signed-off-by: Marco Roth <marco.roth@intergga.ch>
🌿 Interactive Playground and Documentation PreviewA preview deployment has been built for this pull request. Try out the changes live in the interactive playground: 🌱 Grown from commit |
commit: |
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.
This pull request adds an exploratory
herb-analysiscrate that evaluates rubydex as a backend for Herb's cross-file static analysis. This crate is currently considered a spike. It is markedpublish = falseand might be folded, deleted, or moved into another part of the codebase.Motivation
#1667 implements Action View template dependency analysis in Ruby. Its weakest part is helper and constant resolution:
scan_helpers!flat-scans everydefinapp/helpers/**/*.rb, so it misses gem-provided helpers likepagy_navandturbo_frame_tag, misses helpers reaching the view through included concerns, and records constants as a naive"#{receiver}.#{name}"with no namespace resolution. That drives theunknown_callswarnings.The question worth answering is what rubydex enables in Rust rather than in Ruby.
What it does
The crate wraps rubydex's ID-based
GraphAPI and exposes the experiments as subcommands:helpersreconstructs everything a template in an arbitrary Rails app can call, grouped by origin. It resolves gems fromGemfile.lockacross all three source types (registry, git checkouts including monorepo subdirectories, and path sources), discovers helper modules by theinclude_all_helpersconvention that no static index can infer from code, walksActionView::Basefor the built-ins, readshelper_methoddeclarations off controllers, and derives route helpers fromconfig/routes.rb.Related #1667