Add isort to CI and pre-commit ()

* add isort to CI and pre-commit

* disable wrong-import-order in pylintrc

* ✏️ Tweak


Co-authored-by: Franck Nijhof <frenck@frenck.nl>
pull/29882/head
Bas Nijholt 2019-12-12 15:58:47 +01:00 committed by Franck Nijhof
parent 7d68e88d31
commit c58c10ab7c
5 changed files with 16 additions and 1 deletions

View File

@ -35,6 +35,10 @@ repos:
- --format=custom
- --configfile=tests/bandit.yaml
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
# 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

View File

@ -31,3 +31,7 @@ repos:
- --format=custom
- --configfile=tests/bandit.yaml
files: ^(homeassistant|script|tests)/.+\.py$
- repo: https://github.com/pre-commit/mirrors-isort
rev: v4.3.21
hooks:
- id: isort

View File

@ -54,6 +54,10 @@ stages:
. venv/bin/activate
pre-commit run bandit --all-files
displayName: 'Run bandit'
- script: |
. venv/bin/activate
pre-commit run isort --all-files
displayName: 'Run isort'
- job: 'Validate'
pool:
vmImage: 'ubuntu-latest'

View File

@ -25,6 +25,7 @@ good-names=id,i,j,k,ex,Run,_,fp
# unnecessary-pass - readability for functions which only contain pass
# import-outside-toplevel - TODO
# too-many-ancestors - it's too strict.
# wrong-import-order - isort guards this
disable=
format,
abstract-class-little-used,
@ -49,7 +50,8 @@ disable=
too-many-statements,
too-many-boolean-expressions,
unnecessary-pass,
unused-argument
unused-argument,
wrong-import-order
enable=
use-symbolic-message-instead

View File

@ -4,4 +4,5 @@ bandit==1.6.2
black==19.10b0
flake8-docstrings==1.5.0
flake8==3.7.9
isort==v4.3.21
pydocstyle==5.0.1