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 114 115 116 117 118 119 120 121 122 123 124 125
|
default_language_version:
# force all unspecified python hooks to run python3
python: default
repos:
# Run manually in CI skipping the branch checks
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.14.6
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.2
hooks:
- id: bandit
name: "Bandit checking"
args:
- --quiet
- --format=custom
- --configfile=tests/bandit.yaml
files: ^(plugwise|tests)/.+\.py$
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.37.1
hooks:
- id: yamllint
name: "YAML linting"
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.10.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: ^(plugwise|tests)/.+\.py$
- repo: local
hooks:
# Run mypy through our wrapper script in order to get the possible
# pyenv and/or virtualenv activated; it may not have been e.g. if
# committing from a GUI tool that was not launched from an activated
# shell.
- id: setup
name: "Setup"
entry: /usr/bin/env bash -c 'test -d ./venv || scripts/setup.sh'
language: script
- id: setup_test
name: "Setup (extended for testing"
entry: /usr/bin/env bash -c 'test -f ./tmp/biome || scripts/setup_test.sh pre-commit'
language: script
- id: userdata
name: "Validating userdata"
entry: scripts/pre-commit.sh
language: script
types: [python]
pass_filenames: false
- id: mypy
name: "Running MyPy"
entry: scripts/run-in-env.sh mypy
language: script
types: [python]
require_serial: true
files: ^plugwise/$
- id: pylint
name: "PyLinting"
entry: scripts/run-in-env.sh pylint -j 0
language: script
types: [python]
files: ^plugwise/.+\.py$
- id: testing
name: "Performing Tests"
# yamllint disable-line rule:line-length
entry: /usr/bin/env bash -c 'exec env GITHUB_ACTIONS="1" NO_FIXTURES="1" scripts/tests_and_coverage.sh test_and_coverage'
language: script
pass_filenames: false
- id: biome
name: "Biome (prettier)"
entry: ./tmp/biome check fixtures/ plugwise/ tests/ --files-ignore-unknown=true --no-errors-on-unmatched --json-formatter-indent-width=2 --json-formatter-indent-style=space
language: script
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.46.0
hooks:
- id: markdownlint
|