Skip to content

Replace pre-commit by prek#160427

Merged
MartinHjelmare merged 3 commits intodevfrom
edenhaus-prek
Jan 13, 2026
Merged

Replace pre-commit by prek#160427
MartinHjelmare merged 3 commits intodevfrom
edenhaus-prek

Conversation

@edenhaus
Copy link
Copy Markdown
Member

@edenhaus edenhaus commented Jan 7, 2026

Breaking change

Proposed change

Replace pre-commit with prek (written in Rust for improved performance)

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

Checklist

  • I understand the code I am submitting and can explain how it works.
  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Ruff (ruff format homeassistant tests)
  • Tests have been added to verify that the new code works.
  • Any generated code has been carefully reviewed for correctness and compliance with project standards.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.

To help with the load of incoming pull requests:

@home-assistant home-assistant bot added cla-signed code-quality small-pr PRs with less than 30 lines. labels Jan 7, 2026
@edenhaus edenhaus marked this pull request as ready for review January 12, 2026 19:16
Copilot AI review requested due to automatic review settings January 12, 2026 19:17
@edenhaus edenhaus requested a review from a team as a code owner January 12, 2026 19:17
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR replaces pre-commit with prek, a Rust-based alternative that provides improved performance for running pre-commit hooks. The migration is comprehensive and affects development scripts, CI workflows, documentation, and configuration files.

Changes:

  • Replaced pre-commit package with prek==0.2.26 in test requirements
  • Updated all script invocations from pre-commit to prek command
  • Significantly simplified the CI workflow by consolidating multiple separate linting jobs into a single prek job that uses the j178/prek-action GitHub Action
  • Updated developer documentation and VS Code task configurations to reference prek instead of pre-commit

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.

Show a summary per file
File Description
script/setup Changed hook installation command from pre-commit install to prek install
script/lint_and_test.py Updated ruff execution to use prek run instead of pre-commit run
script/lint Changed shell script to invoke prek run ruff-check
script/hassfest/manifest.py Updated manifest sorting subprocess to use prek command
requirements_test.txt Replaced pre-commit==4.2.0 with prek==0.2.26
pylint/plugins/hass_enforce_type_hints.py Updated comment to reference prek instead of pre-commit
.vscode/tasks.json Updated VS Code tasks to use prek run commands and renamed "Pre-commit" task to "Prek"
.pre-commit-config.yaml Updated inline comment example to use prek run command (config file retained as prek uses same format)
.github/workflows/ci.yaml Major refactoring: removed separate lint jobs (lint-ruff-format, lint-ruff, lint-other), consolidated into single prek job using j178/prek-action; removed pre-commit cache management; updated job dependencies throughout workflow
.github/copilot-instructions.md Updated development command documentation to use prek run instead of pre-commit run

@MartinHjelmare MartinHjelmare merged commit ea7e94b into dev Jan 13, 2026
69 of 70 checks passed
@MartinHjelmare MartinHjelmare deleted the edenhaus-prek branch January 13, 2026 14:09
@github-actions github-actions bot locked and limited conversation to collaborators Jan 14, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

cla-signed code-quality small-pr PRs with less than 30 lines.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants