mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 19:27:45 +00:00
Add isort to CI and pre-commit (#29739)
* add isort to CI and pre-commit
* disable wrong-import-order in pylintrc
* ✏️ Tweak
Co-authored-by: Franck Nijhof <frenck@frenck.nl>
This commit is contained in:
parent
7d68e88d31
commit
c58c10ab7c
@ -35,6 +35,10 @@ repos:
|
|||||||
- --format=custom
|
- --format=custom
|
||||||
- --configfile=tests/bandit.yaml
|
- --configfile=tests/bandit.yaml
|
||||||
files: ^(homeassistant|script|tests)/.+\.py$
|
files: ^(homeassistant|script|tests)/.+\.py$
|
||||||
|
- repo: https://github.com/pre-commit/mirrors-isort
|
||||||
|
rev: v4.3.21
|
||||||
|
hooks:
|
||||||
|
- id: isort
|
||||||
# Using a local "system" mypy instead of the mypy hook, because its
|
# Using a local "system" mypy instead of the mypy hook, because its
|
||||||
# results depend on what is installed. And the mypy hook runs in a
|
# results depend on what is installed. And the mypy hook runs in a
|
||||||
# virtualenv of its own, meaning we'd need to install and maintain
|
# virtualenv of its own, meaning we'd need to install and maintain
|
||||||
|
@ -31,3 +31,7 @@ repos:
|
|||||||
- --format=custom
|
- --format=custom
|
||||||
- --configfile=tests/bandit.yaml
|
- --configfile=tests/bandit.yaml
|
||||||
files: ^(homeassistant|script|tests)/.+\.py$
|
files: ^(homeassistant|script|tests)/.+\.py$
|
||||||
|
- repo: https://github.com/pre-commit/mirrors-isort
|
||||||
|
rev: v4.3.21
|
||||||
|
hooks:
|
||||||
|
- id: isort
|
||||||
|
@ -54,6 +54,10 @@ stages:
|
|||||||
. venv/bin/activate
|
. venv/bin/activate
|
||||||
pre-commit run bandit --all-files
|
pre-commit run bandit --all-files
|
||||||
displayName: 'Run bandit'
|
displayName: 'Run bandit'
|
||||||
|
- script: |
|
||||||
|
. venv/bin/activate
|
||||||
|
pre-commit run isort --all-files
|
||||||
|
displayName: 'Run isort'
|
||||||
- job: 'Validate'
|
- job: 'Validate'
|
||||||
pool:
|
pool:
|
||||||
vmImage: 'ubuntu-latest'
|
vmImage: 'ubuntu-latest'
|
||||||
|
4
pylintrc
4
pylintrc
@ -25,6 +25,7 @@ good-names=id,i,j,k,ex,Run,_,fp
|
|||||||
# unnecessary-pass - readability for functions which only contain pass
|
# unnecessary-pass - readability for functions which only contain pass
|
||||||
# import-outside-toplevel - TODO
|
# import-outside-toplevel - TODO
|
||||||
# too-many-ancestors - it's too strict.
|
# too-many-ancestors - it's too strict.
|
||||||
|
# wrong-import-order - isort guards this
|
||||||
disable=
|
disable=
|
||||||
format,
|
format,
|
||||||
abstract-class-little-used,
|
abstract-class-little-used,
|
||||||
@ -49,7 +50,8 @@ disable=
|
|||||||
too-many-statements,
|
too-many-statements,
|
||||||
too-many-boolean-expressions,
|
too-many-boolean-expressions,
|
||||||
unnecessary-pass,
|
unnecessary-pass,
|
||||||
unused-argument
|
unused-argument,
|
||||||
|
wrong-import-order
|
||||||
enable=
|
enable=
|
||||||
use-symbolic-message-instead
|
use-symbolic-message-instead
|
||||||
|
|
||||||
|
@ -4,4 +4,5 @@ bandit==1.6.2
|
|||||||
black==19.10b0
|
black==19.10b0
|
||||||
flake8-docstrings==1.5.0
|
flake8-docstrings==1.5.0
|
||||||
flake8==3.7.9
|
flake8==3.7.9
|
||||||
|
isort==v4.3.21
|
||||||
pydocstyle==5.0.1
|
pydocstyle==5.0.1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user