Skip to content

refactor(ide): flatten option value validation - #1442

Merged
skevetter merged 1 commit into
mainfrom
refactor/ide-option-value-validation
Oct 9, 2026
Merged

skevetter merged 1 commit into
mainfrom
refactor/ide-option-value-validation

Conversation

@skevetter

@skevetter skevetter commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

validateOptionValue nests pattern matching, custom-message selection and enum rejection. Extract the pattern check into a private helper with guard returns and flatten enum acceptance while preserving validation order and all error messages.

Add direct validator tables and ParseOptions regressions for literal percent-containing messages, regexp syntax errors, regex-first precedence, successful-regex enum rejection, case-sensitive enum membership/order, and parser input/return contracts.

Closes #1438

Validation on main 3ba1a436c80813bf149c0d4bd0e2b9b6c29dc376:

  • Scoped package race tests and vet passed.
  • New regression tables passed against both unchanged main validator and refactored validator.
  • CodeScene confirmed validateOptionValue Bumpy Road Ahead (three bumps) before changes, and reported it fixed afterward. File health improved 8.95 -> 9.61; mean complexity 5.2857 -> 4.875.
  • Existing GetIDEOptions nesting and String Heavy Function Arguments remain outside this scope. String argument ratio changes 50% -> 52.94%, with unchanged penalty; no new function-level warning in the extracted helper.
  • Authenticated local CodeRabbit completed review of both files, 0 issues. Independent source review: 0 actionable findings.
  • CI-parity lint passed with 0 issues (Go 1.26.8, golangci-lint 2.13.2; documented serial-runner flag used to queue behind another task's shared lock, with the same CI configuration and patch flags).
  • All applicable pre-commit hooks passed, including lint, formatting and secret scanning. Prepared commit message passed commitlint and commitizen.

Summary by CodeRabbit

  • Refactor
    • Option validation continues to apply regular-expression checks before enum checks, with existing acceptance and error behavior preserved.
  • Tests
    • Added coverage for option validation and parsing, including matching rules, error handling, whitespace, duplicate options, and malformed input.

@netlify

netlify Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for devsydev canceled.

Name Link
🔨 Latest commit 0f203d1
🔍 Latest deploy log https://app.netlify.com/projects/devsydev/deploys/6ac874f2189f8200087534c5

@coderabbitai

coderabbitai Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: cd57bb2f-f4e7-40f2-b849-6ca161c8fd74
📥 Commits

Reviewing files that changed from the base of the PR and between 3ba1a43 and 0f203d1.

📒 Files selected for processing (2)
  • pkg/ide/ideparse/parse.go
  • pkg/ide/ideparse/parse_test.go

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The option validator now delegates regex checks to a private helper before checking enum membership. Added tests cover validation results, error precedence, malformed regex patterns, and ParseOptions behavior.

Changes

Option validation

Layer / File(s) Summary
Pattern and enum validation
pkg/ide/ideparse/parse.go, pkg/ide/ideparse/parse_test.go
Regex validation moves to validateOptionPattern, preserving empty-pattern handling, regex errors, custom mismatch messages, and regex-before-enum order. Tests cover validation behavior and parsing cases, including malformed patterns and errors that return a nil map.

Priority: ⬇️ Low

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

Change: Refactor

Merge Risk: ⚪ Minimal · up to 0f203

No actionable issue remains identified; the PR is mergeable after normal checks.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 5.56% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 18 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check Passed The PR addresses open issue #1438. validateOptionValue delegates pattern checks to a private helper with guard behavior, then applies enum validation. The reported tests cover unconstrained values, …
Out of Scope Changes check Passed The reported whole-PR changes are limited to pkg/ide/ideparse/parse.go and focused tests in pkg/ide/ideparse/parse_test.go. The implementation refactors pure option validation, and the tests suppo…
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: flattening option value validation in the IDE package.
  • Fix all pre-merge checks with AI
✨ Finishing Touches
✨ Simplify code
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@netlify

netlify Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for images-devsy-sh canceled.

Name Link
🔨 Latest commit 0f203d1
🔍 Latest deploy log https://app.netlify.com/projects/images-devsy-sh/deploys/6ac874f2ea6c2e000858e254

@github-actions github-actions Bot added the size/l label Oct 9, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai full review

Copy link
Copy Markdown
Contributor Author

@greptileai review

@coderabbitai

coderabbitai Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
✅ Action performed

Full review finished.

@greptile-apps

greptile-apps Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

[Medium impact] This PR appears safe to merge.

Summary

Extracts pattern checks into validateOptionPattern and simplifies enum checks without changing validation order or error messages.

  • Adds tests for pattern matching, literal messages, regex errors, and case-sensitive enum checks.
  • Adds ParseOptions tests for key normalization, preserved values, duplicate keys, and nil results on errors.
  • No actionable issues found.

Reviews (1) · Last reviewed commit: "refactor(ide): flatten option value vali..." · Reviewed by Greptile

@skevetter
skevetter marked this pull request as ready for review October 9, 2026 06:17
@skevetter
skevetter merged commit 2e7708d into main Oct 9, 2026
94 checks passed
@skevetter
skevetter deleted the refactor/ide-option-value-validation branch October 9, 2026 06:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor(ide): flatten option value validation

1 participant