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 CI for enforcing styles with Black and sorting imports #174

Closed
gridhead opened this issue Sep 29, 2021 · 8 comments · Fixed by #184
Closed

Add CI for enforcing styles with Black and sorting imports #174

gridhead opened this issue Sep 29, 2021 · 8 comments · Fixed by #184
Assignees
Labels
D: ops Changes to infrastructure or operations-related resources, documentation, scripts, etc. D: quality assurance CI tests, unit tests, integration tests, any kind of testing fragment A functional rewrite of the project good first issue Good for newcomers hacktoberfest Contribute here to get a free tee

Comments

@gridhead
Copy link
Member

Add CI for enforcing styles with Black and sorting imports

@gridhead gridhead added good first issue Good for newcomers D: contributor experience Quality-of-life improvements or changes to project contribution processes or resources D: ops Changes to infrastructure or operations-related resources, documentation, scripts, etc. fragment A functional rewrite of the project D: quality assurance CI tests, unit tests, integration tests, any kind of testing and removed D: contributor experience Quality-of-life improvements or changes to project contribution processes or resources labels Sep 29, 2021
@gridhead gridhead added the hacktoberfest Contribute here to get a free tee label Sep 30, 2021
@OBITORASU
Copy link
Contributor

Will the GitHub action for autoblack be accepted as a possible fix for this issue?

@gridhead
Copy link
Member Author

gridhead commented Sep 30, 2021 via email

@OBITORASU
Copy link
Contributor

We can use one of the available isort actions for sorting the dependencies. For example this one: https://github.com/isort/isort-action

@gridhead
Copy link
Member Author

gridhead commented Oct 1, 2021 via email

@OBITORASU
Copy link
Contributor

OBITORASU commented Oct 1, 2021

Made a PR with a custom GitHub workflow involving both isort and black as requested. Tested the same on my fork and it seems to be doing its job right, have a look and see if it works for your project :)

Edit 1: There seems to be conflict between black and isort on coding style. Would be really helpful if you dropped your opinion on my PR based on the log I provided. Thanks in advance!

@gridhead
Copy link
Member Author

gridhead commented Oct 1, 2021

See psf/black#333. Black doesn't have the feature to sort imports. Hence, you would want to format the code using Black first and then sort the imports.

@OBITORASU
Copy link
Contributor

Thanks!

@OBITORASU
Copy link
Contributor

OBITORASU commented Oct 1, 2021

Update: The issue persisted even after making black run before isort but adding that up with isort's --profile flag and setting it to black seems to have fixed the issue, now the workflow runs as expected.

gridhead added a commit that referenced this issue Oct 7, 2021
Fixes Issue #174: Add CI for enforcing styles with Black and sorting imports
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
D: ops Changes to infrastructure or operations-related resources, documentation, scripts, etc. D: quality assurance CI tests, unit tests, integration tests, any kind of testing fragment A functional rewrite of the project good first issue Good for newcomers hacktoberfest Contribute here to get a free tee
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants