chore(lint): enable regexpSimplify rule from go-critic (#23405)

Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
This commit is contained in:
Matthieu MOREL 2025-06-16 14:55:05 +02:00 committed by GitHub
parent 52ad029110
commit a91a6594a1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 2 additions and 3 deletions

View file

@ -67,7 +67,6 @@ linters:
- paramTypeCombine
- ptrToRefParam
- rangeValCopy
- regexpSimplify
- sloppyReassign
- tooManyResultsChecker
- typeDefFirst

View file

@ -178,7 +178,7 @@ func (db *db) CreateRepoCertificate(ctx context.Context, certificates *appsv1.Re
return nil, fmt.Errorf("invalid hostname in request: %s", certificate.ServerName)
} else if certificate.CertType == "ssh" {
// Matches "[hostname]:port" format
reExtract := regexp.MustCompile(`^\[(.*)\]\:[0-9]+$`)
reExtract := regexp.MustCompile(`^\[(.*)\]:\d+$`)
matches := reExtract.FindStringSubmatch(certificate.ServerName)
var hostnameToCheck string
if len(matches) == 0 {

View file

@ -208,7 +208,7 @@ func WithEventHandlers(handlers EventHandlers) ClientOpts {
}
func NewClient(rawRepoURL string, creds Creds, insecure bool, enableLfs bool, proxy string, noProxy string, opts ...ClientOpts) (Client, error) {
r := regexp.MustCompile("(/|:)")
r := regexp.MustCompile(`([/:])`)
normalizedGitURL := NormalizeGitURL(rawRepoURL)
if normalizedGitURL == "" {
return nil, fmt.Errorf("repository %q cannot be initialized: %w", rawRepoURL, ErrInvalidRepoURL)