-
Notifications
You must be signed in to change notification settings - Fork 141
Description
Problem to Solve
Python style is not defined for this project. 😱
It's obviously not such a big deal, but there is a straightforward and easy solution to address this issue. Black.
Black is a project under the PSF umbrella. "Black reformats entire files in place. It is not configurable. It doesn't take previous formatting into account. It doesn't reformat blocks that start with # fmt: off and end with # fmt: on. # fmt: on/off have to be on the same level of indentation. It also recognizes YAPF's block comments to the same effect, as a courtesy for straddling code."
Black is used notable open-source projects: pytest, tox, Pyramid, Django, etc.
Proposed Solution
Add black to setup.py:
extras_require={ # Optional
'dev': ['black','wheel'],
},
(wheel for #19)
Apply black to the project:
$ black .
Add $ black --check . to the CI.
--check : Don't write the files back, just return the status. Return code 0 means nothing would change. Return code 1 means some files would be reformatted. Return code 123 means there was an internal error.
Additional Information
Doc: https://black.readthedocs.io/en/stable/
$ git clone https://github.com/OpenCTI-Platform/client-python.git
$ cd client-python
$ black .
$ git diff --shortstat
56 files changed, 6126 insertions(+), 4454 deletions(-)
Priority: extra low