-
Notifications
You must be signed in to change notification settings - Fork 564
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
ci: Add GitHub action for style checkers #150
Conversation
- name: Install dependencies | ||
run: pip install 'isort==5.*' black | ||
- name: Lint with isort | ||
run: isort --profile black --length-sort --line-width 120 -c . |
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 am not sure if we want to modify this options. See #76 (comment) DO NOT MERGE until this is clarified. We should also solve the offenses once this is clarified.
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.
If this does all-in-one, that's cool!
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 think it is not. The black
profile adapts isort's configuration so that it doesn't conflict with black. But it doesn't run black.
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.
Ah, gotcha!
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.
don't we need to specify the third party modules, like idc, here?
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 don't think so, because now it is the default that unrecognise libraries are considered third parties. Note that we were adding argpase as thirdlibrary, but it seems to be in the standard library: https://github.com/timothycrosley/isort/blob/9ee7a97c5a613c7ed536de5635bf26151ba47f55/isort/stdlibs/py35.py#L13
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.
nice, can this be configured to run isort/black and commit the changes back instead of failing the checks?
- name: Install dependencies | ||
run: pip install 'isort==5.*' black | ||
- name: Lint with isort | ||
run: isort --profile black --length-sort --line-width 120 -c . |
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.
If this does all-in-one, that's cool!
6c4b1f5
to
d484c08
Compare
We could, but I find it a bad idea. Taking into account that it will fail in the PR if offenses are introduced, I think it is easy to ensure that new changes don't break the style checker/linter/tests (it can even be enforced by not allowing merges of failing PR and blocking push to master). We already have commits to synchronize submodules, so I would avoid adding more extra commits which are not strictly neccesary. I think having a clean commit history is important:
GitLab has similar arguments:
Note also that this wouldn't work anyway for rule linters and tests, as they can't be solved automatically. |
very good, thanks for the details here! |
good argument @Ana06 - i'm convinced. so we'll run black & isort in "check" mode, failing the CI run if they don't succeed, which will block a PR. then its up to the author to fix before merging. makes sense to me. |
given that its up to the author to do the formatting, we should document the commands that we recommend to do isort & block in auto-fix mode. |
we should also update the hooks. |
7607b41
to
91f577f
Compare
@williballenthin @mr-tz If you are fine with the changes in f4e6541 we can merge this. Some changes seems related to I will then open an issue to update the hooks. |
go ahead and merge CI changes as you see fit to get this working |
Run `isort --profile black --length-sort --line-width 120 .` Update documentation as well.
Run isort and black for every pull request or push.
GitHub Actions are working! 🥳 As @williballenthin said I can merge it... there we go! 🚢 |
Run isort 5 and black for every pull request or push.
You can see this working in Ana06/capa
The idea is to add jobs to the same action for rule linter and tests and to show a badge in the README with the status of the workflow (the name of the badge is the same as the workflow -
CI
). See #151Closes #75
Closes #76