mirror of
https://github.com/kuhyx/utils.git
synced 2026-11-10 21:27:14 +01:00
The hook entry was an absolute /home/kuhy/utils path, copied from a config written for ~/.claude where it only ever ran locally. On an Actions runner that is exit code 127 — "No such file or directory" — so gatelock-precommit and crdt-sync-precommit failed on every commit of this refactor while the hook silently checked nothing. Now repo-relative, matching the sibling hooks (`entry: scripts/check_subproject_scope.sh`): pre-commit always runs from the git root, so it resolves the same in both places. Fixing that made the CI configs runnable locally, and `--all-files` then found what per-file runs had missed — ruff pruning imports that exist *for* their re-export. `import crdt_sync` was broken three separate ways (FileSyncStateStore, encode_key, FileCredentialStore). Each affected module now states an explicit __all__ so the autofixer cannot take them again, and the two files that pushed past the cap once __all__ was added are split further: _firebase.py 260 -> 247 + _fberrors 25 _sync.py 257 -> 188 + _syncargs 91 Test patch targets followed the code they patch: gatelock._outputs.shutil -> _xrandr.shutil, gatelock._arbiter.Path -> _claims.Path. gatelock and crdt-sync both pass `pre-commit run --all-files` in full; 389 and 259 tests at 100% branch coverage; the root gate exits 0. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CFSGeWxHPY5rHUGrPqhcmG
67 lines
2.5 KiB
YAML
67 lines
2.5 KiB
YAML
# Pre-commit Configuration for sync_settings_ui
|
|
# Install: pre-commit install && pre-commit install --hook-type pre-push
|
|
# Run: pre-commit run --all-files
|
|
|
|
# NOTE: this subproject lives inside the ~/utils monorepo, whose git root is
|
|
# one level up. pre-commit always runs hooks from the git root, so every path
|
|
# below is written relative to THAT, not to this directory, and the top-level
|
|
# `files` key keeps these hooks off the sibling subprojects. CI invokes this
|
|
# config exactly the same way:
|
|
# pre-commit run --config sync_settings_ui/.pre-commit-config.yaml --all-files
|
|
files: ^sync_settings_ui/
|
|
|
|
default_stages: [pre-commit]
|
|
fail_fast: false
|
|
|
|
repos:
|
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
rev: v4.6.0
|
|
hooks:
|
|
- id: trailing-whitespace
|
|
args: [--markdown-linebreak-ext=md]
|
|
- id: end-of-file-fixer
|
|
- id: check-yaml
|
|
- id: check-merge-conflict
|
|
- id: mixed-line-ending
|
|
args: [--fix=lf]
|
|
|
|
- repo: local
|
|
hooks:
|
|
- id: file-length-cap
|
|
name: file length <= 250 lines
|
|
entry: bash scripts/check_file_length.sh
|
|
language: system
|
|
pass_filenames: true
|
|
- id: subproject-scope
|
|
name: subproject scope regex still matches
|
|
entry: scripts/check_subproject_scope.sh sync_settings_ui
|
|
language: script
|
|
# always_run so the top-level `files` filter cannot skip the one hook
|
|
# whose job is to notice that filter has stopped matching anything.
|
|
always_run: true
|
|
pass_filenames: false
|
|
- id: no-crdt-sync-override
|
|
name: no local dependency_overrides on a utils git dependency
|
|
entry: scripts/check_no_crdt_sync_override.sh sync_settings_ui/pubspec.yaml
|
|
language: script
|
|
pass_filenames: false
|
|
- id: dart-format
|
|
name: dart format --set-exit-if-changed
|
|
entry: bash -c 'cd sync_settings_ui && dart format --set-exit-if-changed lib test'
|
|
language: system
|
|
pass_filenames: false
|
|
- id: flutter-analyze
|
|
name: flutter analyze
|
|
entry: bash -c 'cd sync_settings_ui && flutter analyze'
|
|
language: system
|
|
pass_filenames: false
|
|
- id: flutter-test-coverage
|
|
name: flutter test --coverage with 100% line-coverage gate
|
|
entry: >-
|
|
bash -c 'cd sync_settings_ui && flutter test --coverage &&
|
|
scripts/check_coverage.sh coverage/lcov.info 100'
|
|
language: system
|
|
pass_filenames: false
|
|
require_serial: true
|
|
stages: [pre-push]
|