Skip to content

Commit

Permalink
fix: lint errors and unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
alnr committed Feb 7, 2023
1 parent a4f8f3a commit ae49ef0
Show file tree
Hide file tree
Showing 40 changed files with 257 additions and 158 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ docs/swagger:
npx @redocly/openapi-cli preview-docs spec/swagger.json

.bin/golangci-lint: Makefile
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -d -b .bin v1.47.3
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -d -b .bin v1.50.1

.bin/hydra: Makefile
bash <(curl https://raw.githubusercontent.com/ory/meta/master/install.sh) -d -b .bin hydra v2.0.2
Expand Down
4 changes: 2 additions & 2 deletions cmd/identities/definitions.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ type (
}
)

func (_ outputIdentity) Header() []string {
func (outputIdentity) Header() []string {
return []string{"ID", "VERIFIED ADDRESSES", "RECOVERY ADDRESSES", "SCHEMA ID", "SCHEMA URL"}
}

Expand Down Expand Up @@ -56,7 +56,7 @@ func (i outputIdentity) Interface() interface{} {
return i
}

func (_ outputIdentityCollection) Header() []string {
func (outputIdentityCollection) Header() []string {
return outputIdentity{}.Header()
}

Expand Down
1 change: 0 additions & 1 deletion courier/courier_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
dhelper "github.com/ory/x/sqlcon/dockertest"
)

// nolint:staticcheck
func TestMain(m *testing.M) {
atexit := dhelper.NewOnExit()
atexit.Add(x.CleanUpTestSMTP)
Expand Down
8 changes: 6 additions & 2 deletions courier/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ func (h *Handler) RegisterAdminRoutes(admin *x.RouterAdmin) {
// Paginated Courier Message List Response
//
// swagger:response listCourierMessages
// nolint:deadcode,unused
//
//nolint:deadcode,unused
//lint:ignore U1000 Used to generate Swagger and OpenAPI definitions
type listCourierMessagesResponse struct {
migrationpagination.ResponseHeaderAnnotation

Expand Down Expand Up @@ -157,7 +159,9 @@ func parseMessagesFilter(r *http.Request) (ListCourierMessagesParameters, []keys
// Get Courier Message Parameters
//
// swagger:parameters getCourierMessage
// nolint:deadcode,unused
//
//nolint:deadcode,unused
//lint:ignore U1000 Used to generate Swagger and OpenAPI definitions
type getCourierMessage struct {
// MessageID is the ID of the message.
//
Expand Down
15 changes: 1 addition & 14 deletions driver/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -396,19 +396,6 @@ func TestViperProvider(t *testing.T) {
})
}

type InterceptHook struct {
lastEntry *logrus.Entry
}

func (l InterceptHook) Levels() []logrus.Level {
return []logrus.Level{logrus.FatalLevel}
}

func (l InterceptHook) Fire(e *logrus.Entry) error {
l.lastEntry = e
return nil
}

func TestBcrypt(t *testing.T) {
ctx := context.Background()
p := config.MustNew(t, logrusx.New("", ""), os.Stderr, configx.SkipValidation())
Expand Down Expand Up @@ -684,7 +671,7 @@ func TestViperProvider_DSN(t *testing.T) {
var exitCode int
l := logrusx.New("", "", logrusx.WithExitFunc(func(i int) {
exitCode = i
}), logrusx.WithHook(InterceptHook{}))
}))
p := config.MustNew(t, l, os.Stderr, configx.SkipValidation())

assert.Equal(t, dsn, p.DSN(ctx))
Expand Down
39 changes: 19 additions & 20 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ require (
github.com/google/uuid v1.3.0
github.com/gorilla/sessions v1.2.1
github.com/gtank/cryptopasta v0.0.0-20170601214702-1f550f6f2f69
github.com/hashicorp/consul/api v1.12.0
github.com/hashicorp/consul/api v1.18.0
github.com/hashicorp/go-retryablehttp v0.7.1
github.com/hashicorp/golang-lru v0.5.4
github.com/imdario/mergo v0.3.13
Expand All @@ -70,14 +70,14 @@ require (
github.com/ory/analytics-go/v4 v4.0.3
github.com/ory/client-go v0.2.0-alpha.60
github.com/ory/dockertest/v3 v3.9.1
github.com/ory/go-acc v0.2.8
github.com/ory/go-acc v0.2.9-0.20230103102148-6b1c9a70dbbe
github.com/ory/graceful v0.1.3
github.com/ory/herodot v0.9.13
github.com/ory/hydra-client-go v1.11.9-0.20221102130300-f558e85344c8
github.com/ory/jsonschema/v3 v3.0.7
github.com/ory/mail/v3 v3.0.0
github.com/ory/nosurf v1.2.7
github.com/ory/x v0.0.533-0.20230116223630-aebae0b3a8a1
github.com/ory/x v0.0.534
github.com/phayes/freeport v0.0.0-20180830031419-95f893ade6f2
github.com/pkg/errors v0.9.1
github.com/pquerna/otp v1.4.0
Expand All @@ -100,11 +100,12 @@ require (
golang.org/x/net v0.5.0
golang.org/x/oauth2 v0.4.0
golang.org/x/sync v0.1.0
golang.org/x/tools v0.4.0
golang.org/x/tools v0.5.0
)

require (
cloud.google.com/go/compute v1.7.0 // indirect
cloud.google.com/go/compute v1.14.0 // indirect
cloud.google.com/go/compute/metadata v0.2.3 // indirect
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/semver v1.5.0 // indirect
Expand All @@ -114,7 +115,7 @@ require (
github.com/a8m/envsubst v1.3.0 // indirect
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 // indirect
github.com/alecthomas/units v0.0.0-20210208195552-ff826a37aa15 // indirect
github.com/armon/go-metrics v0.3.10 // indirect
github.com/armon/go-metrics v0.4.0 // indirect
github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d // indirect
github.com/avast/retry-go/v4 v4.3.0 // indirect
github.com/aymerick/douceur v0.2.0 // indirect
Expand Down Expand Up @@ -199,7 +200,7 @@ require (
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
github.com/hashicorp/go-rootcerts v1.0.2 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/hashicorp/serf v0.9.7 // indirect
github.com/hashicorp/serf v0.10.1 // indirect
github.com/huandu/xstrings v1.3.2 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jackc/chunkreader/v2 v2.0.1 // indirect
Expand Down Expand Up @@ -246,10 +247,8 @@ require (
github.com/opencontainers/image-spec v1.1.0-rc2 // indirect
github.com/opencontainers/runc v1.1.4 // indirect
github.com/openzipkin/zipkin-go v0.4.1 // indirect
github.com/ory/viper v1.7.5 // indirect
github.com/pborman/uuid v1.2.1 // indirect
github.com/pelletier/go-toml v1.9.5 // indirect
github.com/pelletier/go-toml/v2 v2.0.1 // indirect
github.com/pelletier/go-toml/v2 v2.0.6 // indirect
github.com/pkg/profile v1.7.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/pquerna/cachecontrol v0.1.0 // indirect
Expand All @@ -271,8 +270,8 @@ require (
github.com/spf13/afero v1.9.3 // indirect
github.com/spf13/cast v1.5.0 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/viper v1.12.0 // indirect
github.com/subosito/gotenv v1.4.1 // indirect
github.com/spf13/viper v1.15.0 // indirect
github.com/subosito/gotenv v1.4.2 // indirect
github.com/tidwall/match v1.1.1 // indirect
github.com/tidwall/pretty v1.2.1 // indirect
github.com/timtadh/data-structures v0.5.3 // indirect
Expand All @@ -287,10 +286,10 @@ require (
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2 // indirect
github.com/xtgo/uuid v0.0.0-20140804021211-a0b114877d4c // indirect
go.etcd.io/bbolt v1.3.5 // indirect
go.etcd.io/etcd/api/v3 v3.5.4 // indirect
go.etcd.io/etcd/client/pkg/v3 v3.5.4 // indirect
go.etcd.io/etcd/client/v2 v2.305.4 // indirect
go.etcd.io/etcd/client/v3 v3.5.4 // indirect
go.etcd.io/etcd/api/v3 v3.5.6 // indirect
go.etcd.io/etcd/client/pkg/v3 v3.5.6 // indirect
go.etcd.io/etcd/client/v2 v2.305.6 // indirect
go.etcd.io/etcd/client/v3 v3.5.6 // indirect
go.etcd.io/etcd/etcdctl/v3 v3.5.0-alpha.0 // indirect
go.etcd.io/etcd/pkg/v3 v3.5.0-alpha.0 // indirect
go.etcd.io/etcd/raft/v3 v3.5.0-alpha.0 // indirect
Expand All @@ -311,8 +310,8 @@ require (
go.opentelemetry.io/otel/sdk v1.11.1 // indirect
go.opentelemetry.io/proto/otlp v0.18.0 // indirect
go.uber.org/atomic v1.10.0 // indirect
go.uber.org/multierr v1.7.0 // indirect
go.uber.org/zap v1.17.0 // indirect
go.uber.org/multierr v1.8.0 // indirect
go.uber.org/zap v1.21.0 // indirect
golang.org/x/exp v0.0.0-20220303212507-bbda1eaf7a17 // indirect
golang.org/x/mod v0.7.0 // indirect
golang.org/x/sys v0.4.0 // indirect
Expand All @@ -321,8 +320,8 @@ require (
golang.org/x/time v0.1.0 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20221025140454-527a21cfbd71 // indirect
google.golang.org/grpc v1.50.1 // indirect
google.golang.org/genproto v0.0.0-20221227171554-f9683d7f8bef // indirect
google.golang.org/grpc v1.52.0 // indirect
google.golang.org/protobuf v1.28.1 // indirect
gopkg.in/alecthomas/kingpin.v2 v2.2.6 // indirect
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect
Expand Down
28 changes: 21 additions & 7 deletions identity/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,9 @@ func (h *Handler) RegisterAdminRoutes(admin *x.RouterAdmin) {
// Paginated Identity List Response
//
// swagger:response listIdentities
// nolint:deadcode,unused
//
//nolint:deadcode,unused
//lint:ignore U1000 Used to generate Swagger and OpenAPI definitions
type listIdentitiesResponse struct {
migrationpagination.ResponseHeaderAnnotation

Expand All @@ -119,7 +121,9 @@ type listIdentitiesResponse struct {
// Paginated List Identity Parameters
//
// swagger:parameters listIdentities
// nolint:deadcode,unused
//
//nolint:deadcode,unused
//lint:ignore U1000 Used to generate Swagger and OpenAPI definitions
type listIdentitiesParameters struct {
migrationpagination.RequestParameters
}
Expand Down Expand Up @@ -168,7 +172,9 @@ func (h *Handler) list(w http.ResponseWriter, r *http.Request, _ httprouter.Para
// Get Identity Parameters
//
// swagger:parameters getIdentity
// nolint:deadcode,unused
//
//nolint:deadcode,unused
//lint:ignore U1000 Used to generate Swagger and OpenAPI definitions
type getIdentity struct {
// ID must be set to the ID of identity you want to get
//
Expand Down Expand Up @@ -235,7 +241,9 @@ func (h *Handler) get(w http.ResponseWriter, r *http.Request, ps httprouter.Para
// Create Identity Parameters
//
// swagger:parameters createIdentity
// nolint:deadcode,unused
//
//nolint:deadcode,unused
//lint:ignore U1000 Used to generate Swagger and OpenAPI definitions
type createIdentity struct {
// in: body
Body CreateIdentityBody
Expand Down Expand Up @@ -425,7 +433,9 @@ func (h *Handler) create(w http.ResponseWriter, r *http.Request, _ httprouter.Pa
// Update Identity Parameters
//
// swagger:parameters updateIdentity
// nolint:deadcode,unused
//
//nolint:deadcode,unused
//lint:ignore U1000 Used to generate Swagger and OpenAPI definitions
type updateIdentity struct {
// ID must be set to the ID of identity you want to update
//
Expand Down Expand Up @@ -556,7 +566,9 @@ func (h *Handler) update(w http.ResponseWriter, r *http.Request, ps httprouter.P
// Delete Identity Parameters
//
// swagger:parameters deleteIdentity
// nolint:deadcode,unused
//
//nolint:deadcode,unused
//lint:ignore U1000 Used to generate Swagger and OpenAPI definitions
type deleteIdentity struct {
// ID is the identity's ID.
//
Expand Down Expand Up @@ -597,7 +609,9 @@ func (h *Handler) delete(w http.ResponseWriter, r *http.Request, ps httprouter.P
// Patch Identity Parameters
//
// swagger:parameters patchIdentity
// nolint:deadcode,unused
//
//nolint:deadcode,unused
//lint:ignore U1000 Used to generate Swagger and OpenAPI definitions
type patchIdentity struct {
// ID must be set to the ID of identity you want to update
//
Expand Down
Loading

0 comments on commit ae49ef0

Please sign in to comment.