mirror of
https://github.com/home-assistant/developers.home-assistant.git
synced 2025-07-15 13:26:28 +00:00
Update section about lint errors (#1219)
This commit is contained in:
parent
a3cf4fca9b
commit
46f92b2650
@ -82,15 +82,14 @@ pytest ./tests/components/<your_component>/ --cov=homeassistant.components.<your
|
||||
|
||||
### Preventing linter errors
|
||||
|
||||
Save yourself the hassle of extra commits just to fix style errors by enabling the Flake8 git commit hook. Flake8 will check your code when you try to commit to the repository and block the commit if there are any style errors, which gives you a chance to fix them!
|
||||
Several linters are setup to run automatically when you try to commit as part of running `script/setup` in the [virtual environment](development_environment.mdx).
|
||||
|
||||
You can also run these linters manually:
|
||||
|
||||
```shell
|
||||
pip3 install flake8 flake8-docstrings
|
||||
flake8 --install-hook=git
|
||||
pre-commit run --show-diff-on-failure
|
||||
```
|
||||
|
||||
The `flake8-docstrings` extension will check docstrings according to [PEP257](https://www.python.org/dev/peps/pep-0257/) when running Flake8.
|
||||
|
||||
### Notes on PyLint and PEP8 validation
|
||||
|
||||
If you can't avoid a PyLint warning, add a comment to disable the PyLint check for that line with `# pylint: disable=YOUR-ERROR-NAME`. Example of an unavoidable one is if PyLint incorrectly reports that a certain object doesn't have a certain member.
|
||||
|
Loading…
x
Reference in New Issue
Block a user