hass.tibber_prices/.pre-commit-config.yaml
Julian Pawlowski aee1920292 chore(pre-commit): add docusaurus build guard for changed docs sites
Add a local pre-commit hook that builds Docusaurus when files under
docs/user or docs/developer are staged.

Introduced scripts/docs/build-changed-sites to detect which docs site
was touched and run only the required npm build(s).

Impact: Prevents broken MDX/Docusaurus changes from being committed by
failing fast in pre-commit before CI.
2026-04-09 18:41:41 +00:00

32 lines
1.1 KiB
YAML

# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
#
# This configuration uses local hooks that rely on packages
# defined in requirements.txt, avoiding separate pre-commit environments.
repos:
- repo: local
hooks:
# Run the Ruff linter with auto-fix
- id: ruff
name: ruff
entry: bash -c 'source $HOME/.venv/bin/activate && ruff check --fix --exit-non-zero-on-fix "$@"' --
language: system
types: [python]
require_serial: true
# Run the Ruff formatter
- id: ruff-format
name: ruff format
entry: bash -c 'source $HOME/.venv/bin/activate && ruff format "$@"' --
language: system
types: [python]
require_serial: true
# Build changed Docusaurus site(s) to catch MDX/build errors early
- id: docusaurus-build-changed-sites
name: docusaurus build (changed sites)
entry: bash scripts/docs/build-changed-sites
language: system
files: ^docs/(user|developer)/
pass_filenames: true
require_serial: true