Skip to content

Commit

Permalink
Autofix typos (#5602)
Browse files Browse the repository at this point in the history
### Description of the change

While working on #3661, I noticed some files were plenty of typos 😅 , so
I squeezed some fixes in my PR. However, I gave up and ended up running
an auto-fixer. This PR is adding all the occurrences of the auto-fix
tool.

### Benefits

No more typos for a while, hopefully.

### Possible drawbacks

This is a one-time change, but we should prevent them from happening.

### Applicable issues

N/A

### Additional information

We could have a look at the corresponding GHA that already exists:
https://github.com/marketplace/actions/typos-action

Signed-off-by: Antonio Gamez Diaz <agamez@vmware.com>
  • Loading branch information
antgamdia committed Nov 3, 2022
1 parent 317934a commit 05aa30c
Show file tree
Hide file tree
Showing 60 changed files with 130 additions and 129 deletions.
8 changes: 4 additions & 4 deletions cmd/apprepository-controller/server/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ func (c *Controller) syncHandler(key string) error {
// processing.
if errors.IsNotFound(err) {
log.Infof("AppRepository '%s' no longer exists so performing cleanup of charts from the DB", key)
// Trigger a Job to perfrom the cleanup of the charts in the DB corresponding to deleted AppRepository
// Trigger a Job to perform the cleanup of the charts in the DB corresponding to deleted AppRepository
_, err = c.kubeclientset.BatchV1().Jobs(c.conf.KubeappsNamespace).Create(context.TODO(), newCleanupJob(c.conf.KubeappsNamespace, namespace, name, c.conf), metav1.CreateOptions{})
if err != nil {
log.Errorf("Unable to create cleanup job: %v", err)
Expand Down Expand Up @@ -612,8 +612,8 @@ func generateJobName(namespace, name, pattern string, addDash bool) string {
patternLen := len(strings.ReplaceAll(pattern, "%s", ""))

// for example: the "apprepo--cleanup--" string has 18 chars, which leaves us 52-18=34 chars for the final name
maxNamesapceLength, rem := (MAX_CRONJOB_CHARS-patternLen)/2, (MAX_CRONJOB_CHARS-patternLen)%2
maxNameLength := maxNamesapceLength
maxNamespaceLength, rem := (MAX_CRONJOB_CHARS-patternLen)/2, (MAX_CRONJOB_CHARS-patternLen)%2
maxNameLength := maxNamespaceLength
if rem > 0 && !addDash {
maxNameLength++
}
Expand All @@ -622,7 +622,7 @@ func generateJobName(namespace, name, pattern string, addDash bool) string {
pattern = fmt.Sprintf("%s-", pattern)
}

truncatedName := fmt.Sprintf(pattern, truncateAndHashString(namespace, maxNamesapceLength), truncateAndHashString(name, maxNameLength))
truncatedName := fmt.Sprintf(pattern, truncateAndHashString(namespace, maxNamespaceLength), truncateAndHashString(name, maxNameLength))

return truncatedName
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/apprepository-controller/server/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1854,15 +1854,15 @@ func TestGenerateJobName(t *testing.T) {
expect string
}{
{
name: "good patern",
name: "good pattern",
namespace: "foo",
jobName: "bar",
pattern: "name: %s, namespace %s",
addDash: false,
expect: "name: foo, namespace bar",
},
{
name: "good patern (with dash)",
name: "good pattern (with dash)",
namespace: "foo",
jobName: "bar",
pattern: "name: %s, namespace %s",
Expand Down
4 changes: 2 additions & 2 deletions cmd/asset-syncer/server/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ func Delete(serveOpts Config, args []string) error {
dbConfig := dbutils.Config{URL: serveOpts.DatabaseURL, Database: serveOpts.DatabaseName, Username: serveOpts.DatabaseUser, Password: serveOpts.DatabasePassword}
manager, err := newManager(dbConfig, serveOpts.GlobalPackagingNamespace)
if err != nil {
return fmt.Errorf("Error file creating a mananger: %v", err)
return fmt.Errorf("Error file creating a manager: %v", err)
}
err = manager.Init()
if err != nil {
return fmt.Errorf("Error file initializing the mananger: %v", err)
return fmt.Errorf("Error file initializing the manager: %v", err)
}
defer manager.Close()

Expand Down
2 changes: 1 addition & 1 deletion cmd/asset-syncer/server/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ func getSha256(src []byte) (string, error) {
return fmt.Sprintf("%x", h.Sum(nil)), nil
}

// Repo defines the methods to retrive information from the given repository
// Repo defines the methods to retrieve information from the given repository
type Repo interface {
Checksum() (string, error)
Repo() *models.RepoInternal
Expand Down
6 changes: 3 additions & 3 deletions cmd/kubeapps-apis/core/plugins/v1alpha1/plugins.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,13 +302,13 @@ func createConfigGetter(serveOpts core.ServeOptions, clustersConfig kube.Cluster
}
}

// return the closure fuction that takes the context, but preserving the required scope,
// return the closure function that takes the context, but preserving the required scope,
// 'inClusterConfig' and 'config'
return createConfigGetterWithParams(restConfig, serveOpts, clustersConfig)
}

// createClientGetter takes the required params and returns the closure fuction.
// it's splitted for testing this fn separately
// createClientGetter takes the required params and returns the closure function.
// it's split for testing this fn separately
func createConfigGetterWithParams(inClusterConfig *rest.Config, serveOpts core.ServeOptions, clustersConfig kube.ClustersConfig) (core.KubernetesConfigGetter, error) {
// return the closure function that takes the context, but preserving the required scope,
// 'inClusterConfig' and 'config'
Expand Down
2 changes: 1 addition & 1 deletion cmd/kubeapps-apis/docs/kubeapps-apis.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -5210,7 +5210,7 @@
"description": "An optional field for specifying data common to systems that reconcile\nthe package on the cluster."
}
},
"description": "Request for UpdateInstalledPackage. The intent is to reach the desired state specified\nby the fields in the request, while leaving other fields intact. This is a whole\nobject \"Update\" semantics rather than \"Patch\" semantics. The caller will provide the\nvalues for the fields below, which will replace, or be overlayed onto, the\ncorresponding fields in the existing resource. For example, with the\nUpdateInstalledPackageRequest, it is not possible to change just the 'package version\nreference' without also specifying 'values' field. As a side effect, not specifying the\n'values' field in the request means there are no values specified in the desired state.\nSo the meaning of each field value is describing the desired state of the corresponding\nfield in the resource after the update operation has completed the renconciliation.",
"description": "Request for UpdateInstalledPackage. The intent is to reach the desired state specified\nby the fields in the request, while leaving other fields intact. This is a whole\nobject \"Update\" semantics rather than \"Patch\" semantics. The caller will provide the\nvalues for the fields below, which will replace, or be overlaid onto, the\ncorresponding fields in the existing resource. For example, with the\nUpdateInstalledPackageRequest, it is not possible to change just the 'package version\nreference' without also specifying 'values' field. As a side effect, not specifying the\n'values' field in the request means there are no values specified in the desired state.\nSo the meaning of each field value is describing the desired state of the corresponding\nfield in the resource after the update operation has completed the renconciliation.",
"title": "UpdateInstalledPackageRequest"
},
"v1alpha1UpdateInstalledPackageResponse": {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ Take an OCI registry URL like `"oci://ghcr.io/gfichtenholt/charts/podinfo:6.1.5"
GitHub Container Registry WebPortal, CLI and API do not use the term _"OCI registry"_ and _"OCI repository"_. Instead, the following terms are used.

- **Host** - always `ghcr.io`
- **Owner** - may be an organization or a indiviual account,e.g. `stefanprodan`
- **Owner** - may be an organization or a individual account,e.g. `stefanprodan`
- **Package** - with package type `container`, e.g. `charts/podinfo`
- **Package Version** - package version a.k.a. tag, e.g. `"6.1.5"`

Expand All @@ -118,7 +118,7 @@ The term `package` seems to correspond to be a concatenation of an last segment
- oci://ghcr.io/gfichtenholt/charts - charts/podinfo
- oci://ghcr.io/gfichtenholt/charts/podinfo - charts/podinfo/podinfo

A given owner may have mutiple packages, e.g. `"nginx/nginx"`, `"charts/podinfo"`, etc. A given package may have multiple versions. The use case with multiple charts in the same repository doesn't really apply (TODO double check if there is a workaround)
A given owner may have multiple packages, e.g. `"nginx/nginx"`, `"charts/podinfo"`, etc. A given package may have multiple versions. The use case with multiple charts in the same repository doesn't really apply (TODO double check if there is a workaround)

References:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ func (c *NamespacedResourceWatcherCache) watchLoop(watcher *watchutil.RetryWatch
}
}

func (c *NamespacedResourceWatcherCache) resyncAndNewRetryWatcher(bootstrap bool) (watcher *watchutil.RetryWatcher, eror error) {
func (c *NamespacedResourceWatcherCache) resyncAndNewRetryWatcher(bootstrap bool) (*watchutil.RetryWatcher, error) {
log.Info("+resyncAndNewRetryWatcher()")
c.resyncCond.L.Lock()
defer func() {
Expand All @@ -354,6 +354,7 @@ func (c *NamespacedResourceWatcherCache) resyncAndNewRetryWatcher(bootstrap bool
log.Info("-resyncAndNewRetryWatcher()")
}()

var watcher *watchutil.RetryWatcher
var err error
var resourceVersion string

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -818,7 +818,7 @@ func testKindClusterAvailablePackageEndpointsForOCIHelper(
t.Fatal(err)
}

// ocassionally, on the server-side, I see a request that takes a really long time:
// occasionally, on the server-side, I see a request that takes a really long time:
// I0923 03:26:42.829561 1 oci_repo.go:739] about to call helmGetter.Get(us-west1-docker.pkg.dev/vmware-kubeapps-ci/stefanprodan-podinfo-clone/podinfo:6.1.6)
// I0923 03:27:10.036728 1 oci_repo.go:742] helmGetter.Get(us-west1-docker.pkg.dev/vmware-kubeapps-ci/stefanprodan-podinfo-clone/podinfo:6.1.6) returned buffer size: [13544] error: <nil>
// so we'll use a longer timeout for these calls. Even so, every once in a while I get
Expand All @@ -830,7 +830,7 @@ func testKindClusterAvailablePackageEndpointsForOCIHelper(
// cache works is that a 2nd request is just not going to get past the rate limiting queue
// and in the end both will fail. There is no way for the client to know when the server finishes
// processing the 1st request, so for now, let's just allow a really long timeout
// I also ocassionally see
// I also occasionally see
// I0923 08:03:07.519347 1 oci_repo.go:649] login(us-west1-docker.pkg.dev): Get "https://us-west1-docker.pkg.dev/v2/": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
// and
// I0923 17:35:12.800491 1 oci_repo.go:649] login(us-west1-docker.pkg.dev): Get "https://us-west1-docker.pkg.dev/v2/": Get "https://us-west1-docker.pkg.dev/v2/token?account=_json_key&client_id=docker&offline_token=true": dial tcp 142.251.2.82:443: i/o timeout (Client.Timeout exceeded while awaiting headers)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ import (
// http.Transport objects may contain sensitive material and also have
// settings that may impact the security of HTTP operations using
// them (i.e. InsecureSkipVerify). Therefore, ensure that they are
// used in a thread-safe way, and also by reseting TLS specific state
// used in a thread-safe way, and also by resetting TLS specific state
// after each use.
//
// Calling the Release(t) function will reset TLS specific state whilst
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
// This flavor of OCI repsitory lister works with respect to those OCI registry vendors
// that implement Docker Registry HTTP API V2 or OCI Distribution Specification.
// For example, GitHub (ghcr.io), harbor and GCP Artifact Repositories are
// known to suport this API, with some caveats:
// known to support this API, with some caveats:
// - harbor does support Docker Registry HTTP API V2 when robot accounts are used
// References:
// - https://github.com/distribution/distribution/blob/main/docs/spec/api.md
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2503,7 +2503,7 @@ var (
PackageRepoRef: &corev1.PackageRepositoryReference{
Context: &corev1.Context{
Namespace: "namespace-1",
Cluster: "this-is-not-the-cluster-youre-looking-for",
Cluster: "this-is-not-the-cluster-your-are-looking-for",
},
Identifier: "repo-1",
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,7 @@ func getOciChartModel(appName string, tags TagList, ociChartRepo *OCIChartReposi
chartID := path.Join(repo.Name, encodedAppName)

// to be consistent with how we support helm http repos
// the chart fields like Desciption, home, sources come from the
// the chart fields like Description, home, sources come from the
// most recent chart version
// ref https://github.com/vmware-tanzu/kubeapps/blob/11c87926d6cd798af72875d01437d15ae8d85b9a/pkg/helm/index.go#L30
latestChartVersion, err := ociChartRepo.pickChartVersionFrom(appName, "", tags.Tags)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ func (s *Server) installedPackageDetail(ctx context.Context, key types.Namespace
// err maybe NotFound if this object has just been created and flux hasn't had time
// to invoke helm layer yet
if err == nil && rel != nil {
// a couple of fields currrently only available via helm API
// a couple of fields currently only available via helm API
if rel2.Chart != nil {
appVersion = rel2.Chart.AppVersion()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ func TestKindClusterUpdateInstalledPackage(t *testing.T) {
_, err := fluxPluginPackagesClient.UpdateInstalledPackage(ctx, tc.request)
if tc.unauthorized {
if status.Code(err) != codes.Unauthenticated {
t.Fatalf("Expected Unathenticated, got: %v", status.Code(err))
t.Fatalf("Expected Unauthenticated, got: %v", status.Code(err))
}
return // done, nothing more to check
} else if err != nil {
Expand All @@ -341,7 +341,7 @@ func TestKindClusterUpdateInstalledPackage(t *testing.T) {
}
}
if i == maxRetries {
t.Fatalf("Update retries exhaused for package [%s], last error: [%v]", installedRef, err)
t.Fatalf("Update retries exhausted for package [%s], last error: [%v]", installedRef, err)
}

actualRespAfterUpdate, actualRefsAfterUpdate :=
Expand Down Expand Up @@ -605,7 +605,7 @@ func TestKindClusterDeleteInstalledPackage(t *testing.T) {
})
if tc.unauthorized {
if status.Code(err) != codes.Unauthenticated {
t.Fatalf("Expected Unathenticated, got: %v", status.Code(err))
t.Fatalf("Expected Unauthenticated, got: %v", status.Code(err))
}
// still need to delete the release though
name := types.NamespacedName{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1047,7 +1047,7 @@ func TestKindClusterUpdatePackageRepository(t *testing.T) {
}
}
if i == maxRetries {
t.Fatalf("Update retries exhaused for repository [%s], last error: [%v]", tc.repoName, err)
t.Fatalf("Update retries exhausted for repository [%s], last error: [%v]", tc.repoName, err)
}
if got, want := status.Code(err), tc.expectedStatusCode; got != want {
t.Fatalf("got: %v, want: %v", err, want)
Expand Down Expand Up @@ -1365,7 +1365,7 @@ func TestKindClusterUpdatePackageRepoSecretUnchanged(t *testing.T) {
}
}
if i == maxRetries {
t.Fatalf("Update retries exhaused for repository [%s], last error: [%v]", repoName, err)
t.Fatalf("Update retries exhausted for repository [%s], last error: [%v]", repoName, err)
} else if got, want := status.Code(err), expectedStatusCode; got != want {
t.Fatalf("got: %v, want: %v", err, want)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1007,7 +1007,7 @@ func TestGetAvailablePackageSummariesAfterCacheResyncQueueNotIdle(t *testing.T)
} else {
mock.ExpectFlushDB().SetVal("OK")
// *SOME* of the repos have already been cached into redis at this point
// via the repo cache backround worker triggered by the Add event in the
// via the repo cache background worker triggered by the Add event in the
// main goroutine. Those SET calls will need to be repeated due to
// populateWith() which will re-populate the cache from scratch based on
// the current state in k8s (all MAX_REPOS repos).
Expand Down Expand Up @@ -1263,7 +1263,7 @@ func TestAddPackageRepository(t *testing.T) {
userManagedSecrets: true,
},
{
name: "failes when package repository links to non-existing secret",
name: "fails when package repository links to non-existing secret",
request: add_repo_req_7,
statusCode: codes.NotFound,
userManagedSecrets: true,
Expand Down Expand Up @@ -1785,7 +1785,7 @@ func TestGetOciPackageRepositoryDetail(t *testing.T) {
}
}

// FWIW GetPackageRepositoryDetail curently does not use the redis cache
// FWIW GetPackageRepositoryDetail currently does not use the redis cache
if err = mock.ExpectationsWereMet(); err != nil {
t.Fatalf("%v", err)
}
Expand Down Expand Up @@ -2420,7 +2420,7 @@ func newRepo(name string, namespace string, spec *sourcev1.HelmRepositorySpec, s
return helmRepository
}

// these functiosn should affect only unit test, not production code
// these functions should affect only unit test, not production code
// does a series of mock.ExpectGet(...)
func (s *Server) redisMockExpectGetFromRepoCache(mock redismock.ClientMock, filterOptions *corev1.FilterOptions, repos ...sourcev1.HelmRepository) error {
mapVals := make(map[string][]byte)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ function stefanProdanCloneRegistrySanityCheck() {
}

function myGithubRegistrySanityCheck() {
# 1. check the version we pushed exists on the remote and is the only version avaialble
# 1. check the version we pushed exists on the remote and is the only version available
# ref https://docs.github.com/en/rest/packages#get-all-package-versions-for-a-package-owned-by-the-authenticated-user
ALL_VERSIONS=$(gh api \
-H "Accept: application/vnd.github+json" \
Expand All @@ -128,7 +128,7 @@ function myGithubRegistrySanityCheck() {
fi

# 2. By default the new OCI registry is private.
# In order for the intergration test to work the OCI registry needs 'public' visibility
# In order for the integration test to work the OCI registry needs 'public' visibility
# https://docs.github.com/en/packages/learn-github-packages/configuring-a-packages-access-control-and-visibility
# API ref https://docs.github.com/en/rest/packages#get-a-package-for-the-authenticated-user
# GitHub web portal: https://github.com/users/gfichtenholt/packages/container/helm-charts%2Fpodinfo/settings
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ metadata:
name: registry-auth
data:
# Local credential for the instantiated Docker registry.
# User "foo" and password "bar". The vakue of htpasswd was computed as follows:
# User "foo" and password "bar". The value of htpasswd was computed as follows:
# 1. docker run --entrypoint htpasswd httpd:2 -Bbn foo bar
# 2. base64 encode the result of (1)
htpasswd: Zm9vOiQyeSQwNSRJM3pyTE14YmZRcnlQOXBVdzdFYXV1WG1OSlZnQk81T2E0SnFBOE9QUjdRcVo4SEh1RDVtNg==
Expand Down
2 changes: 1 addition & 1 deletion cmd/kubeapps-apis/plugins/helm/packages/v1alpha1/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ func (s *Server) GetManager() (utils.AssetManager, error) {
}

// GetGlobalPackagingNamespace returns the configured global packaging namespace in in the plugin config if any,
// otherwise it uses the one passed as a cmd argument to the kubeapps-apis server for backwards compatibilty.
// otherwise it uses the one passed as a cmd argument to the kubeapps-apis server for backwards compatibility.
func (s *Server) GetGlobalPackagingNamespace() string {
if s.pluginConfig.GlobalPackagingNamespace != "" {
return s.pluginConfig.GlobalPackagingNamespace
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,7 @@ func TestGetAvailablePackageSummaries(t *testing.T) {
}

if tc.expectDBQueryNamespace != "" {
// Checking if the WHERE condtion is properly applied
// Checking if the WHERE condition is properly applied

// Check returned categories
catrows := sqlmock.NewRows([]string{"name", "count"})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"sigs.k8s.io/yaml"
)

// ChartClient implements Resolver inteface
// ChartClient implements Resolver interface
type ChartClient struct{}

// GetChart fake
Expand Down

0 comments on commit 05aa30c

Please sign in to comment.