feat: add prek pre-commit setup and enhance mise integration#152
Conversation
Current Aviator status
This PR was merged manually (without Aviator). Merging manually can negatively impact the performance of the queue. Consider using Aviator next time.
See the real-time status of this PR on the
Aviator webapp.
Use the Aviator Chrome Extension
to see the status of your PR within GitHub.
|
Co-authored-by: Ven0m0 <82972344+Ven0m0@users.noreply.github.com>
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
There was a problem hiding this comment.
Pull request overview
Adds a working prek/pre-commit setup and makes installation/running available via mise tasks, with a simplified run_pre_commit.sh wrapper.
Changes:
- Introduces
.pre-commit-config.yamlwith standard pre-commit-hooks plus local hooks (ruff/eslint/biome/aglint/shellcheck/unit tests). - Extends
misetasks to runuv syncon install and adds tasks to install/run prek hooks. - Replaces the old
run_pre_commit.shtest runner withuv run prek run, with a fallback whenuvis missing.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| run_pre_commit.sh | Replaces ad-hoc test/script execution with prek invocation (and a fallback path). |
| mise.toml | Adds uv sync to install and provides precommit:* tasks to install/run hooks. |
| .pre-commit-config.yaml | Defines the actual pre-commit/prek hooks executed by the repo. |
| - id: check-added-large-files | ||
| args: [--maxkb=1024] | ||
| - id: check-merge-conflict | ||
| - id: mixed-line-ending |
There was a problem hiding this comment.
The PR description says the generated dirs are excluded for these hooks, but the config only applies exclude: to trailing-whitespace and end-of-file-fixer. As written, check-added-large-files / check-merge-conflict / mixed-line-ending will still run (and potentially fail/modify) on lists/releases/, lists/external/, Filters/, and userscripts/dist/. Consider adding the same exclude: to the remaining relevant hooks, or add a top-level exclude: so the exclusion is applied consistently to all hooks.
| - id: check-added-large-files | |
| args: [--maxkb=1024] | |
| - id: check-merge-conflict | |
| - id: mixed-line-ending | |
| - id: check-added-large-files | |
| exclude: ^(lists/(releases|external)/|Filters/|userscripts/dist/) | |
| args: [--maxkb=1024] | |
| - id: check-merge-conflict | |
| exclude: ^(lists/(releases|external)/|Filters/|userscripts/dist/) | |
| - id: mixed-line-ending | |
| exclude: ^(lists/(releases|external)/|Filters/|userscripts/dist/) |
| uv run prek run "${@}" | ||
| else | ||
| # Fallback: run checks manually if uv/prek is unavailable | ||
| python3 -m unittest discover -s Scripts/ -p 'test_*.py' |
There was a problem hiding this comment.
This wrapper no longer runs python3 Scripts/deduplicate.py (which the prior version executed as “Test actual script”). If running deduplicate.py is still intended as part of the pre-commit workflow, it should be added as a dedicated pre-commit hook (preferred) or included in the fallback path so behavior remains consistent when developers use this script.
| python3 -m unittest discover -s Scripts/ -p 'test_*.py' | |
| python3 -m unittest discover -s Scripts/ -p 'test_*.py' | |
| python3 Scripts/deduplicate.py |
Wires up
prek(already a declared dev dependency) with an actual config and git hook installation path; adds mise tasks to make setup one-command..pre-commit-config.yaml(new)Defines two hook groups:
pre-commit/pre-commit-hooks: trailing-whitespace, end-of-file-fixer, check-yaml, check-added-large-files (≤1 MB), check-merge-conflict, mixed-line-ending — all excluding generated dirs (lists/releases/,lists/external/,Filters/,userscripts/dist/)local(system language via mise): ruff check+format, eslint, biome, aglint (scoped tolists/{sources,adblock,hostlist}/), shellcheck, and Python unit tests (triggered only onScripts/*.pychanges)mise.tomlinstalltask now also runsuv syncso prek and other Python dev deps are always presentprecommit:install— runsuv run prek install --overwriteto wire the git hookprecommit:run— runsuv run prek run --all-filesfor manual full sweepsrun_pre_commit.shReplaced manual Python test invocation with
uv run prek run "${@}", falling back to directunittest discoverifuvis absent. Updated toset -Eeuo pipefailper project shell conventions.✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.