From 0d346674ea2df00aab65dae812e4ef9364bcc858 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ab=C3=ADlio=20Costa?= Date: Fri, 6 Nov 2026 15:11:24 +0000 Subject: [PATCH] Run prek only on changed files in agent instructions (#190786) Co-authored-by: Claude Opus 5.5 --- .github/copilot-instructions.md | 2 +- AGENTS.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 1a66ad68b803..3831457a0531 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -156,7 +156,7 @@ This repository contains the core of Home Assistant, a Python 3 based home autom - Run "python3" in current virtual environment to ensure the correct Python version is used for testing. - When entering a new environment or worktree, run `script/setup` to set up the virtual environment with all development dependencies (pylint, pre-commit hooks, etc.). This is required before committing. If uv reports that no download was found for the required Python version, the environment is running an outdated version of uv; upgrade it with `curl -LsSf https://astral.sh/uv/install.sh | sh` and run `script/setup` again. - .vscode/tasks.json contains useful commands used for development. -- After finishing a code session, run `uv run --no-sync prek run --all-files` to check for linting and formatting issues. +- After finishing a code session, run `base=$(git merge-base HEAD dev) && uv run --no-sync prek run --files $(git diff --name-only --diff-filter=d "$base"; git ls-files --others --exclude-standard)` to check the files changed on the branch (committed, uncommitted and untracked) for linting and formatting issues. ## Python Syntax Notes diff --git a/AGENTS.md b/AGENTS.md index 99a1155b455e..4edfbdd5ecf4 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -16,7 +16,7 @@ This repository contains the core of Home Assistant, a Python 3 based home autom - Run "python3" in current virtual environment to ensure the correct Python version is used for testing. - When entering a new environment or worktree, run `script/setup` to set up the virtual environment with all development dependencies (pylint, pre-commit hooks, etc.). This is required before committing. If uv reports that no download was found for the required Python version, the environment is running an outdated version of uv; upgrade it with `curl -LsSf https://astral.sh/uv/install.sh | sh` and run `script/setup` again. - .vscode/tasks.json contains useful commands used for development. -- After finishing a code session, run `uv run --no-sync prek run --all-files` to check for linting and formatting issues. +- After finishing a code session, run `base=$(git merge-base HEAD dev) && uv run --no-sync prek run --files $(git diff --name-only --diff-filter=d "$base"; git ls-files --others --exclude-standard)` to check the files changed on the branch (committed, uncommitted and untracked) for linting and formatting issues. ## Python Syntax Notes