Preparing report...

Report for github.com/mendersoftware/useradm

A+    Excellent!    Found 38 issues across 55 files

Tweet

gofmt100%

Gofmt formats Go programs. We run gofmt -s on your code, where -s is for the "simplify" command

No problems detected. Good job!


go_vet100%

go vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string.

No problems detected. Good job!


gocyclo98%

Gocyclo calculates cyclomatic complexities of functions in Go source code. The cyclomatic complexity of a function is calculated according to the following rules: 1 is the base complexity of a function +1 for each 'if', 'for', 'case', '&&' or '||' Go Report Card warns on functions with cyclomatic complexity > 15.


golint34%

Golint is a linter for Go source code.

    • useradm/utils/testing/context.go
    • Line 1: warning: package comment should be of the form "Package testing ..." (golint)
    • Line 22: warning: comment on exported function ContextMatcher should be of the form "ContextMatcher ..." (golint)
    • useradm/config/config.go
    • Line 22: warning: exported const SettingListen should have comment (or a comment on this block) or be unexported (golint)
    • Line 54: warning: exported var ConfigDefaults should have comment or be unexported (golint)
    • useradm/keys/key.go
    • Line 1: warning: package comment should be of the form "Package keys ..." (golint)
    • Line 26: warning: exported const ErrMsgPrivKeyReadFailed should have comment (or a comment on this block) or be unexported (golint)
    • Line 30: warning: exported function LoadRSAPrivate should have comment or be unexported (golint)
    • useradm/store/mongo/datastore_mongo.go
    • Line 37: warning: exported const DbUsersColl should have comment (or a comment on this block) or be unexported (golint)
    • Line 48: warning: exported type DataStoreMongoConfig should have comment or be unexported (golint)
    • Line 61: warning: exported type DataStoreMongo should have comment or be unexported (golint)
    • Line 67: warning: exported function GetDataStoreMongo should have comment or be unexported (golint)
    • Line 75: warning: exported function NewDataStoreMongoWithClient should have comment or be unexported (golint)
    • Line 84: warning: exported function NewDataStoreMongo should have comment or be unexported (golint)
    • Line 135: warning: exported method DataStoreMongo.Ping should have comment or be unexported (golint)
    • Line 140: warning: exported method DataStoreMongo.CreateUser should have comment or be unexported (golint)
    • Line 181: warning: exported method DataStoreMongo.UpdateUser should have comment or be unexported (golint)
    • Line 223: warning: exported method DataStoreMongo.UpdateLoginTs should have comment or be unexported (golint)
    • Line 237: warning: exported method DataStoreMongo.GetUserByEmail should have comment or be unexported (golint)
    • Line 248: warning: if block ends with a return statement, so drop this else and outdent its block (golint)
    • Line 256: warning: exported method DataStoreMongo.GetUserById should have comment or be unexported (golint)
    • Line 270: warning: if block ends with a return statement, so drop this else and outdent its block (golint)
    • Line 278: warning: exported method DataStoreMongo.GetTokenById should have comment or be unexported (golint)
    • Line 289: warning: if block ends with a return statement, so drop this else and outdent its block (golint)
    • Line 297: warning: exported method DataStoreMongo.GetUsers should have comment or be unexported (golint)
    • Line 362: warning: exported method DataStoreMongo.DeleteUser should have comment or be unexported (golint)
    • Line 374: warning: exported method DataStoreMongo.SaveToken should have comment or be unexported (golint)
    • Line 406: warning: exported method DataStoreMongo.DeleteToken should have comment or be unexported (golint)
    • Line 414: warning: comment on exported method DataStoreMongo.DeleteTokens should be of the form "DeleteTokens ..." (golint)
    • Line 432: warning: comment on exported method DataStoreMongo.DeleteTokensByUserId should be of the form "DeleteTokensByUserId ..." (golint)
    • Line 437: warning: comment on exported method DataStoreMongo.DeleteTokensByUserIdExceptCurrentOne should be of the form "DeleteTokensByUserIdExceptCurrentOne ..." (golint)
    • Line 462: warning: exported method DataStoreMongo.SaveSettings should have comment or be unexported (golint)
    • Line 478: warning: exported method DataStoreMongo.GetSettings should have comment or be unexported (golint)
    • useradm/version.go
    • Line 18: warning: comment on exported var Commit should be of the form "Commit ..." (golint)
    • Line 21: warning: comment on exported var Tag should be of the form "Tag ..." (golint)
    • Line 24: warning: comment on exported var Branch should be of the form "Branch ..." (golint)
    • Line 30: warning: comment on exported var BuildNumber should be of the form "BuildNumber ..." (golint)
    • Line 34: warning: exported function CreateVersionString should have comment or be unexported (golint)
    • useradm/api/http/api_useradm.go
    • Line 1: warning: package comment should be of the form "Package http ..." (golint)
    • Line 59: warning: exported var ErrAuthHeader should have comment or be unexported (golint)
    • Line 63: warning: exported type UserAdmApiHandlers should have comment or be unexported (golint)
    • Line 69: warning: comment on exported function NewUserAdmApiHandlers should be of the form "NewUserAdmApiHandlers ..." (golint)
    • Line 78: warning: exported method UserAdmApiHandlers.GetApp should have comment or be unexported (golint)
    • Line 113: warning: exported method UserAdmApiHandlers.AliveHandler should have comment or be unexported (golint)
    • Line 113: warning: receiver name u should be consistent with previous receiver name i for UserAdmApiHandlers (golint)
    • Line 117: warning: exported method UserAdmApiHandlers.HealthHandler should have comment or be unexported (golint)
    • Line 117: warning: receiver name u should be consistent with previous receiver name i for UserAdmApiHandlers (golint)
    • Line 131: warning: exported method UserAdmApiHandlers.AuthLoginHandler should have comment or be unexported (golint)
    • Line 131: warning: receiver name u should be consistent with previous receiver name i for UserAdmApiHandlers (golint)
    • Line 165: warning: exported method UserAdmApiHandlers.AuthLogoutHandler should have comment or be unexported (golint)
    • Line 165: warning: receiver name u should be consistent with previous receiver name i for UserAdmApiHandlers (golint)
    • Line 184: warning: exported method UserAdmApiHandlers.AuthVerifyHandler should have comment or be unexported (golint)
    • Line 184: warning: receiver name u should be consistent with previous receiver name i for UserAdmApiHandlers (golint)
    • Line 205: warning: exported method UserAdmApiHandlers.CreateTenantUserHandler should have comment or be unexported (golint)
    • Line 205: warning: receiver name u should be consistent with previous receiver name i for UserAdmApiHandlers (golint)
    • Line 236: warning: exported method UserAdmApiHandlers.AddUserHandler should have comment or be unexported (golint)
    • Line 236: warning: receiver name u should be consistent with previous receiver name i for UserAdmApiHandlers (golint)
    • Line 266: warning: exported method UserAdmApiHandlers.GetUsersHandler should have comment or be unexported (golint)
    • Line 266: warning: receiver name u should be consistent with previous receiver name i for UserAdmApiHandlers (golint)
    • Line 293: warning: exported method UserAdmApiHandlers.GetTenantUsersHandler should have comment or be unexported (golint)
    • Line 293: warning: receiver name u should be consistent with previous receiver name i for UserAdmApiHandlers (golint)
    • Line 310: warning: exported method UserAdmApiHandlers.GetUserHandler should have comment or be unexported (golint)
    • Line 310: warning: receiver name u should be consistent with previous receiver name i for UserAdmApiHandlers (golint)
    • Line 330: warning: exported method UserAdmApiHandlers.UpdateUserHandler should have comment or be unexported (golint)
    • Line 330: warning: receiver name u should be consistent with previous receiver name i for UserAdmApiHandlers (golint)
    • Line 371: warning: exported method UserAdmApiHandlers.DeleteTenantUserHandler should have comment or be unexported (golint)
    • Line 371: warning: receiver name u should be consistent with previous receiver name i for UserAdmApiHandlers (golint)
    • Line 389: warning: exported method UserAdmApiHandlers.DeleteUserHandler should have comment or be unexported (golint)
    • Line 389: warning: receiver name u should be consistent with previous receiver name i for UserAdmApiHandlers (golint)
    • Line 465: warning: exported method UserAdmApiHandlers.CreateTenantHandler should have comment or be unexported (golint)
    • Line 465: warning: receiver name u should be consistent with previous receiver name i for UserAdmApiHandlers (golint)
    • Line 508: warning: exported method UserAdmApiHandlers.DeleteTokensHandler should have comment or be unexported (golint)
    • Line 508: warning: receiver name u should be consistent with previous receiver name i for UserAdmApiHandlers (golint)
    • Line 530: warning: exported method UserAdmApiHandlers.SaveSettingsHandler should have comment or be unexported (golint)
    • Line 530: warning: receiver name u should be consistent with previous receiver name i for UserAdmApiHandlers (golint)
    • Line 551: warning: exported method UserAdmApiHandlers.GetSettingsHandler should have comment or be unexported (golint)
    • Line 551: warning: receiver name u should be consistent with previous receiver name i for UserAdmApiHandlers (golint)
    • useradm/api/http/middleware.go
    • Line 1: warning: package comment should be of the form "Package http ..." (golint)
    • Line 26: warning: exported function IsVerificationEndpoint should have comment or be unexported (golint)
    • Line 29: warning: if block ends with a return statement, so drop this else and outdent its block (golint)
    • useradm/store/mongo/migrations.go
    • Line 27: warning: exported const DbVersion should have comment (or a comment on this block) or be unexported (golint)
    • Line 65: warning: exported method DataStoreMongo.Migrate should have comment or be unexported (golint)
    • useradm/client/testing/testing.go
    • Line 1: warning: package comment should be of the form "Package testing ..." (golint)
    • Line 23: warning: exported type TestReqData should have comment or be unexported (golint)
    • Line 28: warning: comment on exported function NewMockServer should be of the form "NewMockServer ..." (golint)
    • useradm/authz/middleware.go
    • Line 1: warning: package comment should be of the form "Package authz ..." (golint)
    • Line 28: warning: comment on exported const ReqToken should be of the form "ReqToken ..." (golint)
    • Line 98: warning: comment on exported function ExtractToken should be of the form "ExtractToken ..." (golint)
    • Line 120: warning: exported function GetRequestToken should have comment or be unexported (golint)
    • useradm/server.go
    • Line 27: warning: should not use dot imports (golint)
    • Line 34: warning: exported function SetupAPI should have comment or be unexported (golint)
    • Line 49: warning: exported function RunServer should have comment or be unexported (golint)
    • useradm/authz/authz.go
    • Line 1: warning: package comment should be of the form "Package authz ..." (golint)
    • Line 25: warning: exported var ErrAuthzUnauthorized should have comment or be unexported (golint)
    • useradm/store/mongo/tenant_datastore.go
    • Line 21: warning: exported type TenantStoreMongo should have comment or be unexported (golint)
    • Line 25: warning: exported function NewTenantStoreMongo should have comment or be unexported (golint)
    • Line 31: warning: exported method TenantStoreMongo.MigrateTenant should have comment or be unexported (golint)
    • useradm/api/http/api_handler.go
    • Line 1: warning: package comment should be of the form "Package http ..." (golint)
    • Line 20: warning: comment on exported type ApiHandler should be of the form "ApiHandler ..." (with optional leading article) (golint)
    • useradm/jwt/mocks/JWTHandler.go
    • Line 1: warning: package comment should be of the form "Package mocks ..." (golint)
    • Line 19: warning: comment on exported type Handler should be of the form "Handler ..." (with optional leading article) (golint)
    • useradm/store/datastore.go
    • Line 27: warning: comment on exported var ErrUserNotFound should be of the form "ErrUserNotFound ..." (golint)
    • Line 29: warning: comment on exported var ErrTokenNotFound should be of the form "ErrTokenNotFound ..." (golint)
    • Line 31: warning: comment on exported var ErrDuplicateEmail should be of the form "ErrDuplicateEmail ..." (golint)
    • Line 35: warning: comment on exported type DataStore should be of the form "DataStore ..." (with optional leading article) (golint)
    • useradm/jwt/claims.go
    • Line 1: warning: package comment should be of the form "Package jwt ..." (golint)
    • Line 23: warning: exported type Claims should have comment or be unexported (golint)
    • Line 50: warning: exported method Time.MarshalJSON should have comment or be unexported (golint)
    • Line 55: warning: exported method Time.UnmarshalJSON should have comment or be unexported (golint)
    • useradm/model/tenant.go
    • Line 19: warning: exported type NewTenant should have comment or be unexported (golint)
    • Line 23: warning: exported method NewTenant.Validate should have comment or be unexported (golint)
    • useradm/jwt/jwt.go
    • Line 1: warning: package comment should be of the form "Package jwt ..." (golint)
    • Line 24: warning: exported var ErrTokenExpired should have comment or be unexported (golint)
    • Line 28: warning: comment on exported type Handler should be of the form "Handler ..." (with optional leading article) (golint)
    • Line 43: warning: exported function NewJWTHandlerRS256 should have comment or be unexported (golint)
    • Line 49: warning: exported method JWTHandlerRS256.ToJWT should have comment or be unexported (golint)
    • Line 58: warning: exported method JWTHandlerRS256.FromJWT should have comment or be unexported (golint)
    • useradm/middleware.go
    • Line 34: warning: exported const EnvProd should have comment (or a comment on this block) or be unexported (golint)
    • Line 124: warning: exported function SetupMiddleware should have comment or be unexported (golint)
    • useradm/model/user.go
    • Line 30: warning: exported const MinPasswordLength should have comment (or a comment on this block) or be unexported (golint)
    • Line 34: warning: exported var ErrPasswordTooShort should have comment or be unexported (golint)
    • Line 41: warning: exported type User should have comment or be unexported (golint)
    • Line 61: warning: exported method User.Validate should have comment or be unexported (golint)
    • Line 74: warning: exported type UserInternal should have comment or be unexported (golint)
    • Line 80: warning: exported method UserInternal.Validate should have comment or be unexported (golint)
    • Line 97: warning: exported method UserInternal.ShouldPropagate should have comment or be unexported (golint)
    • Line 101: warning: exported type UserUpdate should have comment or be unexported (golint)
    • Line 118: warning: exported method UserUpdate.Validate should have comment or be unexported (golint)
    • Line 138: warning: exported type UserFilter should have comment or be unexported (golint)
    • Line 149: warning: exported method UserFilter.ParseForm should have comment or be unexported (golint)
    • useradm/client/tenant/client_tenantadm.go
    • Line 1: warning: package comment should be of the form "Package tenant ..." (golint)
    • Line 31: warning: comment on exported const UriBase should be of the form "UriBase ..." (golint)
    • Line 33: warning: exported const GetTenantsUri should have comment (or a comment on this block) or be unexported (golint)
    • Line 44: warning: exported var ErrDuplicateUser should have comment or be unexported (golint)
    • Line 48: warning: comment on exported type Config should be of the form "Config ..." (with optional leading article) (golint)
    • Line 91: warning: exported function NewClient should have comment or be unexported (golint)
    • Line 101: warning: exported method Client.CheckHealth should have comment or be unexported (golint)
    • Line 137: warning: exported method Client.GetTenant should have comment or be unexported (golint)
    • Line 176: warning: exported method Client.CreateUser should have comment or be unexported (golint)
    • Line 214: warning: exported method Client.UpdateUser should have comment or be unexported (golint)
    • Line 257: warning: exported method Client.DeleteUser should have comment or be unexported (golint)
    • Line 284: warning: exported function JoinURL should have comment or be unexported (golint)
    • useradm/scope/scopes.go
    • Line 1: warning: package comment should be of the form "Package scope ..." (golint)
    • Line 17: warning: comment on exported var InitialUserCreate should be of the form "InitialUserCreate ..." (golint)
    • Line 19: warning: comment on exported var All should be of the form "All ..." (golint)
    • useradm/user/useradm.go
    • Line 36: warning: exported var ErrUnauthorized should have comment or be unexported (golint)
    • Line 45: warning: exported const TenantStatusSuspended should have comment (or a comment on this block) or be unexported (golint)
    • Line 48: warning: comment on exported type App should be of the form "App ..." (with optional leading article) (golint)
    • Line 72: warning: exported type Config should have comment or be unexported (golint)
    • Line 79: warning: exported type ApiClientGetter should have comment or be unexported (golint)
    • Line 85: warning: exported type UserAdm should have comment or be unexported (golint)
    • Line 96: warning: exported function NewUserAdm should have comment or be unexported (golint)
    • Line 108: warning: exported method UserAdm.HealthCheck should have comment or be unexported (golint)
    • Line 124: warning: exported method UserAdm.Login should have comment or be unexported (golint)
    • Line 208: warning: exported method UserAdm.SignToken should have comment or be unexported (golint)
    • Line 212: warning: exported method UserAdm.Logout should have comment or be unexported (golint)
    • Line 216: warning: exported method UserAdm.CreateUser should have comment or be unexported (golint)
    • Line 216: warning: receiver name ua should be consistent with previous receiver name u for UserAdm (golint)
    • Line 226: warning: exported method UserAdm.CreateUserInternal should have comment or be unexported (golint)
    • Line 226: warning: receiver name ua should be consistent with previous receiver name u for UserAdm (golint)
    • Line 240: warning: receiver name ua should be consistent with previous receiver name u for UserAdm (golint)
    • Line 305: warning: receiver name ua should be consistent with previous receiver name u for UserAdm (golint)
    • Line 315: warning: exported method UserAdm.UpdateUser should have comment or be unexported (golint)
    • Line 315: warning: receiver name ua should be consistent with previous receiver name u for UserAdm (golint)
    • Line 359: warning: exported method UserAdm.Verify should have comment or be unexported (golint)
    • Line 359: warning: receiver name ua should be consistent with previous receiver name u for UserAdm (golint)
    • Line 406: warning: exported method UserAdm.GetUsers should have comment or be unexported (golint)
    • Line 406: warning: receiver name ua should be consistent with previous receiver name u for UserAdm (golint)
    • Line 415: warning: exported method UserAdm.GetUser should have comment or be unexported (golint)
    • Line 415: warning: receiver name ua should be consistent with previous receiver name u for UserAdm (golint)
    • Line 424: warning: exported method UserAdm.DeleteUser should have comment or be unexported (golint)
    • Line 424: warning: receiver name ua should be consistent with previous receiver name u for UserAdm (golint)
    • Line 450: warning: exported method UserAdm.CreateTenant should have comment or be unexported (golint)
    • Line 457: warning: exported method UserAdm.SetPassword should have comment or be unexported (golint)
    • Line 457: warning: receiver name ua should be consistent with previous receiver name u for UserAdm (golint)
    • Line 484: warning: exported method UserAdm.DeleteTokens should have comment or be unexported (golint)
    • Line 484: warning: receiver name ua should be consistent with previous receiver name u for UserAdm (golint)
    • useradm/store/mongo/migration_1_1_4.go
    • Line 29: warning: exported const OldDbUniqueEmailIndexName should have comment (or a comment on this block) or be unexported (golint)
    • Line 32: warning: don't use underscores in Go names; type migration_1_1_4 should be migration1_1_4 (golint)
    • Line 37: warning: exported const ErrCodeIndexOptionsError should have comment or be unexported (golint)

license100%

Checks whether your project has a LICENSE file.

No problems detected. Good job!


ineffassign98%

IneffAssign detects ineffectual assignments in Go code.


misspell96%

Misspell Finds commonly misspelled English words