fix: actionable hints when a source file cannot be located#678
Open
cats2101 wants to merge 1 commit intocrytic:masterfrom
Open
fix: actionable hints when a source file cannot be located#678cats2101 wants to merge 1 commit intocrytic:masterfrom
cats2101 wants to merge 1 commit intocrytic:masterfrom
Conversation
When `_verify_filename_existence` fails to resolve a path, surface suggestions to verify the path with `ls` and (for paths that look like `@scope/...` or bare-name package imports) to run `npm install`/`yarn install`. The most common cause of `Unknown file: @openzeppelin/...` errors is a missing/failed dependency install, so the resolver now points users at that fix instead of a single-line dead end. Closes crytic#255
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.
Closes #255.
When
_verify_filename_existencefails to resolve a path, surface actionable suggestions instead of a single-lineUnknown file: ...:ls <path>hint to verify the path exists.@scope/...or a bare-namepkg/...import that isn't a typical Solidity project source dir), point users atnpm install/yarn installin the working directory.Before:
After:
The npm hint is suppressed for absolute paths, paths starting with
./.., and common Solidity project source roots (contracts,src,lib,test,tests,script) so it doesn't add noise to non-npm setups (e.g. Foundry).Test plan
pytest tests/test_naming.py— 14 new tests covering scoped/bare/project/relative/absolute paths and message contents.ruff check crytic_compile/clean.ruff format --checkclean.ty check crytic_compile/clean.