Skip to content

Commit

Permalink
add cspell pre-commit hook (pomerium#484)
Browse files Browse the repository at this point in the history
* add cspell pre-commit hook

* rm runaway comment
  • Loading branch information
wasaga authored Jan 17, 2023
1 parent dcfb1d2 commit 3e5c08d
Show file tree
Hide file tree
Showing 12 changed files with 46 additions and 11 deletions.
5 changes: 5 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ repos:
rev: v0.0.17
hooks:
- id: go-mod-tidy
- repo: https://github.com/streetsidesoftware/cspell-cli
rev: v6.17.1
hooks:
- id: cspell
files: "^.*.go$"
- repo: local
hooks:
- id: lint
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ dev-install:
@echo "deleting pods..."
#@kubectl delete --force --selector app.kubernetes.io/name=pomerium pods || true
@kubectl delete deployment/pomerium -n pomerium --wait || true
@$(KUSTOMIZE) build config/dev/local | kubectl apply --filename -
@$(KUSTOMIZE) build config/dev/local --load-restrictor LoadRestrictionsNone | kubectl apply --filename -

.PHONY: dev-logs
dev-logs:
Expand Down
4 changes: 2 additions & 2 deletions apis/ingress/v1/pomerium_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ type IdentityProvider struct {
// see <a href="https://docs.pomerium.com/docs/overview/upgrading#idp-directory-sync">Upgrade Guide</a>.
// +optional
ServiceAccountFromSecret *string `json:"serviceAccountFromSecret,omitempty" deprecated:"idp_directory_sync"`
// RequestParams to be added as part of a signin request using OAuth2 code flow.
// RequestParams to be added as part of a sign-in request using OAuth2 code flow.
//
// +kubebuilder:validation:Format="namespace/name"
// +optional
Expand Down Expand Up @@ -114,7 +114,7 @@ type PostgresStorage struct {
// <code>connection</code> key. See
// <a href="https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNSTRING">DSN Format and Parameters</a>.
// Do not set <code>sslrootcert</code>, <code>sslcert</code> and <code>sslkey</code> via connection string,
// use <code>tlsCecret</code> and <code>caSecret</code> CRD options instead.
// use <code>tlsSecret</code> and <code>caSecret</code> CRD options instead.
// +kubebuilder:validation:Required
// +kubebuilder:validation:Type=string
// +kubebuilder:validation:MinLength=1
Expand Down
3 changes: 1 addition & 2 deletions controllers/ingress/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ type ingressController struct {

// Scheme keeps track between objects and their group/version/kinds
*runtime.Scheme
// Client is k8s apiserver client proxied thru controller-runtime,
// that also embeds object cache
// Client is k8s apiserver client with object caching
client.Client

// PomeriumReconciler updates Pomerium service configuration
Expand Down
2 changes: 1 addition & 1 deletion controllers/settings/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
type settingsController struct {
// key kind/name of a settings object to watch, all others would be ignored
key model.Key
// Client is k8s apiserver client
// Client is k8s api server client
client.Client
// PomeriumReconciler updates Pomerium service configuration
pomerium.ConfigReconciler
Expand Down
1 change: 1 addition & 0 deletions controllers/settings/fetch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ func TestFetchConstraints(t *testing.T) {
"postgres": {
corev1.SecretTypeOpaque,
map[string][]byte{
//cspell:disable-next-line
model.StorageConnectionStringKey: []byte("postgresql:///mydb?host=localhost&port=5433"),
},
},
Expand Down
30 changes: 30 additions & 0 deletions cspell.config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
version: "0.2"
language: en-US
words:
- apimachinery
- apiserver
- configmap
- databroker
- deepcopy
- envtest
- pomerium
- protobuf
- oidc
- readyz
- sslcert
- sslkey
- sslrootcert
- upsert
- uifs
- filemgr
languageSettings:
- languageId: go
allowCompoundWords: false
ignoreRegExpList:
- Urls
- Base64
- "/kubebuilder:.*/"
- "/nolint:.*/"
- "/go:.*/"
includeRegExpList:
- CStyleComment
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ require (
github.com/iancoleman/strcase v0.2.0
github.com/martinlindhe/base36 v1.1.1
github.com/open-policy-agent/opa v0.48.0
github.com/pomerium/csrf v1.7.0
github.com/pomerium/pomerium v0.20.1-0.20230105213558-488bcd6f72f8
github.com/sergi/go-diff v1.3.1
github.com/spf13/cobra v1.6.1
Expand Down Expand Up @@ -246,7 +247,6 @@ require (
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/polyfloyd/go-errorlint v1.0.5 // indirect
github.com/pomerium/csrf v1.7.0 // indirect
github.com/pomerium/datasource v0.18.2-0.20221108160055-c6134b5ed524 // indirect
github.com/pomerium/webauthn v0.0.0-20221118023040-00a9c430578b // indirect
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect
Expand Down
2 changes: 1 addition & 1 deletion internal/init.go
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// Package internal implements few hacks to allow pomerium embeddeding
// Package internal implements few hacks to allow pomerium embedding
package internal
2 changes: 1 addition & 1 deletion model/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/client/apiutil"
)

// Key is dependenciy key
// Key is dependency key
type Key struct {
Kind string
types.NamespacedName
Expand Down
2 changes: 1 addition & 1 deletion pomerium/ingress_to_route.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ func setRoutePath(r *pb.Route, p networkingv1.HTTPIngressPath, ic *model.Ingress
case networkingv1.PathTypePrefix:
r.Prefix = p.Path
default:
// shouldn't get there as apiserver should not allow this
// shouldn't get there as api server should not allow this
return fmt.Errorf("unknown pathType %s", *p.PathType)
}

Expand Down
2 changes: 1 addition & 1 deletion util/namespaced_name_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func TestParseNamespacedName(t *testing.T) {
}} {
t.Run(tc.in, func(t *testing.T) {
got, err := util.ParseNamespacedName(tc.in, tc.opts...)
tc.errCheck(t, err, "errcheck")
tc.errCheck(t, err, "error check")
assert.Equal(t, tc.want, got)
})
}
Expand Down

0 comments on commit 3e5c08d

Please sign in to comment.