fix(auth): return validation error when --scope is empty in auth check#999
Conversation
strings.Fields("") returns an empty slice, causing --scope "" to bypass
validation and return ok: true. Replace the false-positive success path
with an ErrValidation error so callers correctly detect the invalid input.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe PR fixes ChangesEmpty Scope Validation
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Codecov Report❌ Patch coverage is
❌ Your patch check has failed because the patch coverage (0.00%) is below the target coverage (60.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #999 +/- ##
=======================================
Coverage 67.66% 67.67%
=======================================
Files 576 576
Lines 54510 54509 -1
=======================================
+ Hits 36885 36887 +2
+ Misses 14566 14564 -2
+ Partials 3059 3058 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
🚀 PR Preview Install Guide🧰 CLI updatenpm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@96be0f86e4bd5f6131db6583750a9f49f1e3a1fa🧩 Skill updatenpx skills add mengqiuzhen/Feishu-cli#fix/116-auth-check-empty-scope -y -g |
larksuite#999) strings.Fields("") returns an empty slice, causing --scope "" to bypass validation and return ok: true. Replace the false-positive success path with an ErrValidation error so callers correctly detect the invalid input. Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
Summary
auth check --scope ""returnedok: trueinstead of a validation error.strings.Fields("")produces an empty slice, which matcheslen(required) == 0, causing the command to report success without checking any scopes.Fix
Replace the false-positive success path with
output.ErrValidation("--scope cannot be empty"), consistent with error handling patterns elsewhere in the auth package.Changes
cmd/auth/check.go: 1 insertion, 2 deletionsVerification
go build ./...— cleango test ./cmd/auth/...— all pass (1 pre-existing Windows file-cleanup failure unrelated)Closes #116
🤖 Generated with Claude Code
Summary by CodeRabbit
auth check --scopevalidation to properly reject empty scope values with an error instead of returning a success response.