Skip to content

Fix bugs discovered while sorting the imports of the zig language source - #13

Merged
mstdokumaci merged 2 commits into
mainfrom
bug-fixes
Aug 5, 2026
Merged

mstdokumaci merged 2 commits into
mainfrom
bug-fixes

Conversation

@mstdokumaci

@mstdokumaci mstdokumaci commented Aug 5, 2026 •

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • Bug Fixes

    • Corrected alias classification and ordering, including @This() aliases.
    • Hoisted aliases found outside the import block while preserving comments and separator spacing.
    • Preserved blank lines between imports and following code.
    • Improved import normalization and change detection for several edge cases.
  • Documentation

    • Updated ordering and fix behavior documentation to reflect alias handling and spacing rules.
  • Improvements

    • Increased the readable file-size limit from 10 MB to 32 MB.

@coderabbitai

coderabbitai Bot commented Aug 5, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 8d082e06-e4e2-4044-8904-3a261a9f61fa

📥 Commits

Reviewing files that changed from the base of the PR and between 6b25e12 and cd42dae.

📒 Files selected for processing (1)
  • CHANGELOG.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • CHANGELOG.md

📝 Walkthrough

Walkthrough

Changes

Alias and import normalization

Layer / File(s) Summary
Alias scanning and classification
src/ast_scan.zig, src/ast_scan_test.zig, src/zsort_test.zig
The scanner records direct @This() aliases, excludes member chains, and retains post-block aliases as stray aliases. Tests cover classification and ordering.
Import hoisting and spacing
src/zsort.zig, src/zsort_test.zig
Processing removes stray aliases, preserves separator blanks, inserts a blank line before code, reports junction changes, expands the read limit to 32 MiB, and updates check-mode diffs.
Behavior documentation
README.md, CHANGELOG.md
Documentation describes @This() ordering, stray alias hoisting, import/body spacing, and the updated file-size limit.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the pull request's main change: fixing bugs in Zig import sorting.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch bug-fixes

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@CHANGELOG.md`:
- Around line 22-23: Update the changelog entry to use binary-unit terminology:
replace “32 MB” with “32 MiB” and change the previous “10 MB” reference to “10
MiB” because the limit uses 1024-based units. Preserve the existing description
and formatting.
🪄 Autofix

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: defaults

Review profile: CHILL

Plan: Pro

Run ID: 552fa5f0-3354-4d98-b6dc-1ff036ccaf74

📥 Commits

Reviewing files that changed from the base of the PR and between aaef36c and 6b25e12.

📒 Files selected for processing (6)
  • CHANGELOG.md
  • README.md
  • src/ast_scan.zig
  • src/ast_scan_test.zig
  • src/zsort.zig
  • src/zsort_test.zig

Comment thread CHANGELOG.md Outdated
@mstdokumaci
mstdokumaci merged commit 8d6aede into main Aug 5, 2026
11 checks passed
@mstdokumaci
mstdokumaci deleted the bug-fixes branch August 5, 2026 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant