-
Notifications
You must be signed in to change notification settings - Fork 319
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
feat: vyper lint #479
feat: vyper lint #479
Conversation
Would it be possible for you turn flake8-vyper-2 into a requirement? |
I could. I wasn't sure whether it is worth it, because of the unfortunate tying between the minor version and the linter. I would do something like |
I will go ahead and package this up as a requirement. In the meantime, I think it is worth pointing out that due to the nature of this exact PR, it will never pass linting. That's because it is correctly finding a whole bunch of errors. See the link for the lint run above. The output has the lint errors. Great to see it proved out, actually. |
I have made the linting now get installed via a simple Pip installation, rather than adding that code to this repo, and also made the Github Action for the linter able to handle the two different Vyper versions in use. Note that this will never pass Linting, due to the nature of this task. I can't take responsibility for editing your .vy files to pass the Linter, at least not on this first round. |
Can you fix the files that are falling linting on this PR? |
I think so, I'll give it a shot. |
|
||
API_VERSION: constant(String[28]) = "0.4.3" | ||
|
||
from vyper.interfaces import ERC20 | ||
|
||
implements: ERC20 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had to move this to the top to get the constants recognized by the linter
@@ -242,8 +271,8 @@ SECS_PER_YEAR: constant(uint256) = 31_556_952 # 365.2425 days | |||
# `nonces` track `permit` approvals with signature. | |||
nonces: public(HashMap[address, uint256]) | |||
DOMAIN_SEPARATOR: public(bytes32) | |||
DOMAIN_TYPE_HASH: constant(bytes32) = keccak256('EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)') | |||
PERMIT_TYPE_HASH: constant(bytes32) = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I couldn't chop these to 80 characters.
That was really a lot of lint, mostly minor stuff. |
@@ -6,3 +6,6 @@ reports/ | |||
node_modules/ | |||
.test_durations | |||
yarn-error.log | |||
flake8.log | |||
*egg-info/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this from?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The log is auto-generated by flake8 when it runs
Installing Flake8-vyper-linter via the commandline ended up creating a "flake8...egg-info" file, so I added it to ignore.
That line would be safe to remove, since the egg files are transient.
Pushed an update which should fix those |
846050e
to
222e008
Compare
This is a forked version of flake8-vyper, updated to work for version 2.16 of Vyper, and with a Github Action to automate the linting. It is submitted for the open ticket #16 , adding linting for Vyper.