Skip to content

Adding code formatter/linter to workflow? #579

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

Closed
karlding opened this issue May 12, 2019 · 5 comments
Closed

Adding code formatter/linter to workflow? #579

karlding opened this issue May 12, 2019 · 5 comments
Assignees
Labels
QA about improving and maintaining the quality of the library
Milestone

Comments

@karlding
Copy link
Collaborator

What are your thoughts on enforcing automated formatting across the project? With various people contributing code, ensuring that consistent code style is followed is always a challenge. This often adds noise to PRs, and just is another thing for PR reviewers to worry about.

An automated formatter (I like black due to the lack of configuration options it exposes, but that's just my preference) would automatically format code so that all code is formatted consistently. This can also run in CI to ensure that commits have been formatted correctly before merging.

It'll probably cause a lot of conflicts with currently open PRs (and cause 1 giant diff of a commit), but maybe it's worth considering. And if this is adopted, the format can be done incrementally before flipping the CI checks to reduce the amount of pain with open PRs.

Similarly, what are your opinions on adding a linter (pylint, flake8, pycodestyle, etc.) to the workflow? An incremental approach could be taken to slowly make things comply with whatever rules are chosen.

@hardbyte
Copy link
Owner

I'm very open to both black and a linter.

Now is a fairly good time since v3.2.0 is essentially minted and most likely the next release will be v4 which will drop support for Python2 and start to add typing annotations. In another project I was also supporting Python2 and wanted type annotations and to use black but they were a bit incompatible a year ago.

Due to the slow nature of reviewing and adding new interfaces I think there will never be a conflict free time to do it.

@karlding
Copy link
Collaborator Author

Sounds good!

I believe a patch went into black at the end of last year that took a stab at supporting that. Perhaps that supports enough of the use case that you were hoping to cover?

@felixdivo
Copy link
Collaborator

I was about to propose this a few weeks back as well! I would love it. 👍

@felixdivo felixdivo added the QA about improving and maintaining the quality of the library label May 13, 2019
@felixdivo felixdivo added this to the 4.0 Release milestone May 13, 2019
@felixdivo
Copy link
Collaborator

@karlding added a formatter in #602

@felixdivo
Copy link
Collaborator

Related (about Pylint): #613

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
QA about improving and maintaining the quality of the library
Projects
None yet
Development

No branches or pull requests

3 participants