Skip to content

nh-search: drop regex from supported_branch#695

Open
faukah wants to merge 1 commit into
masterfrom
faukah/push-nrvtuwuzwlqv
Open

nh-search: drop regex from supported_branch#695
faukah wants to merge 1 commit into
masterfrom
faukah/push-nrvtuwuzwlqv

Conversation

@faukah

@faukah faukah commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Simpler, stdlib instead of an external crate.

Sanity Checking

  • I have read and understood the contribution guidelines
  • I have updated the changelog as per my changes
  • I have tested, and self-reviewed my code
  • Style and consistency
    • I ran nix fmt to format my Nix code
    • I ran cargo fmt to format my Rust code
    • I have added appropriate documentation to new code
    • My changes are consistent with the rest of the codebase
  • Correctness
    • I ran cargo clippy and fixed any new linter warnings.
  • If new changes are particularly complex:
    • My code includes comments in particularly complex areas to explain the
      logic
    • I have documented the motive for those changes in the PR body or commit
      description.
  • Tested on platform(s):
    • x86_64-linux
    • aarch64-linux
    • aarch64-darwin

Add a 👍 reaction to pull requests you find important.

@faukah faukah added the allow-no-changelog Doesen't need a CHANGELOG.md entry. label Jun 16, 2026
@coderabbitai

coderabbitai Bot commented Jun 16, 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

Run ID: b4533b46-bdb9-4656-a581-643c20fdb0e3

📥 Commits

Reviewing files that changed from the base of the PR and between 047f062 and fdbd4dd.

📒 Files selected for processing (1)
  • crates/nh-search/src/channel.rs

📝 Walkthrough

Walkthrough

crates/nh-search/src/channel.rs replaces a cached compiled regex (SUPPORTED_BRANCH_REGEX via OnceLock<Regex>) with direct string parsing using strip_prefix, split_once, and ASCII-digit/non-empty checks to validate nixos-<major>.<minor> branch names. The OnceLock and Regex imports are removed, and the test suite gains negative assertions for malformed version strings.

Changes

Branch Validation Refactor

Layer / File(s) Summary
supported_branch implementation and tests
crates/nh-search/src/channel.rs
Removes SUPPORTED_BRANCH_REGEX, OnceLock, and Regex imports; rewrites supported_branch to validate nixos-<major>.<minor> via strip_prefix, split_once, and ASCII-digit/non-empty checks; adds negative test cases for missing segments, trailing dot, and extra segment.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: removing regex dependency from the supported_branch function.
Description check ✅ Passed The description explains the purpose (using stdlib instead of external crate) and confirms comprehensive testing and adherence to project guidelines.
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.

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


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 and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

allow-no-changelog Doesen't need a CHANGELOG.md entry.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant