1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
|
default_language_version:
# force all unspecified python hooks to run python3
python: python3.14
repos:
# Run manually in CI skipping the branch checks
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.14.14
hooks:
- id: ruff
name: "Ruff check"
args:
- --fix
- id: ruff-format
name: "Ruff format"
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: check-executables-have-shebangs
name: "Check scripts"
stages: [manual]
- id: no-commit-to-branch
name: "Check branch"
args:
- --branch=main
- repo: https://github.com/asottile/pyupgrade
rev: v3.21.2
hooks:
- id: pyupgrade
name: "Check Py upgrade"
args: [--py311-plus]
- repo: https://github.com/codespell-project/codespell
rev: v2.4.1
hooks:
- id: codespell
name: "Check Code Spelling"
args:
- --ignore-words-list=aiport,astroid,checkin,currenty,hass,iif,incomfort,lookin,nam,NotIn
- --skip="./.*,*.csv,*.json,*.ambr"
- --quiet-level=2
exclude_types: [csv, json]
exclude: ^userdata/|^fixtures/
- repo: https://github.com/PyCQA/bandit
rev: 1.9.3
hooks:
- id: bandit
name: "Bandit checking"
args:
- --quiet
- --format=custom
- --configfile=tests/bandit.yaml
files: ^(airos|tests|script)/.+\.py$
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.38.0
hooks:
- id: yamllint
name: "YAML linting"
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.11.0.1
hooks:
- id: shellcheck
name: "Shell checking"
args:
- --external-sources
- repo: https://github.com/cdce8p/python-typing-update
rev: v0.8.1
hooks:
# Run `python-typing-update` hook manually from time to time
# to update python typing syntax.
# Will require manual work, before submitting changes!
- id: python-typing-update
name: "Python typing"
stages: [manual]
args:
- --py39-plus
- --force
- --keep-updates
files: ^(airos|tests|script)/.+\.py$
- repo: https://github.com/jackdewinter/pymarkdown
rev: v0.9.35
hooks:
- id: pymarkdown
name: MarkDown Lint
- repo: local
hooks:
- id: parsetest
name: "Generate AirOS Fixtures"
entry: script/run-in-env.sh python script/generate_ha_fixture.py
language: script
types: [python]
# Run when Python changes (to refresh against code changes) and when userdata JSON changes
files: ^(airos|tests|script)/.+\.py$|^fixtures/userdata/.+\.json$
pass_filenames: false
- id: pytest
name: "Testing using pytest"
entry: script/run-in-env.sh pytest --log-level info tests/ --cov='airos/'
language: script
types: [python]
pass_filenames: false
files: ^(airos|tests|script)/.+\.py$
- id: pylint
name: "Linting with pylint"
entry: script/run-in-env.sh pylint -j 0
language: script
types: [python]
files: ^(airos|tests|script)/.+\.py$
- id: mypy
name: "Typing check using mypy"
entry: script/run-in-env.sh mypy
language: script
require_serial: true
types_or: [python, pyi]
files: ^(airos|tests|script)/.+\.(py|pyi)$
|