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

CLI: Support --exclude option #1065

Merged
merged 27 commits into from
Aug 28, 2024
Merged

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.

Copy link

@ericglau ericglau merged commit 68e49fa into OpenZeppelin:master Aug 28, 2024
11 checks passed
@ericglau ericglau deleted the skipcontracts branch August 28, 2024 20:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants