zverok / spylls

Pure Python spell-checker, (almost) full port of Hunspell
https://spylls.readthedocs.io
Mozilla Public License 2.0
285 stars 21 forks source link

Integrate Black for formatting #6

Closed stuaxo closed 3 years ago

stuaxo commented 3 years ago

Black is a pretty good option for formatting code + can be integrated with Poetry / pyproject.toml

Since it's pretty strict it stops a lot of the battles that can happen over this.

(As a pedantic side note - the indentation in the docs in the README is not 4 spaces, as in PEP8)

zverok commented 3 years ago

I experimented with applying black to spylls codebase and was not pleased with the result. The code is carefully crafted to represent algorithms in succinct and readable way, and black's mechanical "uncompromised"™ fixes hardly make it better. I use pylint, flake8, and mypy to ensure I follow the good coding practices, but as about line length and placement of linebreaks—I prefer it my way.

A little random illustration, talking for itself, I believe (that's changes black suggests): image

(On a more philosophical note, I find the whole premise "somebody already made all code style decisions for you so you won't make them" not compelling.)

As a pedantic side note - the indentation in the docs in the README is not 4 spaces, as in PEP8

Now that's a valid concern and I'll fix it, thanks. Old habits editor settings die hard!

stuaxo commented 3 years ago

Fair enough :) I think there are things you can run to check the formatting in markdown, but can't remember them rn.