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

Most derived contracts: Filter Test/Mock contracts #770

Open
montyly opened this issue Jan 15, 2021 · 1 comment
Open

Most derived contracts: Filter Test/Mock contracts #770

montyly opened this issue Jan 15, 2021 · 1 comment
Milestone

Comments

@montyly
Copy link
Member

montyly commented Jan 15, 2021

slither.contracts_derived can return Mock / Test contracts, instead of returning the expected derived contracts.

We need to filter Mock/Test and also return contracts that are only inherited by tests

def contracts_derived(self) -> List[Contract]:
"""list(Contract): List of contracts that are derived and not inherited."""
inheritance = (x.inheritance for x in self.contracts)
inheritance = [item for sublist in inheritance for item in sublist]
return [c for c in self._contracts.values() if c not in inheritance and not c.is_top_level]

@0xalpharush 0xalpharush added this to the 0.9.4 milestone Apr 12, 2023
@0xalpharush
Copy link
Contributor

0xalpharush commented Jun 5, 2023

I started work on this here https://github.com/crytic/slither/tree/contracts-derived-filter-tests. We need to address a couple things:

  • filter out analyzing test directories with config(also clarify the difference between not analyzing and excluding results with --filter-paths)
  • allow pattern matching besides "Test" and "Mock"

ref #759
xref crytic/crytic-compile#435

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

2 participants