fix: correct import sorting and pin tool versions to fix CI lint#153
fix: correct import sorting and pin tool versions to fix CI lint#153Ckk3 wants to merge 6 commits intogazorby:mainfrom
Conversation
📝 WalkthroughWalkthroughThis PR updates CI cache identifiers, replaces remote pre-commit hooks with local/system invocations, adds a ruff pre-commit task, adjusts mise task invocations to use Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #153 +/- ##
=======================================
Coverage 94.28% 94.28%
=======================================
Files 69 69
Lines 5814 5814
Branches 770 770
=======================================
Hits 5482 5482
Misses 190 190
Partials 142 142 ☔ View full report in Codecov by Sentry. |
…classification The ruff `src = ["src/strawchemy"]` setting caused ruff to auto-detect subdirectories like `sqlalchemy/` and `strawberry/` (from __pycache__) as first-party packages. Changed to `src = ["src"]` so only `strawchemy` is detected as a source package. Also pinned ruff in pre-commit unasyncd hook to prevent version drift.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.pre-commit-config.yaml:
- Line 59: The YAML uses spaced bracket array syntax which triggers yamllint
`brackets` errors: update the entries for additional_dependencies to use compact
brackets without spaces (e.g., change additional_dependencies: [
"ruff>=0.14.10,<0.15" ] to additional_dependencies: ["ruff>=0.14.10,<0.15"]) and
make the same change for the other occurrence; ensure you only remove the space
after `[` and before `]` while keeping the string contents unchanged.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 6c59009c-88d6-4b92-8a94-a0bddc589d9b
⛔ Files ignored due to path filters (1)
uv.lockis excluded by!**/*.lock
📒 Files selected for processing (4)
.github/workflows/ci.yaml.pre-commit-config.yamlmise.tomlpyproject.toml
| hooks: | ||
| - id: unasyncd | ||
| additional_dependencies: [ "ruff" ] | ||
| additional_dependencies: [ "ruff>=0.14.10,<0.15" ] |
There was a problem hiding this comment.
Fix YAML bracket spacing to clear lint errors.
Line 59 and Line 76 use spaced bracket style that triggers YAMLlint brackets errors.
Proposed fix
- additional_dependencies: [ "ruff>=0.14.10,<0.15" ]
+ additional_dependencies: ["ruff>=0.14.10,<0.15"]
...
- types: [ python ]
+ types: [python]Also applies to: 76-76
🧰 Tools
🪛 YAMLlint (1.38.0)
[error] 59-59: too many spaces inside brackets
(brackets)
[error] 59-59: too many spaces inside brackets
(brackets)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In @.pre-commit-config.yaml at line 59, The YAML uses spaced bracket array
syntax which triggers yamllint `brackets` errors: update the entries for
additional_dependencies to use compact brackets without spaces (e.g., change
additional_dependencies: [ "ruff>=0.14.10,<0.15" ] to additional_dependencies:
["ruff>=0.14.10,<0.15"]) and make the same change for the other occurrence;
ensure you only remove the space after `[` and before `]` while keeping the
string contents unchanged.
| hooks: | ||
| - id: unasyncd | ||
| additional_dependencies: [ "ruff" ] | ||
| additional_dependencies: [ "ruff>=0.14.10,<0.15" ] |
There was a problem hiding this comment.
Version constraint should be in sync with pyproject.toml
There was a problem hiding this comment.
Oh I didnt saw that, I will fix it
| additional_dependencies: [ "ruff" ] | ||
| additional_dependencies: [ "ruff>=0.14.10,<0.15" ] | ||
|
|
||
| - repo: https://github.com/charliermarsh/ruff-pre-commit |
There was a problem hiding this comment.
We should also replace this hook with a system one, invoking mise targets
There was a problem hiding this comment.
I think is a nice improvement, I will add it
| name: lint | ||
| entry: mise run lint:pre-commit | ||
| language: python | ||
| entry: tools/mise run lint:pre-commit |
There was a problem hiding this comment.
This should not be needed, as mise is already installed by the gh action
There was a problem hiding this comment.
Since this repo already have a mise in this folder I thought will be nice to already use it in CI and in local env.
What do you think about it?
…o avoid version duplication
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (2)
.pre-commit-config.yaml (2)
55-63:⚠️ Potential issue | 🟡 MinorFix YAML bracket spacing to pass lint.
The YAML uses spaced brackets
[ python ]which triggers YAMLlint errors. Use compact brackets without spaces.Proposed fix
- types: [ python ] + types: [python]🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.pre-commit-config.yaml around lines 55 - 63, Update the YAML for the "unasyncd" pre-commit hook so the types list uses compact bracket spacing (remove the spaces inside the brackets) to satisfy yamllint; specifically edit the hook with id "unasyncd" (entry "uv run unasyncd") and change the types value from "[ python ]" to "[python]" (or alternatively convert to a multi-line YAML sequence) so the linter no longer flags bracket spacing.
65-73:⚠️ Potential issue | 🟡 MinorFix bracket spacing and consolidate local hooks.
Same bracket spacing issue as above. Additionally, consider consolidating the three
repo: localsections (unasyncd, ruff, lint) into a singlerepo: localblock with multiple hooks for better maintainability.Proposed fix for bracket spacing
- types: [python] + types: [python]Wait, line 71 shows
types: [ python ]with spaces - fix to:- types: [ python ] + types: [python]Optional consolidation of local hooks
- repo: local hooks: - id: unasyncd name: unasyncd entry: uv run unasyncd language: system types: [python] pass_filenames: false require_serial: true - id: ruff name: ruff entry: tools/mise run ruff:pre-commit language: system types: [python] pass_filenames: false require_serial: true - id: lint name: lint entry: tools/mise run lint:pre-commit language: system types: [python] pass_filenames: false require_serial: true🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.pre-commit-config.yaml around lines 65 - 73, Fix the bracket spacing by changing occurrences like types: [ python ] to types: [python] and consolidate the separate "repo: local" blocks into a single "repo: local" block containing multiple hook entries (include hooks for id: unasyncd, id: ruff, and id: lint) so each hook preserves its fields (name, entry, language, types: [python], pass_filenames: false, require_serial: true); ensure each hook uses the correct entry values (e.g., "uv run unasyncd", "tools/mise run ruff:pre-commit", "tools/mise run lint:pre-commit") and keep all existing settings when merging.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.pre-commit-config.yaml:
- Around line 79-83: Fix the bracket spacing for the pre-commit hook's types
list: locate the block with the "types:" key (the entry using tools/mise run
lint:pre-commit) and remove the extra space inside the square brackets so it
reads types: [python] (or use a quoted single-item list like types: ["python"])
to match the project's YAML style.
---
Duplicate comments:
In @.pre-commit-config.yaml:
- Around line 55-63: Update the YAML for the "unasyncd" pre-commit hook so the
types list uses compact bracket spacing (remove the spaces inside the brackets)
to satisfy yamllint; specifically edit the hook with id "unasyncd" (entry "uv
run unasyncd") and change the types value from "[ python ]" to "[python]" (or
alternatively convert to a multi-line YAML sequence) so the linter no longer
flags bracket spacing.
- Around line 65-73: Fix the bracket spacing by changing occurrences like types:
[ python ] to types: [python] and consolidate the separate "repo: local" blocks
into a single "repo: local" block containing multiple hook entries (include
hooks for id: unasyncd, id: ruff, and id: lint) so each hook preserves its
fields (name, entry, language, types: [python], pass_filenames: false,
require_serial: true); ensure each hook uses the correct entry values (e.g., "uv
run unasyncd", "tools/mise run ruff:pre-commit", "tools/mise run
lint:pre-commit") and keep all existing settings when merging.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 827fe0cf-ef20-4455-bfb1-9b240de5b566
📒 Files selected for processing (3)
.pre-commit-config.yamlmise.tomltasks.md
| entry: tools/mise run lint:pre-commit | ||
| language: system | ||
| types: [ python ] | ||
| pass_filenames: false | ||
| require_serial: true |
There was a problem hiding this comment.
Fix bracket spacing.
Same bracket spacing issue at line 81.
Proposed fix
- types: [ python ]
+ types: [python]📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| entry: tools/mise run lint:pre-commit | |
| language: system | |
| types: [ python ] | |
| pass_filenames: false | |
| require_serial: true | |
| entry: tools/mise run lint:pre-commit | |
| language: system | |
| types: [python] | |
| pass_filenames: false | |
| require_serial: true |
🧰 Tools
🪛 YAMLlint (1.38.0)
[error] 81-81: too many spaces inside brackets
(brackets)
[error] 81-81: too many spaces inside brackets
(brackets)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In @.pre-commit-config.yaml around lines 79 - 83, Fix the bracket spacing for
the pre-commit hook's types list: locate the block with the "types:" key (the
entry using tools/mise run lint:pre-commit) and remove the extra space inside
the square brackets so it reads types: [python] (or use a quoted single-item
list like types: ["python"]) to match the project's YAML style.
Description
Fix CI lint failures caused by incorrect import sorting (I001 errors) and tool version drift between local and CI environments.
Root cause: A stale
.ruff_cachelocally masked import sorting errors. Ruff auto-detectedstrawberryas first-party (due to__pycache__artifacts insrc/strawchemy/strawberry/), while CI correctly classified it as third-party.Changes:
strawberry(third-party) fromstrawchemy(first-party)pyproject.toml(>=0.14.10,<0.15)2025.12.12(matchingtools/misewrapper)tools/misepath, fixlanguage: systemrender:usagetask to usetools/miseTypes of Changes
Issues Fixed or Closed by This PR
N/A
Checklist
Summary by CodeRabbit