Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add configuration option to specify slither target #23

Open
RaoulSchaffranek opened this issue Jul 6, 2022 · 0 comments
Open

Add configuration option to specify slither target #23

RaoulSchaffranek opened this issue Jul 6, 2022 · 0 comments

Comments

@RaoulSchaffranek
Copy link

Hi everyone!

Maybe I don't know where to look, but it seems to me that there is currently no option to specify the target directory for slither. I can run slither from my CLI with slither src where src is the target-folder containing the Solidity files. But the VSCode extension is always trying to run slither . which will ultimately throw the following error:

⸻ Starting analysis ⸻
Error: Error in workspace "/home/raoul/project":
Traceback (most recent call last):
  File "/home/raoul/.local/lib/python3.8/site-packages/slither/__main__.py", line 743, in main_impl
    ) = process_all(filename, args, detector_classes, printer_classes)
  File "/home/raoul/.local/lib/python3.8/site-packages/slither/__main__.py", line 73, in process_all
    compilations = compile_all(target, **vars(args))
  File "/home/raoul/.local/lib/python3.8/site-packages/crytic_compile/crytic_compile.py", line 637, in compile_all
    compilations.append(CryticCompile(target, **kwargs))
  File "/home/raoul/.local/lib/python3.8/site-packages/crytic_compile/crytic_compile.py", line 117, in __init__
    self._compile(**kwargs)
  File "/home/raoul/.local/lib/python3.8/site-packages/crytic_compile/crytic_compile.py", line 548, in _compile
    self._platform.compile(self, **kwargs)
  File "/home/raoul/.local/lib/python3.8/site-packages/crytic_compile/platform/hardhat.py", line 87, in compile
    os.listdir(build_directory), key=lambda x: os.path.getmtime(Path(build_directory, x))
FileNotFoundError: [Errno 2] No such file or directory: 'artifacts/build-info'


⸻ Analysis: 0 succeeded, 1 failed, 0 skipped ⸻
Refreshing explorer...
Loaded 0 issues, displaying 0

The problem seems to be the following line, which passes . as the hardcoded target to slither:

https://github.com/crytic/slither-vscode/blob/9cbf906ebac9ef9b61964609beda17a646b0bac7/src/slither.ts#L101

It would be nice to have a workspace-folder configuration option to specify the target manually.

@RaoulSchaffranek RaoulSchaffranek changed the title Add configuraiton option to specify slither target Add configuration option to specify slither target Jul 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant