Skip to content

Sort visual tags, audio tags, and audio channels by user preference just like languages#722

Open
mattscopes wants to merge 1 commit intoViren070:mainfrom
mattscopes:sort-visual-tags-audio-tags-audio-channels-like-languages
Open

Sort visual tags, audio tags, and audio channels by user preference just like languages#722
mattscopes wants to merge 1 commit intoViren070:mainfrom
mattscopes:sort-visual-tags-audio-tags-audio-channels-like-languages

Conversation

@mattscopes
Copy link
Contributor

@mattscopes mattscopes commented Feb 12, 2026

Refactor language sorting into a reusable generic sortByUserPreference function and apply the same preference-based ordering to visualTags, audioTags, and audioChannels. Build deduplicated user-specified lists (preferred/required/included) for each category and use them when sorting parsedFile values, falling back to original order or null when appropriate. This ensures user-preferred items are prioritized in formatted output without changing null handling semantics.

Summary by CodeRabbit

Release Notes

  • Improvements
    • Enhanced content sorting to better prioritise user preferences for languages, audio and visual tags. The system now correctly processes user-specified preferences (including original language detection) and multimedia components, ensuring more relevant options appear first based on individual selections.

Refactor language sorting into a reusable generic sortByUserPreference function and apply the same preference-based ordering to visualTags, audioTags, and audioChannels. Build deduplicated user-specified lists (preferred/required/included) for each category and use them when sorting parsedFile values, falling back to original order or null when appropriate. This ensures user-preferred items are prioritized in formatted output without changing null handling semantics.
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 12, 2026

Walkthrough

The formatter base module is refactored to introduce a reusable sortByUserPreference generic function that sorts arrays by user-specified preferences. The function is applied to languages, visual tags, audio tags, and audio channels, replacing previously inlined sorting logic whilst maintaining backward compatibility.

Changes

Cohort / File(s) Summary
Preference-based sorting refactor
packages/core/src/formatters/base.ts
Introduces generic sortByUserPreference function to sort languages, visual tags, audio tags, and audio channels by user preferences. Adds aggregation logic for user-specified preferences from userData and expands 'Original' language token to formatter context originalLanguage. Preserves fallback paths when no user preferences exist.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A sorting spell we weave with care,
Where user whispers fill the air,
Languages and tags align,
In preference's perfect line,
No APIs were harmed, all's fine! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: introducing preference-based sorting for visual tags, audio tags, and audio channels, mirroring the existing language sorting approach.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

No actionable comments were generated in the recent review. 🎉


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

@mattscopes
Copy link
Contributor Author

@coderabbitai help

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 12, 2026

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

CodeRabbit commands

These commands are invoked using PR/Issue comments.

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai evaluate custom pre-merge check --instructions <custom-checks-instructions> --name <custom-checks-title> [--mode <error|warning>] to validate the custom pre-merge checks instructions. Defaults to error when --mode is omitted.
    • @coderabbitai ignore pre-merge checks to override pre-merge checks and get an approval on PR.
    • @coderabbitai run pre-merge checks to run pre-merge checks on the pull request.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve to resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai generate configuration to create a PR that adds the current resolved configuration as .coderabbit.yaml (or show it if already present).
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit configuration file (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, support, documentation and community

  • Visit our status page to check the current availability of CodeRabbit.
  • Create a ticket on our support page for assistance with any issues or questions.
  • Visit our documentation site for detailed information on how to use CodeRabbit.
  • Join our Discord community to connect with other users and get help from the community.
  • Follow us on X/Twitter for updates and announcements.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 12, 2026

Tip

For best results, initiate chat on the files or code changes.

@mattscopes, here are the commands and capabilities available:

🎯 Review Commands

  • @coderabbitai review - Trigger a review of the PR
  • @coderabbitai full review - Redo the entire review from scratch
  • @coderabbitai summary or @coderabbitai regenerate summary - Regenerate the PR summary
  • @coderabbitai resolve - Resolve all of my review comments
  • @coderabbitai approve - Approve the PR
  • @coderabbitai pause - Pause automatic reviews
  • @coderabbitai resume - Resume automatic reviews

💻 Code Generation & Analysis

  • Ask me to generate unit tests for specific functions or files
  • Request code improvements or refactoring suggestions
  • Ask me to explain code or specific implementation details
  • Request security analysis or performance optimization suggestions
  • Ask me to create diagrams (flowcharts, sequence diagrams, etc.)

🔍 Codebase Navigation

  • Ask me to find files, search for patterns, or analyze dependencies
  • Request statistics about the codebase (LOC, authors, TODO counts, etc.)
  • Ask me to trace function usage or find references

📝 Issue & PR Management

  • Ask me to create follow-up issues for deferred work
  • Request updates to PR title, description, labels, or reviewers
  • Ask me to resolve my own comments when issues are addressed

🧠 Learning & Memory

  • Tell me to "remember" or "add to knowledge base" for project-specific preferences
  • I'll automatically learn from corrections and clarifications you provide

💡 Usage Tips

  • Tag me in any comment with specific questions or requests
  • I can read files, run searches, and analyze code on-demand
  • For configuration questions, ask about YAML settings or path-based instructions
  • I can reference external documentation and search the web when needed

Example interactions:

  • "Generate unit tests for the sortByUserPreference function"
  • "Explain how the visual tags sorting works"
  • "Find all usages of sortByUserPreference"
  • "Create an issue to add validation for audio channels"

Feel free to ask me anything about this PR or the codebase! 🐰

@mattscopes
Copy link
Contributor Author

@coderabbitai generate docstrings

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 12, 2026

✅ Actions performed

Initiated docstring generation; will generate only if new commits exist.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 12, 2026

Caution

Docstrings generation - FAILED

No docstrings were generated.

@mattscopes
Copy link
Contributor Author

I also contemplated adding a usort modifier instead, but I felt this was the right way of going about it since languages are already sorted this way. I have a local branch mostly finished that I can fix up, push, and PR if you think usort is a better way of going about this.

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