Open iliastsa opened 7 months ago
The recent update introduces a significant enhancement to the CryticCompile
class by adding a defer_compilation
parameter, which offers the flexibility to defer the compilation process. A new method, compile
, has been implemented to initiate compilation when required. Additionally, the testing suite has been refined by splitting a test function into two, focusing on standard and deferred compilation checks, streamlining the testing process for these new functionalities.
File | Change Summary |
---|---|
crytic_compile/crytic_compile.py tests/test_metadata.py |
Added defer_compilation parameter and compile method to CryticCompile class for flexible compilation control.Refactored test_metadata into metadata_checks and test_metadata_deferred to accommodate and test new deferred compilation feature. |
🐰✨
In the realm of code, under digital skies,
A change was made, wise and sly.
Compilation deferred, flexibility gained,
With tests refactored, no clarity drained.
A hop, a skip, in binary meadows,
Celebrating the code, with shadows in echos.
🌟📚
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Hi @iliastsa, thanks for the PR! Could you elaborate a bit more on the use case you see for this feature? I'm not sure what kind of information may be useful on an "uncompiled"
CryticCompile
object.
The idea is to be able to use various inferred facts from Crytic (config file paths, inferred build system etc). In our use-case we'd like to modify configuration files right before compilation.
One way to emulate this without adding additional flags is to subclass the CryticCompile class and override the _compile
method, something like:
class MyCryticCompile(CryticCompile):
def _compile(self, **kwargs):
# My logic here before compilation
...
super()._compile(kwargs)
# My logic here after compilation
...
but I think offering this capability with out having to create a new class is a bit cleaner.
We just need to get the linters passing @iliastsa
This PR adds the ability to defer compilation at a later stage, instead of doing it at the time of the
CryticCompile
object. This is useful when the client code wants to make use of some properties that are initialized before compilation is triggered.Summary by CodeRabbit