Parse artifacts after a custom build command - #701
Open
Eljees wants to merge 1 commit into
Open
Conversation
Signed-off-by: Eljees <3.14hell@gmail.com>
Author
|
Ping — this one and #702 have been open since 8 August with no review. The CLA check is signed and green on both, but that is the only check that has run: the github-actions suites are at The two are independent of each other and can be taken in either order. |
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.
Fixes #423.
--compile-custom-buildruns the user's command, but nothing ever reads what that command produced:compilation_unitsstays empty, so Slither and the other consumers see a project with no sources.Cause
In
CryticCompile._compile, the call that parses the artifacts sits in theelsebranch, so it is skipped whenever a custom build is requested:Fix
Every platform already supports
ignore_compile(foundry.py,hardhat.py,buidler.py,embark.py,truffle.py): do not invoke the build tool, but still read the artifacts from disk. A custom build has just produced those artifacts, so that is exactly the mode that applies here. The patch reuses it instead of adding a new code path, and no platform is touched.ignore_compileis passed as"true"rather thanTruebecause**kwargsis typedstrhere; the platforms only test it for truthiness, andcrytic_defer_compilationalready uses the same string convention.Cleaning is still skipped for custom builds, which is the previous behaviour.
Tests
New
tests/test_custom_build.py. It needs no compiler: it uses a stubAbstractPlatform, the same approach astests/test_stale_cache_hint.py. The custom build command writes a marker file, so the test can distinguish "the command did not run" from "the artifacts were not parsed".Before the fix (the marker assert passes, so the command did run):
After the fix:
1 passed.Also run:
ruff check crytic_compile/ tests/(clean),ruff format --check(clean),ty check crytic_compile/(no new diagnostics compared tomaster), and the compiler-independent part of the suite (test_stale_cache_hint.py,test_naming.py,test_locate_framework_root.py) - 25 passed.