gh-gei icon indicating copy to clipboard operation
gh-gei copied to clipboard

Add URL validation for organization, repository, and enterprise arguments

Open brianaj opened this issue 1 month ago • 1 comments

External PR from @AakashSuresh2003 (#1464) to add validation that detects when users accidentally provide URLs instead of names for org/repo/enterprise arguments.

This addresses issue #1180 by providing clear, user-friendly error messages when URL patterns are detected.

Changes:

  • Added IsUrl() extension method using .NET's Uri.TryCreate() for robust URL detection
  • Added validation to all command args classes that accept org/repo/enterprise names
  • Validation checks for http/https URLs and provides clear error messages
  • Comprehensive test coverage across gei, ado2gh, and shared commands

Key features: ✅ Uses standard .NET Uri.TryCreate() validation (not custom pattern matching) ✅ Only detects proper http/https URLs (no false positives) ✅ Clear error messages explaining expected format ✅ 47 new test cases covering all affected commands

Fixes #1180

All 1019 tests passing ✅

brianaj avatar Dec 11 '25 19:12 brianaj

Unit Test Results

    1 files      1 suites   10m 25s ⏱️ 1 018 tests 1 018 ✅ 0 💤 0 ❌ 1 019 runs  1 019 ✅ 0 💤 0 ❌

Results for commit 94d4c0a8.

:recycle: This comment has been updated with latest results.

github-actions[bot] avatar Dec 12 '25 02:12 github-actions[bot]

Code Coverage

Package Line Rate Branch Rate Complexity Health
ado2gh 72% 71% 726
Octoshift 83% 73% 1766
bbs2gh 83% 78% 663
gei 81% 73% 608
Summary 81% (7856 / 9735) 74% (1908 / 2593) 3763

github-actions[bot] avatar Dec 12 '25 06:12 github-actions[bot]