Skip to content

Commit

Permalink
Use pre-commit in CI and tox (home-assistant#27743)
Browse files Browse the repository at this point in the history
  • Loading branch information
scop authored and balloob committed Oct 18, 2019
1 parent a119932 commit 103ffac
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
4 changes: 3 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ repos:
args:
- --safe
- --quiet
files: ^((homeassistant|script|tests)/.+)?[^/]+\.py$
- repo: https://gitlab.com/pycqa/flake8
rev: 3.7.8
hooks:
- id: flake8
additional_dependencies:
- flake8-docstrings==1.3.1
- pydocstyle==4.0.0
files: ^(homeassistant|script|tests)/.+\.py$
# 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
Expand All @@ -26,4 +28,4 @@ repos:
language: system
types: [python]
require_serial: true
exclude: ^script/scaffold/templates/
files: ^homeassistant/.+\.py$
5 changes: 4 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ matrix:
- python: "3.7"
env: TOXENV=py37

cache: pip
cache:
pip: true
directories:
- $HOME/.cache/pre-commit
install: pip install -U tox
language: python
script: travis_wait 50 tox --develop
9 changes: 6 additions & 3 deletions azure-pipelines-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,10 @@ stages:
. venv/bin/activate
pip install -r requirements_test.txt -c homeassistant/package_constraints.txt
pre-commit install-hooks
- script: |
. venv/bin/activate
flake8 homeassistant tests script
pre-commit run flake8 --all-files
displayName: 'Run flake8'
- job: 'Validate'
pool:
Expand Down Expand Up @@ -83,9 +84,10 @@ stages:
. venv/bin/activate
pip install -r requirements_test.txt -c homeassistant/package_constraints.txt
pre-commit install-hooks
- script: |
. venv/bin/activate
./script/check_format
pre-commit run black --all-files
displayName: 'Check Black formatting'
- stage: 'Tests'
Expand Down Expand Up @@ -180,7 +182,8 @@ stages:
. venv/bin/activate
pip install -e . -r requirements_test.txt -c homeassistant/package_constraints.txt
pre-commit install-hooks
- script: |
. venv/bin/activate
mypy homeassistant
pre-commit run mypy --all-files
displayName: 'Run mypy'
4 changes: 2 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ deps =
commands =
python -m script.gen_requirements_all validate
python -m script.hassfest validate
flake8 {posargs: homeassistant tests script}
pre-commit run flake8 {posargs: --all-files}

[testenv:typing]
deps =
-r{toxinidir}/requirements_test.txt
-c{toxinidir}/homeassistant/package_constraints.txt
commands =
mypy homeassistant
pre-commit run mypy {posargs: --all-files}

0 comments on commit 103ffac

Please sign in to comment.