Skip to content

Commit

Permalink
chore: address linter issues
Browse files Browse the repository at this point in the history
  • Loading branch information
aeneasr committed Oct 13, 2024
1 parent ee368bc commit 9174f85
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 14 deletions.
1 change: 1 addition & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ issues:
- "Set is deprecated: use context-based WithConfigValue instead"
- "SetDefaultIdentitySchemaFromRaw is deprecated: Use context-based WithDefaultIdentitySchemaFromRaw instead"
- "SetDefaultIdentitySchema is deprecated: Use context-based WithDefaultIdentitySchema instead"
- "G115"
2 changes: 2 additions & 0 deletions cmd/clidoc/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,8 @@ func validateAllMessages(path string) error {
info := &types.Info{
Defs: make(map[*ast.Ident]types.Object),
}

//nolint:staticcheck
var pack *ast.Package
for _, p := range packs {
if p.Name == "text" {
Expand Down
16 changes: 6 additions & 10 deletions hash/hash_comparator.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (
"crypto/aes"
"crypto/cipher"
"crypto/hmac"
"crypto/md5" //#nosec G501 -- compatibility for imported passwords
"crypto/sha1" //#nosec G505 -- compatibility for imported passwords
"crypto/md5" //nolint:all // System compatibility for imported passwords
"crypto/sha1" //nolint:all // System compatibility for imported passwords
"crypto/sha256"
"crypto/sha512"
"crypto/subtle"
Expand All @@ -21,22 +21,18 @@ import (
"regexp"
"strings"

"github.com/go-crypt/crypt"
"github.com/go-crypt/crypt/algorithm/md5crypt"
"github.com/go-crypt/crypt/algorithm/shacrypt"
"github.com/pkg/errors"
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/attribute"
"golang.org/x/crypto/argon2"
"golang.org/x/crypto/bcrypt"

//nolint:staticcheck
//lint:ignore SA1019 compatibility for imported passwords
"golang.org/x/crypto/md4" //#nosec G501 -- compatibility for imported passwords
"golang.org/x/crypto/md4" //nolint:all // System compatibility for imported passwords
"golang.org/x/crypto/pbkdf2"
"golang.org/x/crypto/scrypt"

"github.com/go-crypt/crypt"
"github.com/go-crypt/crypt/algorithm/md5crypt"
"github.com/go-crypt/crypt/algorithm/shacrypt"

"github.com/ory/kratos/driver/config"
)

Expand Down
2 changes: 1 addition & 1 deletion identity/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ func (e *CreateIdentitiesError) Find(ident *Identity) *FailedIdentity {
return nil
}
func (e *CreateIdentitiesError) ErrOrNil() error {
if e.failedIdentities == nil || len(e.failedIdentities) == 0 {
if len(e.failedIdentities) == 0 {
return nil
}
return e
Expand Down
2 changes: 1 addition & 1 deletion persistence/sql/identity/persister_identity.go
Original file line number Diff line number Diff line change
Expand Up @@ -972,7 +972,7 @@ func (p *IdentityPersister) ListIdentities(ctx context.Context, params identity.
)
}

if params.IdsFilter != nil && len(params.IdsFilter) != 0 {
if len(params.IdsFilter) != 0 {
wheres += `
AND identities.id in (?)
`
Expand Down
2 changes: 1 addition & 1 deletion selfservice/flow/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func NewFlowReplacedError(message *text.Message) *ReplacedError {
return &ReplacedError{
DefaultError: x.ErrGone.WithID(text.ErrIDSelfServiceFlowReplaced).
WithError("self-service flow replaced").
WithReasonf(message.Text),
WithReason(message.Text),
}
}

Expand Down
2 changes: 1 addition & 1 deletion selfservice/strategy/passkey/passkey_registration.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ func (s *Strategy) Register(w http.ResponseWriter, r *http.Request, regFlow *reg
herodot.ErrInternalServerError.WithReasonf("Expected WebAuthN in internal context to be an object but got: %s", err)))
}

if webAuthnSess.UserID == nil || len(webAuthnSess.UserID) == 0 {
if len(webAuthnSess.UserID) == 0 {
return s.handleRegistrationError(w, r, regFlow, params, errors.WithStack(
herodot.ErrInternalServerError.WithReasonf("Expected WebAuthN session data to contain a user ID")))
}
Expand Down

0 comments on commit 9174f85

Please sign in to comment.