pre-commit: ship default and full configs (#28463)
For now, the only difference between the two is mypy.
This commit is contained in:
parent
b8fa5367db
commit
a8dff2f2d0
6 changed files with 56 additions and 21 deletions
42
.pre-commit-config-all.yaml
Normal file
42
.pre-commit-config-all.yaml
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
# This configuration includes the full set of hooks we use. In
|
||||||
|
# addition to the defaults (see .pre-commit-config.yaml), this
|
||||||
|
# includes hooks that require our development and test dependencies
|
||||||
|
# installed and the virtualenv containing them active by the time
|
||||||
|
# pre-commit runs to produce correct results.
|
||||||
|
#
|
||||||
|
# If this is not a problem for your workflow, using this config is
|
||||||
|
# recommended, install it with
|
||||||
|
# pre-commit install --config .pre-commit-config-all.yaml
|
||||||
|
# Otherwise, see the default .pre-commit-config.yaml for a lighter one.
|
||||||
|
|
||||||
|
repos:
|
||||||
|
- repo: https://github.com/psf/black
|
||||||
|
rev: 19.10b0
|
||||||
|
hooks:
|
||||||
|
- id: black
|
||||||
|
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
|
||||||
|
# another set of our dependencies there... no. Use the "system" one
|
||||||
|
# and reuse the environment that is set up anyway already instead.
|
||||||
|
- repo: local
|
||||||
|
hooks:
|
||||||
|
- id: mypy
|
||||||
|
name: mypy
|
||||||
|
entry: mypy
|
||||||
|
language: system
|
||||||
|
types: [python]
|
||||||
|
require_serial: true
|
||||||
|
files: ^homeassistant/.+\.py$
|
|
@ -1,3 +1,10 @@
|
||||||
|
# This configuration includes the default, minimal set of hooks to be
|
||||||
|
# run on all commits. It requires no specific setup and one can just
|
||||||
|
# start using pre-commit with it.
|
||||||
|
#
|
||||||
|
# See .pre-commit-config-all.yaml for a more complete one that comes
|
||||||
|
# with a better coverage at the cost of some specific setup needed.
|
||||||
|
|
||||||
repos:
|
repos:
|
||||||
- repo: https://github.com/psf/black
|
- repo: https://github.com/psf/black
|
||||||
rev: 19.10b0
|
rev: 19.10b0
|
||||||
|
@ -15,17 +22,3 @@ repos:
|
||||||
- flake8-docstrings==1.3.1
|
- flake8-docstrings==1.3.1
|
||||||
- pydocstyle==4.0.0
|
- pydocstyle==4.0.0
|
||||||
files: ^(homeassistant|script|tests)/.+\.py$
|
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
|
|
||||||
# another set of our dependencies there... no. Use the "system" one
|
|
||||||
# and reuse the environment that is set up anyway already instead.
|
|
||||||
- repo: local
|
|
||||||
hooks:
|
|
||||||
- id: mypy
|
|
||||||
name: mypy
|
|
||||||
entry: mypy
|
|
||||||
language: system
|
|
||||||
types: [python]
|
|
||||||
require_serial: true
|
|
||||||
files: ^homeassistant/.+\.py$
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ 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
|
pre-commit install-hooks --config .pre-commit-config-all.yaml
|
||||||
- script: |
|
- script: |
|
||||||
. venv/bin/activate
|
. venv/bin/activate
|
||||||
pre-commit run flake8 --all-files
|
pre-commit run flake8 --all-files
|
||||||
|
@ -84,7 +84,7 @@ 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
|
pre-commit install-hooks --config .pre-commit-config-all.yaml
|
||||||
- script: |
|
- script: |
|
||||||
. venv/bin/activate
|
. venv/bin/activate
|
||||||
pre-commit run black --all-files
|
pre-commit run black --all-files
|
||||||
|
@ -182,8 +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
|
pre-commit install-hooks --config .pre-commit-config-all.yaml
|
||||||
- script: |
|
- script: |
|
||||||
. venv/bin/activate
|
. venv/bin/activate
|
||||||
pre-commit run mypy --all-files
|
pre-commit run --config .pre-commit-config-all.yaml mypy --all-files
|
||||||
displayName: 'Run mypy'
|
displayName: 'Run mypy'
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
# make new things fail. Manually update these pins when pulling in a
|
# make new things fail. Manually update these pins when pulling in a
|
||||||
# new version
|
# new version
|
||||||
|
|
||||||
# When updating this file, update .pre-commit-config.yaml too
|
# When updating this file, update .pre-commit-config*.yaml too
|
||||||
asynctest==0.13.0
|
asynctest==0.13.0
|
||||||
black==19.10b0
|
black==19.10b0
|
||||||
codecov==2.0.15
|
codecov==2.0.15
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
# make new things fail. Manually update these pins when pulling in a
|
# make new things fail. Manually update these pins when pulling in a
|
||||||
# new version
|
# new version
|
||||||
|
|
||||||
# When updating this file, update .pre-commit-config.yaml too
|
# When updating this file, update .pre-commit-config*.yaml too
|
||||||
asynctest==0.13.0
|
asynctest==0.13.0
|
||||||
black==19.10b0
|
black==19.10b0
|
||||||
codecov==2.0.15
|
codecov==2.0.15
|
||||||
|
|
2
tox.ini
2
tox.ini
|
@ -41,4 +41,4 @@ 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 =
|
||||||
pre-commit run mypy {posargs: --all-files}
|
pre-commit run --config .pre-commit-config-all.yaml mypy {posargs: --all-files}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue