cookiecutter-django
cookiecutter-django copied to clipboard
Inconsistent line length (black vs 120)
What happened?
Black defines a line length of 88 characters, but other places still configure 120 characters:
-
setup.cfg
-
.pylintrc
What should've happened instead?
Consistency: use 88 characters everywhere. Especially because some IDEs will automatically use these values to show guides in the editor.
Pull request welcome!
I think we should follow Django [1] and ignore the standard imposed by Black.
We have widescreen display that is widely available and there is no reason to be stuck in 88 characters. The Django standard, (119 characters) is good enough for me.
So the solution to this is:
1 - Create pyproject.toml
and include the Black custom configuration [2] with line-length = 119
on [3][4]
2 - Migrate flake8 settings to pyproject.toml
3 - Migrate isort settings to pyproject.toml
[5]
4 - Update the .editorconfig to max_line_length=119
[6]
5 - Update flake8 settings to max-line-length = 119
7]
6 - Update pycodestyle settings to max-line-length = 119
[8]
7 - Update pylintrc settings to max-line-length = 119
[9]
references:
[1] https://github.com/django/django/blob/master/.editorconfig [2] https://black.readthedocs.io/en/stable/pyproject_toml.html [3] https://github.com/pydanny/cookiecutter-django/tree/4978aa79135374c36ab1b9bcc07c6e4a3364eae8 [4] https://github.com/pydanny/cookiecutter-django/tree/4978aa79135374c36ab1b9bcc07c6e4a3364eae8/%7B%7Bcookiecutter.project_slug%7D%7D [5] https://timothycrosley.github.io/isort/docs/configuration/config_files/ [6] https://github.com/pydanny/cookiecutter-django/blob/4978aa79135374c36ab1b9bcc07c6e4a3364eae8/%7B%7Bcookiecutter.project_slug%7D%7D/.editorconfig#L16 [7] https://github.com/pydanny/cookiecutter-django/blob/4978aa79135374c36ab1b9bcc07c6e4a3364eae8/%7B%7Bcookiecutter.project_slug%7D%7D/setup.cfg#L2 [8] https://github.com/pydanny/cookiecutter-django/blob/4978aa79135374c36ab1b9bcc07c6e4a3364eae8/%7B%7Bcookiecutter.project_slug%7D%7D/setup.cfg#L6 [9] https://github.com/pydanny/cookiecutter-django/blob/4978aa79135374c36ab1b9bcc07c6e4a3364eae8/%7B%7Bcookiecutter.project_slug%7D%7D/.pylintrc
Flake8 does not seem to have support for reading pyproject.toml yet https://gitlab.com/pycqa/flake8/-/issues/428
The 2 and 3 are optional.
@luzfcb Moving configuration to pyproject.toml
is interesting, but it seems to have some consequences (based on a quick reading of the linked issues). Maybe you can open a separate issue about it, so we can keep this discussion about the line length?
(I have no preference about the actual line length chosen, I just like consistency)
@janfabry since 2 and 3 are optional, I think the way to keep consistency is executing 1 and 4 to 7.
Hello! If you still need help wih this, I could follow steps 1 and 4-7
Are we still considering this? I can create a PR for this if you are open