Skip to content

Commit

Permalink
chore: Comment format (argoproj#12399)
Browse files Browse the repository at this point in the history
* feat: Comment format

Signed-off-by: fengshunli <[email protected]>

* Apply suggestions from code review

Signed-off-by: Michael Crenshaw <[email protected]>

---------

Signed-off-by: fengshunli <[email protected]>
Signed-off-by: Michael Crenshaw <[email protected]>
Co-authored-by: Michael Crenshaw <[email protected]>
  • Loading branch information
fengshunli and crenshaw-dev authored Mar 29, 2023
1 parent 32aae20 commit 60c4ed1
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 34 deletions.
4 changes: 2 additions & 2 deletions cmd/argocd/commands/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1067,12 +1067,12 @@ func TestFilterAppResources(t *testing.T) {
selectedResources []*argoappv1.SyncOperationResource
expectedResult []*argoappv1.SyncOperationResource
}{
//--resource apps:ReplicaSet:replicaSet-name1 --resource *:Service:*
// --resource apps:ReplicaSet:replicaSet-name1 --resource *:Service:*
{testName: "Include ReplicaSet replicaSet-name1 resouce and all service resources",
selectedResources: []*argoappv1.SyncOperationResource{&includeAllServiceResources, &includeReplicaSet1Resource},
expectedResult: []*argoappv1.SyncOperationResource{&replicaSet1, &service1, &service2},
},
//--resource apps:ReplicaSet:replicaSet-name1 --resource !*:Service:*
// --resource apps:ReplicaSet:replicaSet-name1 --resource !*:Service:*
{testName: "Include ReplicaSet replicaSet-name1 resouce and exclude all service resources",
selectedResources: []*argoappv1.SyncOperationResource{&excludeAllServiceResources, &includeReplicaSet1Resource},
expectedResult: []*argoappv1.SyncOperationResource{&replicaSet1, &replicaSet2, &job, &deployment},
Expand Down
2 changes: 1 addition & 1 deletion cmd/argocd/commands/bcrypt.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"golang.org/x/crypto/bcrypt"
)

// bcryptCmd represents the bcrypt command
// NewBcryptCmd represents the bcrypt command
func NewBcryptCmd() *cobra.Command {
var (
password string
Expand Down
2 changes: 1 addition & 1 deletion cmd/argocd/commands/cert.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ func NewCertAddTLSCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command
return command
}

// NewCertAddCommand returns a new instance of an `argocd cert add` command
// NewCertAddSSHCommand returns a new instance of an `argocd cert add` command
func NewCertAddSSHCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
var (
fromFile string
Expand Down
2 changes: 0 additions & 2 deletions cmd/argocd/commands/login_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import (
"github.com/stretchr/testify/assert"
)

//

func Test_userDisplayName_email(t *testing.T) {
claims := jwt.MapClaims{"iss": "qux", "sub": "foo", "email": "[email protected]", "groups": []string{"baz"}}
actualName := userDisplayName(claims)
Expand Down
2 changes: 1 addition & 1 deletion cmd/util/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,7 @@ func setAnnotations(app *argoappv1.Application, annotations []string) {
}
}

// liveObjects deserializes the list of live states into unstructured objects
// LiveObjects deserializes the list of live states into unstructured objects
func LiveObjects(resources []*argoappv1.ResourceDiff) ([]*unstructured.Unstructured, error) {
objs := make([]*unstructured.Unstructured, len(resources))
for i, resState := range resources {
Expand Down
2 changes: 1 addition & 1 deletion cmd/util/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func (opts *ProjectOpts) GetDestinations() []v1alpha1.ApplicationDestination {
return destinations
}

// TODO: Get configured keys and emit warning when a key is specified that is not configured
// GetSignatureKeys TODO: Get configured keys and emit warning when a key is specified that is not configured
func (opts *ProjectOpts) GetSignatureKeys() []v1alpha1.SignatureKey {
signatureKeys := make([]v1alpha1.SignatureKey, 0)
for _, keyStr := range opts.SignatureKeys {
Expand Down
46 changes: 23 additions & 23 deletions common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ const (
ArgoCDNotificationsConfigMapName = "argocd-notifications-cm"
ArgoCDNotificationsSecretName = "argocd-notifications-secret"
ArgoCDRBACConfigMapName = "argocd-rbac-cm"
// Contains SSH known hosts data for connecting repositories. Will get mounted as volume to pods
// ArgoCDKnownHostsConfigMapName contains SSH known hosts data for connecting repositories. Will get mounted as volume to pods
ArgoCDKnownHostsConfigMapName = "argocd-ssh-known-hosts-cm"
// Contains TLS certificate data for connecting repositories. Will get mounted as volume to pods
// ArgoCDTLSCertsConfigMapName contains TLS certificate data for connecting repositories. Will get mounted as volume to pods
ArgoCDTLSCertsConfigMapName = "argocd-tls-certs-cm"
ArgoCDGPGKeysConfigMapName = "argocd-gpg-keys-cm"
)
Expand All @@ -51,28 +51,28 @@ const (
DefaultPortRepoServerMetrics = 8084
)

// Default listener address for ArgoCD components
// DefaultAddressAPIServer for ArgoCD components
const (
DefaultAddressAPIServer = "localhost"
)

// Default paths on the pod's file system
const (
// The default path where TLS certificates for repositories are located
// DefaultPathTLSConfig is the default path where TLS certificates for repositories are located
DefaultPathTLSConfig = "/app/config/tls"
// The default path where SSH known hosts are stored
// DefaultPathSSHConfig is the default path where SSH known hosts are stored
DefaultPathSSHConfig = "/app/config/ssh"
// Default name for the SSH known hosts file
// DefaultSSHKnownHostsName is the Default name for the SSH known hosts file
DefaultSSHKnownHostsName = "ssh_known_hosts"
// Default path to GnuPG home directory
// DefaultGnuPgHomePath is the Default path to GnuPG home directory
DefaultGnuPgHomePath = "/app/config/gpg/keys"
// Default path to repo server TLS endpoint config
// DefaultAppConfigPath is the Default path to repo server TLS endpoint config
DefaultAppConfigPath = "/app/config"
// Default path to cmp server plugin socket file
// DefaultPluginSockFilePath is the Default path to cmp server plugin socket file
DefaultPluginSockFilePath = "/home/argocd/cmp-server/plugins"
// Default path to cmp server plugin configuration file
// DefaultPluginConfigFilePath is the Default path to cmp server plugin configuration file
DefaultPluginConfigFilePath = "/home/argocd/cmp-server/config"
// Plugin Config File is a ConfigManagementPlugin manifest located inside the plugin container
// PluginConfigFileName is the Plugin Config File is a ConfigManagementPlugin manifest located inside the plugin container
PluginConfigFileName = "plugin.yaml"
)

Expand Down Expand Up @@ -139,7 +139,7 @@ const (
// LabelValueSecretTypeRepoCreds indicates a secret type of repository credentials
LabelValueSecretTypeRepoCreds = "repo-creds"

// The Argo CD application name is used as the instance name
// AnnotationKeyAppInstance is the Argo CD application name is used as the instance name
AnnotationKeyAppInstance = "argocd.argoproj.io/tracking-id"

// AnnotationCompareOptions is a comma-separated list of options for comparison
Expand Down Expand Up @@ -171,19 +171,19 @@ const (
EnvVarSSODebug = "ARGOCD_SSO_DEBUG"
// EnvVarRBACDebug is an environment variable to enable additional RBAC debugging in the API server
EnvVarRBACDebug = "ARGOCD_RBAC_DEBUG"
// Overrides the location where SSH known hosts for repo access data is stored
// EnvVarSSHDataPath overrides the location where SSH known hosts for repo access data is stored
EnvVarSSHDataPath = "ARGOCD_SSH_DATA_PATH"
// Overrides the location where TLS certificate for repo access data is stored
// EnvVarTLSDataPath overrides the location where TLS certificate for repo access data is stored
EnvVarTLSDataPath = "ARGOCD_TLS_DATA_PATH"
// Specifies number of git remote operations attempts count
// EnvGitAttemptsCount specifies number of git remote operations attempts count
EnvGitAttemptsCount = "ARGOCD_GIT_ATTEMPTS_COUNT"
// Specifices max duration of git remote operation retry
// EnvGitRetryMaxDuration specifices max duration of git remote operation retry
EnvGitRetryMaxDuration = "ARGOCD_GIT_RETRY_MAX_DURATION"
// Specifies duration of git remote operation retry
// EnvGitRetryDuration specifies duration of git remote operation retry
EnvGitRetryDuration = "ARGOCD_GIT_RETRY_DURATION"
// Specifies fator of git remote operation retry
// EnvGitRetryFactor specifies fator of git remote operation retry
EnvGitRetryFactor = "ARGOCD_GIT_RETRY_FACTOR"
// Overrides git submodule support, true by default
// EnvGitSubmoduleEnabled overrides git submodule support, true by default
EnvGitSubmoduleEnabled = "ARGOCD_GIT_MODULES_ENABLED"
// EnvGnuPGHome is the path to ArgoCD's GnuPG keyring for signature verification
EnvGnuPGHome = "ARGOCD_GNUPGHOME"
Expand All @@ -205,7 +205,7 @@ const (
EnvGithubAppCredsExpirationDuration = "ARGOCD_GITHUB_APP_CREDS_EXPIRATION_DURATION"
// EnvHelmIndexCacheDuration controls how the helm repository index file is cached for (default: 0)
EnvHelmIndexCacheDuration = "ARGOCD_HELM_INDEX_CACHE_DURATION"
// EnvRepoServerConfigPath allows to override the configuration path for repo server
// EnvAppConfigPath allows to override the configuration path for repo server
EnvAppConfigPath = "ARGOCD_APP_CONF_PATH"
// EnvLogFormat log format that is defined by `--logformat` option
EnvLogFormat = "ARGOCD_LOG_FORMAT"
Expand Down Expand Up @@ -296,14 +296,14 @@ func GetCMPWorkDir() string {
}

const (
// AnnotationApplicationRefresh is an annotation that is added when an ApplicationSet is requested to be refreshed by a webhook. The ApplicationSet controller will remove this annotation at the end of reconciliation.
// AnnotationApplicationSetRefresh is an annotation that is added when an ApplicationSet is requested to be refreshed by a webhook. The ApplicationSet controller will remove this annotation at the end of reconciliation.
AnnotationApplicationSetRefresh = "argocd.argoproj.io/application-set-refresh"
)

// gRPC settings
const (
GRPCKeepAliveEnforcementMinimum = 10 * time.Second
// Keep alive is 2x enforcement minimum to ensure network jitter does not introduce ENHANCE_YOUR_CALM errors
// GRPCKeepAliveTime is 2x enforcement minimum to ensure network jitter does not introduce ENHANCE_YOUR_CALM errors
GRPCKeepAliveTime = 2 * GRPCKeepAliveEnforcementMinimum
)

Expand All @@ -318,7 +318,7 @@ const (
SecurityLow = 1 // Unexceptional entries (i.e. successful access logs)
)

// Common error messages
// TokenVerificationError is a generic error message for a failure to verify a JWT
const TokenVerificationError = "failed to verify the token"

var TokenVerificationErr = errors.New(TokenVerificationError)
Expand Down
4 changes: 2 additions & 2 deletions controller/cache/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const (
// EnvClusterCacheWatchResyncDuration is the env variable that holds cluster cache watch re-sync duration
EnvClusterCacheWatchResyncDuration = "ARGOCD_CLUSTER_CACHE_WATCH_RESYNC_DURATION"

// EnvClusterRetryTimeoutDuration is the env variable that holds cluster retry duration when sync error happens
// EnvClusterSyncRetryTimeoutDuration is the env variable that holds cluster retry duration when sync error happens
EnvClusterSyncRetryTimeoutDuration = "ARGOCD_CLUSTER_SYNC_RETRY_TIMEOUT_DURATION"

// EnvClusterCacheListPageSize is the env variable to control size of the list page size when making K8s queries
Expand All @@ -56,7 +56,7 @@ const (
// k8s list queries results across all clusters to avoid memory spikes during cache initialization.
EnvClusterCacheListSemaphore = "ARGOCD_CLUSTER_CACHE_LIST_SEMAPHORE"

// EnvClusterCacheRetryLimit is the env variable to control the retry limit for listing resources during cluster cache sync
// EnvClusterCacheAttemptLimit is the env variable to control the retry limit for listing resources during cluster cache sync
EnvClusterCacheAttemptLimit = "ARGOCD_CLUSTER_CACHE_ATTEMPT_LIMIT"

// EnvClusterCacheRetryUseBackoff is the env variable to control whether to use a backoff strategy with the retry during cluster cache sync
Expand Down
2 changes: 1 addition & 1 deletion hack/gen-resources/util/sizedwaitgroup.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
// Based upon sync.WaitGroup, SizedWaitGroup allows to start multiple
// routines and to wait for their end using the simple API.

// SizedWaitGroup adds the feature of limiting the maximum number of
// Package util SizedWaitGroup adds the feature of limiting the maximum number of
// concurrently started routines. It could for example be used to start
// multiples routines querying a database but without sending too much
// queries in order to not overload the given database.
Expand Down

0 comments on commit 60c4ed1

Please sign in to comment.