mirror of
https://github.com/argoproj/argo-cd
synced 2026-04-21 17:07:16 +00:00
chore: enable singleCaseSwitch and commentFormatting rules from gocritic (#21616)
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
This commit is contained in:
parent
2cfaab335f
commit
27915da5b0
6 changed files with 21 additions and 23 deletions
|
|
@ -36,11 +36,9 @@ linters-settings:
|
|||
- appendAssign
|
||||
- assignOp # Keep it disabled for readability
|
||||
- badCond
|
||||
- commentFormatting
|
||||
- exitAfterDefer
|
||||
- ifElseChain
|
||||
- mapKey
|
||||
- singleCaseSwitch
|
||||
- typeSwitchVar
|
||||
goimports:
|
||||
local-prefixes: github.com/argoproj/argo-cd/v3
|
||||
|
|
|
|||
|
|
@ -176,15 +176,15 @@ func (s *Service) initGitClient(logCtx *log.Entry, r *apiclient.CommitHydratedMa
|
|||
}
|
||||
|
||||
// FIXME: make it work for GHE
|
||||
//logCtx.Debugf("Getting user info for repo credentials")
|
||||
//gitCreds := r.Repo.GetGitCreds(s.gitCredsStore)
|
||||
//startTime := time.Now()
|
||||
//authorName, authorEmail, err := gitCreds.GetUserInfo(ctx)
|
||||
//s.metricsServer.ObserveUserInfoRequestDuration(r.Repo.Repo, getCredentialType(r.Repo), time.Since(startTime))
|
||||
//if err != nil {
|
||||
// cleanupOrLog()
|
||||
// return nil, "", nil, fmt.Errorf("failed to get github app info: %w", err)
|
||||
//}
|
||||
// logCtx.Debugf("Getting user info for repo credentials")
|
||||
// gitCreds := r.Repo.GetGitCreds(s.gitCredsStore)
|
||||
// startTime := time.Now()
|
||||
// authorName, authorEmail, err := gitCreds.GetUserInfo(ctx)
|
||||
// s.metricsServer.ObserveUserInfoRequestDuration(r.Repo.Repo, getCredentialType(r.Repo), time.Since(startTime))
|
||||
// if err != nil {
|
||||
// cleanupOrLog()
|
||||
// return nil, "", nil, fmt.Errorf("failed to get github app info: %w", err)
|
||||
// }
|
||||
var authorName, authorEmail string
|
||||
|
||||
if authorName == "" {
|
||||
|
|
|
|||
|
|
@ -45,8 +45,8 @@ func TestRefreshApp(t *testing.T) {
|
|||
require.NoError(t, err)
|
||||
// For some reason, the fake Application interface doesn't reflect the patch status after Patch(),
|
||||
// so can't verify it was set in unit tests.
|
||||
//_, ok := newApp.Annotations[common.AnnotationKeyRefresh]
|
||||
//assert.True(t, ok)
|
||||
// _, ok := newApp.Annotations[common.AnnotationKeyRefresh]
|
||||
// assert.True(t, ok)
|
||||
}
|
||||
|
||||
func TestGetAppProjectWithNoProjDefined(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -111,9 +111,9 @@ func (db *db) GetWriteRepository(ctx context.Context, repoURL, project string) (
|
|||
}
|
||||
|
||||
// TODO: enrich with write credentials.
|
||||
//if err := db.enrichCredsToRepo(ctx, repository); err != nil {
|
||||
// return repository, fmt.Errorf("unable to enrich write repository %q info with credentials: %w", repoURL, err)
|
||||
//}
|
||||
// if err := db.enrichCredsToRepo(ctx, repository); err != nil {
|
||||
// return repository, fmt.Errorf("unable to enrich write repository %q info with credentials: %w", repoURL, err)
|
||||
// }
|
||||
|
||||
return repository, err
|
||||
}
|
||||
|
|
@ -367,9 +367,9 @@ func (db *db) GetWriteRepositoryCredentials(ctx context.Context, repoURL string)
|
|||
}
|
||||
|
||||
// TODO: enrich with write credentials.
|
||||
//if err := db.enrichCredsToRepo(ctx, repository); err != nil {
|
||||
// return repository, fmt.Errorf("unable to enrich write repository %q info with credentials: %w", repoURL, err)
|
||||
//}
|
||||
// if err := db.enrichCredsToRepo(ctx, repository); err != nil {
|
||||
// return repository, fmt.Errorf("unable to enrich write repository %q info with credentials: %w", repoURL, err)
|
||||
// }
|
||||
|
||||
creds, err := secretBackend.GetRepoCreds(ctx, repoURL)
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -272,9 +272,9 @@ func isValidRedirectURL(redirectURL string, allowedURLs []string) bool {
|
|||
// scheme and host are mandatory to match.
|
||||
if b.Scheme == r.Scheme && b.Host == r.Host {
|
||||
// If path of redirectURL and allowedURL match, redirectURL is allowed
|
||||
//if b.Path == r.Path {
|
||||
// return true
|
||||
//}
|
||||
// if b.Path == r.Path {
|
||||
// return true
|
||||
// }
|
||||
// If path of redirectURL is within allowed URL's path, redirectURL is allowed
|
||||
if strings.HasPrefix(path.Clean(r.Path), b.Path) {
|
||||
return true
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ import (
|
|||
|
||||
func TestRandomPasswordVerificationDelay(t *testing.T) {
|
||||
// !race:
|
||||
//`SessionManager.VerifyUsernamePassword` uses bcrypt to prevent against time-based attacks
|
||||
// `SessionManager.VerifyUsernamePassword` uses bcrypt to prevent against time-based attacks
|
||||
// and verify the hashed password; however this is a CPU intensive algorithm that is made
|
||||
// significantly slower due to data race detection being enabled, which breaks through
|
||||
// the maximum time limit required by `TestRandomPasswordVerificationDelay`.
|
||||
|
|
|
|||
Loading…
Reference in a new issue