docs(contributing): Update Coding Style

This commit is contained in:
Joakim Saario 2022-08-22 22:30:25 +02:00
parent de5538a40f
commit ce5dbf0eeb
No known key found for this signature in database
GPG key ID: D8B76D271B7BD453

View file

@ -31,21 +31,27 @@ Test patches that increase coverage in the codebase are always welcome.
### Coding Style ### Coding Style
We use the `flake8` and `isort` tools to manage PEP-8 coherence and We use `autoflake`, `isort`, `black` and `flake8` to enforce coding style in a
import ordering in this project. PEP-8 compliant way. These tools run in GitLab CI using `pre-commit` to verify
that any pushed code changes comply with this.
To enable the `pre-commit` git hook, install the `pre-commit` package either
with `pacman` or `pip` and then run `pre-commit install --install-hooks`. This
will ensure formatting is done before any code is commited to the git
repository.
There are plugins for editors or IDEs which automate this process. Some There are plugins for editors or IDEs which automate this process. Some
example plugins: example plugins:
- [tell-k/vim-autopep8](https://github.com/tell-k/vim-autopep8) - [tenfyzhong/autoflake.vim](https://github.com/tenfyzhong/autoflake.vim)
- [fisadev/vim-isort](https://github.com/fisadev/vim-isort) - [fisadev/vim-isort](https://github.com/fisadev/vim-isort)
- [psf/black](https://github.com/psf/black)
- [nvie/vim-flake8](https://github.com/nvie/vim-flake8)
- [prabirshrestha/vim-lsp](https://github.com/prabirshrestha/vim-lsp) - [prabirshrestha/vim-lsp](https://github.com/prabirshrestha/vim-lsp)
- [dense-analysis/ale](https://github.com/dense-analysis/ale)
See `setup.cfg` for flake8 and isort specific rules. See `setup.cfg`, `pyproject.toml` and `.pre-commit-config.yaml` for tool
specific configurations.
Note: We are planning on switching to [psf/black](https://github.com/psf/black).
For now, developers should ensure that flake8 and isort passes when submitting
merge requests or patch sets.
### Development Environment ### Development Environment