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

Fix get_pragma_spec() to exclude commented out pragma statements on compile #1552

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

freddie71010
Copy link

@freddie71010 freddie71010 commented Jun 2, 2022

Fix get_pragma_spec() to exclude commented out pragma statements at the beginning of the file.

What I did

Refactor brownie/project/sources.py::get_pragma_spec()

How I did it

Reconfigure regex to grab all pragma solidity statements in the file and then loop through and skip over any that are prefixed with a "//". Continue looping until first valid pragma statement is found.

How to verify it

Wrote three new unit tests to look at scenarios where:

  • one valid pragma version statement listed
  • no valid pragma version statement listed
  • one valid in-between pragma version statement listed

Checklist

  • I have confirmed that my PR passes all linting checks
  • I have included test cases
  • I have updated the documentation
  • I have added an entry to the changelog

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.

None yet

1 participant