Skip to content

CLI: Support --exclude option#1065

Merged
ericglau merged 27 commits intoOpenZeppelin:masterfrom
ericglau:skipcontracts
Aug 28, 2024
Merged

CLI: Support --exclude option#1065
ericglau merged 27 commits intoOpenZeppelin:masterfrom
ericglau:skipcontracts

Conversation

@ericglau
Copy link
Member

@ericglau ericglau commented Aug 22, 2024

Adds an --exclude "<GLOB_PATTERN>" [--exclude "<GLOB_PATTERN>"...] option to the CLI, which allows glob patterns of source file paths that should be excluded from the validation report. If passing in multiple patterns, call the option multiple times, once for each pattern.

This supports any of the user's source files or their dependencies. Note this only supports file paths (e.g. the paths of .sol files), not the names of specific contracts in those files.

Additional notes:

  • If the --contract <CONTRACT_NAME> option was specified and the file is excluded via the --exclude option, an error will be thrown.
  • The pattern **/contracts/proxy/beacon/UpgradeableBeacon.sol is always added to the exclude list automatically, since UpgradeableBeacon contains an upgradeTo(address) function and is incorrectly detected as an implementation contract.
  • This PR also updates the --referenceBuildInfoDirs and --unsafeAllow options to support those options being called either with a comma (as before) or multiple times (introduced in this PR).
    • However, --exclude does not treat comma as a delimiter, because globs can have commas within them e.g. --exclude "**/{A,B}.sol"

Fixes #1035
Fixes #849

@ericglau ericglau requested a review from a team August 22, 2024 18:48
@ericglau ericglau marked this pull request as draft August 22, 2024 20:21
@ericglau ericglau removed the request for review from a team August 22, 2024 20:22
@ericglau ericglau marked this pull request as ready for review August 23, 2024 17:26
@ericglau ericglau requested a review from a team August 23, 2024 17:26
Copy link
Contributor

@Amxx Amxx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a very small suggestion. Looks good to me.

@socket-security
Copy link

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

Successfully merging this pull request may close these issues.

CLI: Provide a way to skip certain contracts from validation CLI: UpgradeableBeacon incorrectly detected as upgradeable implementation

2 participants