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

Add linting for vyper files #52

Closed
wants to merge 1 commit into from

Conversation

spinoch
Copy link

@spinoch spinoch commented Nov 2, 2020

Fixes #16

@spinoch
Copy link
Author

spinoch commented Nov 2, 2020

Not sure why the brownie workflow is failing on the pre-commit hook check (I just reformatted the file). Will look into it at another time.

@spinoch spinoch force-pushed the add_vyper_linting branch 2 times, most recently from cdee4e9 to 9e66129 Compare November 2, 2020 16:22
@spinoch
Copy link
Author

spinoch commented Nov 2, 2020

Of course, I had to rebase. I consider this ready for review now.

Copy link
Member

@fubuloubu fubuloubu left a comment

Choose a reason for hiding this comment

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

This is really awesome, thank you! I just have one modification I'd like to see if it's possible to change black to accept.

Also, in terms of distribution, will you be able to publish to PyPI so we can more officially integrate this into our CI? (through adding another task)

Comment on lines 12 to 50
def name() -> String[42]: view
def symbol() -> String[20]: view
def decimals() -> uint256: view
Copy link
Member

@fubuloubu fubuloubu Nov 2, 2020

Choose a reason for hiding this comment

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

Can blackadder be adjusted to maintain this? I find this much more readable actually (the item after the : is actually the mutability of the method, not a function body). We don't use classes for anything else, so perhaps this behavior can be monkey-patched

Copy link
Author

Choose a reason for hiding this comment

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

I guess we'd have to patch black's transform_line or the Line class. It's doable, but will require some investigation/time

I find this much more readable

agree. And aesthetic

Copy link
Author

Choose a reason for hiding this comment

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

fyi I probably won't be able to look into this until next week

Copy link
Member

@fubuloubu fubuloubu Nov 6, 2020

Choose a reason for hiding this comment

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

What's weird about this is that Strategy interface below didn't get updated... 🤔

Copy link
Author

Choose a reason for hiding this comment

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

Not sure I get what you mean, I see Strategy reformatted below here

Copy link
Member

Choose a reason for hiding this comment

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

Weird, I don't

interface Strategy:
    def distributeRewards(_shares: uint256): nonpayable
    def estimatedTotalAssets() -> uint256: view
    def withdraw(_amount: uint256): nonpayable
    def migrate(_newStrategy: address): nonpayable

Copy link
Author

Choose a reason for hiding this comment

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

It's in my original commit 9e66129. Looks like you reverted that here 565b737

Copy link
Member

@fubuloubu fubuloubu Nov 6, 2020

Choose a reason for hiding this comment

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

ah, sorry! that's why that CI keeps failing haha

Copy link
Author

Choose a reason for hiding this comment

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

@fubuloubu for now, I'd suggest to keep this formatting as is, if it's not too much of an inconvenience. We should address these formatting issues in the next major blackadder release but it will take some time until we get that out.
Otherwise, we can postpone this PR until then.

Copy link
Member

Choose a reason for hiding this comment

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

I'd argue we should wait then. This reformatting makes things significantly less clear.

contracts/Vault.vy Outdated Show resolved Hide resolved
contracts/Vault.vy Outdated Show resolved Hide resolved
@spinoch
Copy link
Author

spinoch commented Nov 3, 2020

Also, in terms of distribution, will you be able to publish to PyPI so we can more officially integrate this into our CI? (through adding another task)

Sure, I should add a step to the blackadder CI so that it automatically pushes on new tags.

@fubuloubu
Copy link
Member

@spinoch I did most of the updates here in #63, so the ones left here are ones we want to change the behavior of I think

@spinoch
Copy link
Author

spinoch commented Nov 9, 2020

This is now on PyPI, https://pypi.org/project/blackadder/

so we can more officially integrate this into our CI?

Shall I replace the pre-commit run -a for blackadder --fast --diff ...?

@fubuloubu
Copy link
Member

This is now on PyPI, https://pypi.org/project/blackadder/

so we can more officially integrate this into our CI?

Shall I replace the pre-commit run -a for blackadder --fast --diff ...?

Yes please! Also if you could make it another task in the Lint config, that'd be awesome!

requirements-dev.txt Outdated Show resolved Hide resolved
.github/workflows/lint.yaml Show resolved Hide resolved
.pre-commit-config.yaml Outdated Show resolved Hide resolved
@spinoch spinoch marked this pull request as draft November 12, 2020 19:16
@fubuloubu
Copy link
Member

Will have to re-approach after this tool is ready for primetime. Thanks for giving it a shot!

@fubuloubu fubuloubu closed this Mar 12, 2021
orbxball pushed a commit to orbxball/yearn-vaults that referenced this pull request Aug 8, 2021
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.

Add linting to CI for Vyper files
2 participants