Merged
Conversation
Reviewer's GuideAdds official pre-commit hook definitions for ruff-sync, introduces dedicated pre-commit documentation, updates README and CI docs to reference the new hooks, and wires the new page into the MkDocs navigation. Sequence diagram for ruff-sync pre-commit hooks executionsequenceDiagram
actor Developer
participant git
participant pre_commit
participant ruff_sync_check_hook
participant ruff_sync_cli
participant Upstream_config_server
Developer->>git: git commit
git->>pre_commit: trigger pre-commit
pre_commit->>ruff_sync_check_hook: run hook ruff-sync-check
ruff_sync_check_hook->>ruff_sync_cli: execute ruff-sync check --semantic
ruff_sync_cli->>ruff_sync_cli: load [tool.ruff-sync] config
ruff_sync_cli->>ruff_sync_cli: check cache and timestamps
alt cache_miss_or_stale
ruff_sync_cli->>Upstream_config_server: fetch upstream ruff config
Upstream_config_server-->>ruff_sync_cli: upstream configuration
end
ruff_sync_cli->>ruff_sync_cli: compare local vs upstream (semantic)
alt configs_in_sync
ruff_sync_cli-->>ruff_sync_check_hook: exit 0 (pass)
ruff_sync_check_hook-->>pre_commit: hook passed
pre_commit-->>git: allow commit
git-->>Developer: commit succeeds
else drift_detected
ruff_sync_cli-->>ruff_sync_check_hook: exit 1 (fail)
ruff_sync_check_hook-->>pre_commit: hook failed
pre_commit-->>Developer: show drift error
end
note over Developer,ruff_sync_cli: ruff-sync-pull would follow a similar flow but applies upstream config when drift is detected
Flow diagram for how pre-commit uses the new ruff-sync hook definitionsgraph TD
A[Developer defines pre-commit config
in .pre-commit-config.yaml
- repo: https://github.com/Kilo59/ruff-sync
- hooks: ruff-sync-check / ruff-sync-pull] --> B[pre-commit framework
reads .pre-commit-config.yaml]
B --> C[pre-commit clones ruff-sync repo]
C --> D[pre-commit reads .pre-commit-hooks.yaml
in ruff-sync repo]
D --> E[Hook id ruff-sync-check
mapped to entry ruff-sync check --semantic]
D --> F[Hook id ruff-sync-pull
mapped to entry ruff-sync pull]
E --> G[On git commit, pre-commit
executes ruff-sync check --semantic]
F --> H[On git commit, pre-commit
executes ruff-sync pull]
G --> I[Local config validated
against upstream]
H --> J[Local config updated
from upstream if drift detected]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #106 +/- ##
=======================================
Coverage 90.60% 90.60%
=======================================
Files 3 3
Lines 575 575
=======================================
Hits 521 521
Misses 54 54 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Hey - I've found 1 issue, and left some high level feedback:
- In
.pre-commit-hooks.yaml, usingadditional_dependencies: ["ruff-sync"]for hooks that live in theruff-syncrepo itself is redundant and can cause version skew when the repo is tagged; you can rely on the package from this repo and dropadditional_dependenciesunless you truly need extra third-party deps. - Both hooks in
.pre-commit-hooks.yamlare restricted tofiles: ^pyproject\.toml$, but the docs mention supportingruff.tomlas well; consider broadening the file pattern (or making it configurable) so projects usingruff.tomlor non-root configs are also checked.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In `.pre-commit-hooks.yaml`, using `additional_dependencies: ["ruff-sync"]` for hooks that live in the `ruff-sync` repo itself is redundant and can cause version skew when the repo is tagged; you can rely on the package from this repo and drop `additional_dependencies` unless you truly need extra third-party deps.
- Both hooks in `.pre-commit-hooks.yaml` are restricted to `files: ^pyproject\.toml$`, but the docs mention supporting `ruff.toml` as well; consider broadening the file pattern (or making it configurable) so projects using `ruff.toml` or non-root configs are also checked.
## Individual Comments
### Comment 1
<location path="mkdocs.yml" line_range="109-110" />
<code_context>
- Home: index.md
- Installation: installation.md
- Usage: usage.md
- - Configuration: configuration.md
- - CI Integration: ci-integration.md
+ - Configuration: configuration.md
+ - Pre-commit: pre-commit.md
</code_context>
<issue_to_address>
**issue (bug_risk):** The nested nav items under `Usage` are likely not structured as MkDocs expects for a section with children.
Because `- Usage: usage.md` defines `Usage` as a single page, the indented items become a sequence value for that page key rather than children in a section. To make `Usage` a section with its own page plus children, structure it like:
```yaml
- Usage:
- Usage: usage.md
- Configuration: configuration.md
- Pre-commit: pre-commit.md
- CI Integration: ci-integration.md
```
Otherwise the YAML may not parse or the nav may not render as intended.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Contributor
|
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.
Summary by Sourcery
Document and expose official pre-commit hooks for ruff-sync and link them from the main docs and README.
New Features:
Documentation: