Repository navigation
Add annotations for various lock files - #610
Merged
Merged
Conversation
asottile
approved these changes
Sep 26, 2026
AndrewDongminYoo
added a commit
to AndrewDongminYoo/toml-tidy
that referenced
this pull request
Oct 26, 2026
## Summary The pre-commit hook selected files with `types: [toml]` only, and pre-commit's `identify` tags `uv.lock`, `poetry.lock` and `Cargo.lock` as `toml`, so the default hook configuration rewrote generated lockfiles. The hook now also declares `files: (?i)(\.toml|(^|/)Pipfile)$`; pre-commit requires a file to match both `files` and `types`, so lockfiles never reach it. The README example drops its `exclude: ^uv\.lock$` workaround and states the new default. Closes #35 ## Verification Gates at `93ba676`: - `uv run pytest` → exit 0 (231 passed, 3 skipped) - `uv run ruff check src tests` → exit 0 - `uv run basedpyright` → exit 0 - `uv run ruff format --check src tests` → exit 0 `tests/test_hook_manifest.py` reads the `files` pattern from the manifest and checks it with `re.search`, the way pre-commit filters filenames. End-to-end check with `uvx pre-commit try-repo <worktree> toml-tidy --all-files` in scratch repositories, each fixture file holding unsorted `b = 1` / `a = 2`: | File | `--ref HEAD` (current main) | This branch | | --- | --- | --- | | `uv.lock`, `poetry.lock`, `Cargo.lock` | rewritten | unchanged | | `Pipfile`, `nested/Pipfile` | rewritten | rewritten | | `config.toml`, `nested/settings.toml`, `upper/CONFIG.TOML` | rewritten | rewritten | Local review: Small tier (3 files, 55 added lines, no change under `src/`), reviewed inline against the issue. The automated review flagged that a plain `\.toml$` narrowed coverage beyond lockfiles (upper-case extensions and `Pipfile`, which `identify` also tags as toml); both are kept by the final pattern. The local Codex drain did not run because the machine was saturated (load average above 100); the hosted review below covers the same head. Hosted review: Codex code review and security review both completed with no findings at `93ba676`, and CI passed at the same commit. CodeRabbit skipped the automatic review because the repository has fewer than 10 stars, so Codex was the only hosted reviewer. ## Decisions taken where the brief was silent `exclude_types: [cargo-lock, poetry-lock, uv-lock]` is not used: `identify` added the `uv-lock` and `poetry-lock` tags on 2026-09-26 (pre-commit/identify#610), and pre-commit's `check_type_tag` refuses to load a hook naming a tag the installed `identify` does not know. A regex `exclude` in the manifest is not used either, because a user's own `exclude` replaces it, while `files` is rarely overridden. `(?i)` keeps `.TOML` and `.Toml` files in scope, since `identify` tags TOML extensions in any case; it sits at the start of the pattern because Python 3.11+ rejects a global inline flag elsewhere. `Pipfile` stays in scope because it is the only toml-tagged file name that is neither a lockfile nor `*.toml`, and the hook already formatted it. `CHANGELOG.md` is left to the next release PR, as with recent feature and fix PRs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

No description provided.