Skip to content

fix: sort __MODULE__ first among aliases - #117

Merged
NickNeck merged 1 commit into
hrzndhrn:mainfrom
woylie:fix-alias-order
Sep 26, 2026
Merged

NickNeck merged 1 commit into
hrzndhrn:mainfrom
woylie:fix-alias-order

Conversation

@woylie

@woylie woylie commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

resolves #116

Solved by converting the module name to uppercase instead of lowercase, which matches what Credo does:

https://github.com/rrrene/credo/blob/89457a1608a5b027e508d500f53748aef99d4f1d/lib/credo/check/readability/alias_order.ex#L133

Summary by CodeRabbit

  • Bug Fixes
    • Improved alias sorting to consistently use case-insensitive alphabetical ordering.
    • Ensured __MODULE__ and related aliases appear before regular aliases.
    • Updated sorting checks for aliases used with :as and multi-alias declarations.

@coderabbitai

coderabbitai Bot commented Aug 26, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: becf1188-a1f2-46af-bd97-6a9b496620f5

📥 Commits

Reviewing files that changed from the base of the PR and between d239a9a and 3ad06a5.

📒 Files selected for processing (2)
  • lib/recode/task/alias_order.ex
  • test/recode/task/alias_order_test.exs

Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review.


📝 Walkthrough

Walkthrough

The alias ordering comparison now converts atom names to lowercase before comparison. Tests now expect __MODULE__ and its sub-aliases to sort before regular aliases. Tests also update ordering for aliases with :as and multi-alias forms.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 3ad06

This localized change adjusts alias ordering so MODULE is sorted first, with corresponding test updates. No actionable merge-blocking risk remains beyond normal checks and review.

🚥 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 states the primary change: sorting MODULE aliases first.
Linked Issues check ✅ Passed The implementation and updated tests place MODULE and MODULE.* aliases before regular aliases, which satisfies issue #116 and matches the stated Credo behavior.
Out of Scope Changes check ✅ Passed All changes are limited to alias sorting logic and related test expectations. No unrelated changes are present.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2…
Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2 files.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

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

Warning

⚠️ This pull request shows signs of AI-generated slop (description_diff_mismatch). It has been flagged by CodeRabbit slop detection and should be reviewed carefully.

@NickNeck
NickNeck merged commit 8fd225f into hrzndhrn:main Sep 26, 2026
9 checks passed
@NickNeck

Copy link
Copy Markdown
Member

Hello @woylie , thank you for the fix. Sorry it took a little longer to merge it, but now a new version is released.

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.

alias sorted with underscores last

2 participants