Contents:
- Since Django 4.1, black is used to format code, see: https://docs.djangoproject.com/en/4.2/ref/django-admin/#black-formatting
- This project should be configured to use a maximum line length of 120.
- "A framework for managing and maintaining multi-language pre-commit hooks"
- Configuration file: .pre-commit-config.yaml
- Website: https://pre-commit.com/
- "The uncompromising code formatter"
- Website: https://black.readthedocs.io/en/stable/
- "Your Tool For Style Guide Enforcement"
- "A wrapper around these tools: PyFlakes, pycodestyle, Ned Batchelder's McCabe script"
- Configuration file: .flake8
- Website: https://flake8.pycqa.org/en/stable/
- Usage with the pre-commit git hooks framework
- Error / Violation Codes (codes starting with F)
- Usage with the pre-commit git hooks framework
- "Python style guide checker"
- Website: https://pycodestyle.pycqa.org/en/stable/
- Error codes (codes starting with E and W)
- E203 whitespace before ‘,’, ‘;’, or ‘:’
- E704 multiple statements on one line (def)
- W503 line break before binary operator
- Error codes (codes starting with E and W)
- Website: https://code.visualstudio.com/
- Extension Black Formatter
- Extension Django Template Support
- Intro: https://code.visualstudio.com/docs/python/tutorial-django
- Configuration file (
.vscode/settings.json
)
{
// https://marketplace.visualstudio.com/items?itemName=ms-python.black-formatter
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter",
"editor.formatOnSave": true
},
"black-formatter.args": [
"--line-length=120"
],
}