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 black formatter #444
Add black formatter #444
Conversation
Spacetown
commented
Dec 10, 2020
- Move configuration for coverage from setup.cfg to pyproject.toml.
- Switch from flake8 to flake9 (Fork which supports pytoml.xml) and update documentation.
- Add configuration for black to format code.
- Pro:
- I used it in another project and the formatted code looks good for me.
- Formatting of code is independand of the developer and looks the same in the whole project.
- No need of configuration.
- Pro:
- Contra:
- No configuration possible.
Codecov Report
@@ Coverage Diff @@
## master #444 +/- ##
=======================================
Coverage 95.52% 95.52%
=======================================
Files 20 20
Lines 2458 2458
Branches 420 420
=======================================
Hits 2348 2348
Misses 48 48
Partials 62 62
Flags with carried forward coverage won't be shown. Click here to find out more. Continue to review full report at Codecov.
|
5b3977b
to
e98222d
Compare
After thinking about this for a bit, I'm not quite sure this is a step in the right direction.
Of course I'm willing to be convinced otherwise. There are two very good aspects in this PR that I'd like to keep though: specifying a code formatter, and simplifying invocation of flake8 by using a config file. |
Flake9 only because flake8 doesn't support pyproject.toml. I thought one configuration to configure all tools would be fine. I think it will be better to document onla that flake8 is used and the options are fixed in a configuration (maybe setup.py).
If we start to use black it should be added to the tests and a reformat of all files is needed one time.
The runtime requirements are configured in
The simplifying of the invocation is a big advantage. |
1af8c04
to
6c4f6ea
Compare
f756b0a
to
13a44a8
Compare
@latk I've revert the pyproject.toml, moved the configuration of flake8 to setup.cfg and introduced black. |
Switch from flake8 to flake9 (Fork which supports pytoml.xml). Move configuration for coverage from setup.cfg to pyproject.toml.
13a44a8
to
2f12740
Compare
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.
Looks good! Just two minor inline comments below.
For future reference, updating the title might also be a good idea.
Unfortunately, reformatting all code will lead to substantial merge conflicts. So we should probably delay that step for a bit until fewer PRs are still pending. So it's good that the CI failure is ignored (for now).
Co-authored-by: Lukas Atkinson <opensource@LukasAtkinson.de>