mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 12:17:07 +00:00
Use pre-commit in CI and tox (#27743)
This commit is contained in:
parent
a119932ee5
commit
103ffacea7
@ -6,6 +6,7 @@ repos:
|
|||||||
args:
|
args:
|
||||||
- --safe
|
- --safe
|
||||||
- --quiet
|
- --quiet
|
||||||
|
files: ^((homeassistant|script|tests)/.+)?[^/]+\.py$
|
||||||
- repo: https://gitlab.com/pycqa/flake8
|
- repo: https://gitlab.com/pycqa/flake8
|
||||||
rev: 3.7.8
|
rev: 3.7.8
|
||||||
hooks:
|
hooks:
|
||||||
@ -13,6 +14,7 @@ repos:
|
|||||||
additional_dependencies:
|
additional_dependencies:
|
||||||
- flake8-docstrings==1.3.1
|
- flake8-docstrings==1.3.1
|
||||||
- pydocstyle==4.0.0
|
- pydocstyle==4.0.0
|
||||||
|
files: ^(homeassistant|script|tests)/.+\.py$
|
||||||
# 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
|
||||||
@ -26,4 +28,4 @@ repos:
|
|||||||
language: system
|
language: system
|
||||||
types: [python]
|
types: [python]
|
||||||
require_serial: true
|
require_serial: true
|
||||||
exclude: ^script/scaffold/templates/
|
files: ^homeassistant/.+\.py$
|
||||||
|
@ -27,7 +27,10 @@ matrix:
|
|||||||
- python: "3.7"
|
- python: "3.7"
|
||||||
env: TOXENV=py37
|
env: TOXENV=py37
|
||||||
|
|
||||||
cache: pip
|
cache:
|
||||||
|
pip: true
|
||||||
|
directories:
|
||||||
|
- $HOME/.cache/pre-commit
|
||||||
install: pip install -U tox
|
install: pip install -U tox
|
||||||
language: python
|
language: python
|
||||||
script: travis_wait 50 tox --develop
|
script: travis_wait 50 tox --develop
|
||||||
|
@ -45,9 +45,10 @@ stages:
|
|||||||
|
|
||||||
. venv/bin/activate
|
. venv/bin/activate
|
||||||
pip install -r requirements_test.txt -c homeassistant/package_constraints.txt
|
pip install -r requirements_test.txt -c homeassistant/package_constraints.txt
|
||||||
|
pre-commit install-hooks
|
||||||
- script: |
|
- script: |
|
||||||
. venv/bin/activate
|
. venv/bin/activate
|
||||||
flake8 homeassistant tests script
|
pre-commit run flake8 --all-files
|
||||||
displayName: 'Run flake8'
|
displayName: 'Run flake8'
|
||||||
- job: 'Validate'
|
- job: 'Validate'
|
||||||
pool:
|
pool:
|
||||||
@ -83,9 +84,10 @@ stages:
|
|||||||
|
|
||||||
. venv/bin/activate
|
. venv/bin/activate
|
||||||
pip install -r requirements_test.txt -c homeassistant/package_constraints.txt
|
pip install -r requirements_test.txt -c homeassistant/package_constraints.txt
|
||||||
|
pre-commit install-hooks
|
||||||
- script: |
|
- script: |
|
||||||
. venv/bin/activate
|
. venv/bin/activate
|
||||||
./script/check_format
|
pre-commit run black --all-files
|
||||||
displayName: 'Check Black formatting'
|
displayName: 'Check Black formatting'
|
||||||
|
|
||||||
- stage: 'Tests'
|
- stage: 'Tests'
|
||||||
@ -180,7 +182,8 @@ stages:
|
|||||||
|
|
||||||
. venv/bin/activate
|
. venv/bin/activate
|
||||||
pip install -e . -r requirements_test.txt -c homeassistant/package_constraints.txt
|
pip install -e . -r requirements_test.txt -c homeassistant/package_constraints.txt
|
||||||
|
pre-commit install-hooks
|
||||||
- script: |
|
- script: |
|
||||||
. venv/bin/activate
|
. venv/bin/activate
|
||||||
mypy homeassistant
|
pre-commit run mypy --all-files
|
||||||
displayName: 'Run mypy'
|
displayName: 'Run mypy'
|
||||||
|
4
tox.ini
4
tox.ini
@ -34,11 +34,11 @@ deps =
|
|||||||
commands =
|
commands =
|
||||||
python -m script.gen_requirements_all validate
|
python -m script.gen_requirements_all validate
|
||||||
python -m script.hassfest validate
|
python -m script.hassfest validate
|
||||||
flake8 {posargs: homeassistant tests script}
|
pre-commit run flake8 {posargs: --all-files}
|
||||||
|
|
||||||
[testenv:typing]
|
[testenv:typing]
|
||||||
deps =
|
deps =
|
||||||
-r{toxinidir}/requirements_test.txt
|
-r{toxinidir}/requirements_test.txt
|
||||||
-c{toxinidir}/homeassistant/package_constraints.txt
|
-c{toxinidir}/homeassistant/package_constraints.txt
|
||||||
commands =
|
commands =
|
||||||
mypy homeassistant
|
pre-commit run mypy {posargs: --all-files}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user