(s string, maxLength int)
| 358 | ) |
| 359 | |
| 360 | func isValidGitHubNameWithMaxLength(s string, maxLength int) bool { |
| 361 | // GitHub identifiers can contain alphanumeric characters, hyphens, and underscores. |
| 362 | // They cannot start or end with a hyphen. |
| 363 | if s == "" || len(s) > maxLength { |
| 364 | return false |
| 365 | } |
| 366 | if s[0] == '-' || s[len(s)-1] == '-' { |
| 367 | return false |
| 368 | } |
| 369 | for _, ch := range s { |
| 370 | if (ch < 'a' || ch > 'z') && (ch < 'A' || ch > 'Z') && (ch < '0' || ch > '9') && ch != '-' && ch != '_' { |
| 371 | return false |
| 372 | } |
| 373 | } |
| 374 | return true |
| 375 | } |
| 376 | |
| 377 | // IsValidGitHubIdentifier checks if a string is a valid GitHub user or organization identifier. |
| 378 | func IsValidGitHubIdentifier(s string) bool { |
no outgoing calls
no test coverage detected