Preparing report...

Report for github.com/DuC-cnZj/sso-demo

A+    Excellent!    Found 41 issues across 59 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!


gocyclo100%

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.

No problems detected. Good job!


golint30%

Golint is a linter for Go source code.

    • sso-demo/server/server.go
    • Line 22: warning: a blank import should be only in a main or test package, or have a comment justifying it (golint)
    • Line 30: warning: exported type Loader should have comment or be unexported (golint)
    • Line 35: warning: exported type LoaderCollection should have comment or be unexported (golint)
    • Line 49: warning: exported type Server should have comment or be unexported (golint)
    • Line 62: warning: exported method Server.Engine should have comment or be unexported (golint)
    • Line 66: warning: exported method Server.SetRunningInConsole should have comment or be unexported (golint)
    • Line 70: warning: exported method Server.RunningInConsole should have comment or be unexported (golint)
    • Line 74: warning: exported method Server.Config should have comment or be unexported (golint)
    • Line 78: warning: exported method Server.Env should have comment or be unexported (golint)
    • Line 82: warning: exported method Server.Init should have comment or be unexported (golint)
    • Line 128: warning: exported method Server.Run should have comment or be unexported (golint)
    • Line 134: warning: exported method Server.Shutdown should have comment or be unexported (golint)
    • Line 138: warning: exported method Server.ProductionMode should have comment or be unexported (golint)
    • Line 143: warning: exported method Server.DebugMode should have comment or be unexported (golint)
    • Line 157: warning: exported method Server.LoadTranslators should have comment or be unexported (golint)
    • Line 172: warning: exported function ReadConfig should have comment or be unexported (golint)
    • sso-demo/app/controllers/api/admin/usercontroller/usercontroller.go
    • Line 18: warning: exported type StoreInput should have comment or be unexported (golint)
    • Line 24: warning: exported type UpdateInput should have comment or be unexported (golint)
    • Line 29: warning: exported type QueryInput should have comment or be unexported (golint)
    • Line 38: warning: exported type ChangePwdInput should have comment or be unexported (golint)
    • Line 42: warning: exported type SyncInput should have comment or be unexported (golint)
    • Line 46: warning: exported type UserController should have comment or be unexported (golint)
    • Line 51: warning: exported function NewUserController should have comment or be unexported (golint)
    • Line 58: warning: exported method UserController.Index should have comment or be unexported (golint)
    • Line 101: warning: exported method UserController.Store should have comment or be unexported (golint)
    • Line 145: warning: exported method UserController.Show should have comment or be unexported (golint)
    • Line 166: warning: exported method UserController.Update should have comment or be unexported (golint)
    • Line 218: warning: exported method UserController.Destroy should have comment or be unexported (golint)
    • Line 246: warning: exported method UserController.SyncRoles should have comment or be unexported (golint)
    • Line 279: warning: exported method UserController.ChangePassword should have comment or be unexported (golint)
    • Line 310: warning: exported method UserController.ForceLogout should have comment or be unexported (golint)
    • sso-demo/utils/interrupt/interrupt.go
    • Line 1: warning: package comment should be of the form "Package interrupt ..." (golint)
    • Line 11: warning: exported function Context should have comment or be unexported (golint)
    • Line 15: warning: exported function WrappedContext should have comment or be unexported (golint)
    • sso-demo/server/env_loader.go
    • Line 5: warning: exported type EnvLoader should have comment or be unexported (golint)
    • Line 8: warning: exported method EnvLoader.GetWeight should have comment or be unexported (golint)
    • Line 12: warning: exported method EnvLoader.Load should have comment or be unexported (golint)
    • sso-demo/server/redis_loader.go
    • Line 10: warning: exported type RedisLoader should have comment or be unexported (golint)
    • Line 13: warning: exported method RedisLoader.GetWeight should have comment or be unexported (golint)
    • Line 17: warning: exported method RedisLoader.Load should have comment or be unexported (golint)
    • sso-demo/app/auth/auth.go
    • Line 7: warning: exported type Auth should have comment or be unexported (golint)
    • Line 11: warning: exported function NewAuth should have comment or be unexported (golint)
    • Line 15: warning: exported method Auth.SetUser should have comment or be unexported (golint)
    • Line 19: warning: exported method Auth.HasPermission should have comment or be unexported (golint)
    • Line 29: warning: exported method Auth.HasRole should have comment or be unexported (golint)
    • Line 39: warning: exported method Auth.IsAdmin should have comment or be unexported (golint)
    • sso-demo/pkg/filters/filters.go
    • Line 8: warning: error var FieldNotFound should have name of the form ErrFoo (golint)
    • Line 8: warning: exported var FieldNotFound should have comment or be unexported (golint)
    • Line 10: warning: exported type GormScopeFunc should have comment or be unexported (golint)
    • Line 12: warning: exported type Filterable should have comment or be unexported (golint)
    • Line 24: warning: exported type Filter should have comment or be unexported (golint)
    • Line 31: warning: exported function NewFilter should have comment or be unexported (golint)
    • Line 35: warning: exported method Filter.RegisterFunc should have comment or be unexported (golint)
    • Line 39: warning: exported method Filter.GetInput should have comment or be unexported (golint)
    • Line 46: warning: exported method Filter.SetInput should have comment or be unexported (golint)
    • Line 50: warning: exported method Filter.AllFilters should have comment or be unexported (golint)
    • Line 58: warning: exported method Filter.Scopes should have comment or be unexported (golint)
    • Line 62: warning: exported method Filter.ResetScopes should have comment or be unexported (golint)
    • Line 66: warning: exported method Filter.GetFuncByName should have comment or be unexported (golint)
    • Line 74: warning: exported method Filter.Apply should have comment or be unexported (golint)
    • Line 79: warning: exported method Filter.Push should have comment or be unexported (golint)
    • Line 83: warning: exported function DefaultApply should have comment or be unexported (golint)
    • sso-demo/utils/exception/expection.go
    • Line 13: warning: exported var Unauthorized should have comment or be unexported (golint)
    • Line 17: warning: exported var Forbidden should have comment or be unexported (golint)
    • Line 21: warning: exported var InternalError should have comment or be unexported (golint)
    • Line 25: warning: exported var InternalErrorWithMsg should have comment or be unexported (golint)
    • Line 35: warning: exported function ModelNotFound should have comment or be unexported (golint)
    • Line 42: warning: exported function ValidateException should have comment or be unexported (golint)
    • sso-demo/repositories/role_repositories/role_repository.go
    • Line 1: warning: don't use an underscore in package name (golint)
    • Line 11: warning: exported type RoleRepositoryImp should have comment or be unexported (golint)
    • Line 21: warning: exported type RoleRepository should have comment or be unexported (golint)
    • Line 25: warning: exported function NewRoleRepository should have comment or be unexported (golint)
    • Line 29: warning: exported method RoleRepository.FindByIds should have comment or be unexported (golint)
    • Line 39: warning: exported method RoleRepository.FindById should have comment or be unexported (golint)
    • Line 49: warning: exported method RoleRepository.FindByName should have comment or be unexported (golint)
    • Line 62: warning: exported method RoleRepository.FindByIdWithPermissions should have comment or be unexported (golint)
    • Line 76: warning: exported method RoleRepository.Create should have comment or be unexported (golint)
    • Line 83: warning: exported method RoleRepository.CreateWithPermissionIds should have comment or be unexported (golint)
    • Line 102: warning: exported method RoleRepository.SyncPermissions should have comment or be unexported (golint)
    • sso-demo/server/session_loader.go
    • Line 9: warning: exported type SessionLoader should have comment or be unexported (golint)
    • Line 12: warning: exported method SessionLoader.GetWeight should have comment or be unexported (golint)
    • Line 16: warning: exported method SessionLoader.Load should have comment or be unexported (golint)
    • sso-demo/server/config_loader.go
    • Line 8: warning: exported type ConfigLoader should have comment or be unexported (golint)
    • Line 11: warning: exported method ConfigLoader.GetWeight should have comment or be unexported (golint)
    • Line 15: warning: exported method ConfigLoader.Load should have comment or be unexported (golint)
    • sso-demo/server/db_loader.go
    • Line 10: warning: exported type DBLoader should have comment or be unexported (golint)
    • Line 13: warning: exported method DBLoader.GetWeight should have comment or be unexported (golint)
    • Line 17: warning: exported method DBLoader.Load should have comment or be unexported (golint)
    • sso-demo/app/filters/apitoken.go
    • Line 10: warning: exported type ApiTokenInput should have comment or be unexported (golint)
    • Line 14: warning: exported function NewApiTokenFilter should have comment or be unexported (golint)
    • Line 36: warning: exported function UserId should have comment or be unexported (golint)
    • sso-demo/app/filters/user.go
    • Line 10: warning: exported type UserInput should have comment or be unexported (golint)
    • Line 16: warning: exported function NewUserFilter should have comment or be unexported (golint)
    • Line 35: warning: exported function UserName should have comment or be unexported (golint)
    • Line 45: warning: exported function Email should have comment or be unexported (golint)
    • Line 56: warning: exported function Sort should have comment or be unexported (golint)
    • sso-demo/app/middlewares/auth/auth.go
    • Line 12: warning: exported const HttpAuthToken should have comment or be unexported (golint)
    • Line 14: warning: exported function SessionMiddleware should have comment or be unexported (golint)
    • Line 24: warning: if block ends with a return statement, so drop this else and outdent its block (golint)
    • Line 35: warning: exported function GuestMiddleware should have comment or be unexported (golint)
    • Line 51: warning: if block ends with a return statement, so drop this else and outdent its block (golint)
    • Line 60: warning: comment on exported function CheckLogoutTokenIsChanged should be of the form "CheckLogoutTokenIsChanged ..." (golint)
    • Line 80: warning: exported function ApiMiddleware should have comment or be unexported (golint)
    • sso-demo/repositories/token_repository/token_repository.go
    • Line 1: warning: don't use an underscore in package name (golint)
    • Line 5: warning: exported type TokenRepositoryImp should have comment or be unexported (golint)
    • Line 8: warning: exported type TokenRepository should have comment or be unexported (golint)
    • Line 12: warning: exported function NewTokenRepository should have comment or be unexported (golint)
    • sso-demo/utils/form/form.go
    • Line 9: warning: exported type ValidateError should have comment or be unexported (golint)
    • Line 14: warning: exported type ValidateErrors should have comment or be unexported (golint)
    • Line 16: warning: comment on exported function ErrorsToMap should be of the form "ErrorsToMap ..." (golint)
    • sso-demo/tests/testhelper.go
    • Line 32: warning: exported function NewTestServer should have comment or be unexported (golint)
    • Line 41: warning: exported function MainHelper should have comment or be unexported (golint)
    • Line 66: warning: exported function WarpTxRollback should have comment or be unexported (golint)
    • Line 79: warning: exported function NewUserWithToken should have comment or be unexported (golint)
    • Line 87: warning: exported function NewUser should have comment or be unexported (golint)
    • Line 106: warning: exported function GetJson should have comment or be unexported (golint)
    • Line 123: warning: exported function PostJson should have comment or be unexported (golint)
    • Line 138: warning: exported function PutJson should have comment or be unexported (golint)
    • Line 153: warning: exported function DeleteJson should have comment or be unexported (golint)
    • Line 166: warning: exported function WebPostJson should have comment or be unexported (golint)
    • sso-demo/server/environment_loader.go
    • Line 5: warning: exported type EnvironmentLoader should have comment or be unexported (golint)
    • Line 8: warning: exported method EnvironmentLoader.Load should have comment or be unexported (golint)
    • Line 20: warning: exported method EnvironmentLoader.GetWeight should have comment or be unexported (golint)
    • sso-demo/app/controllers/api/api.go
    • Line 12: warning: exported type AllRepo should have comment or be unexported (golint)
    • Line 19: warning: exported function NewAllRepo should have comment or be unexported (golint)
    • Line 28: warning: exported function Ping should have comment or be unexported (golint)
    • Line 33: warning: exported function NotFound should have comment or be unexported (golint)
    • sso-demo/repositories/permission_repository/permission_repository.go
    • Line 1: warning: don't use an underscore in package name (golint)
    • Line 11: warning: exported type PermissionRepositoryImp should have comment or be unexported (golint)
    • Line 18: warning: exported type PermissionRepository should have comment or be unexported (golint)
    • Line 22: warning: exported function NewPermissionRepository should have comment or be unexported (golint)
    • Line 26: warning: exported method PermissionRepository.FindByIds should have comment or be unexported (golint)
    • Line 37: warning: exported method PermissionRepository.FindById should have comment or be unexported (golint)
    • Line 48: warning: exported method PermissionRepository.FindByName should have comment or be unexported (golint)
    • Line 60: warning: exported method PermissionRepository.Create should have comment or be unexported (golint)
    • sso-demo/server/validator_loader.go
    • Line 10: warning: exported type ValidatorLoader should have comment or be unexported (golint)
    • Line 13: warning: exported method ValidatorLoader.Load should have comment or be unexported (golint)
    • Line 34: warning: exported method ValidatorLoader.GetWeight should have comment or be unexported (golint)
    • sso-demo/app/controllers/api/admin/permissioncontroller/permissioncontroller.go
    • Line 16: warning: exported type PermissionController should have comment or be unexported (golint)
    • Line 21: warning: exported type Uri should have comment or be unexported (golint)
    • Line 25: warning: exported type StoreInput should have comment or be unexported (golint)
    • Line 31: warning: exported type UpdateInput should have comment or be unexported (golint)
    • Line 37: warning: exported type QueryInput should have comment or be unexported (golint)
    • Line 46: warning: exported function NewPermissionController should have comment or be unexported (golint)
    • Line 50: warning: exported method PermissionController.Index should have comment or be unexported (golint)
    • Line 111: warning: exported method PermissionController.Store should have comment or be unexported (golint)
    • Line 145: warning: exported method PermissionController.Show should have comment or be unexported (golint)
    • Line 160: warning: exported method PermissionController.Update should have comment or be unexported (golint)
    • Line 207: warning: exported method PermissionController.Destroy should have comment or be unexported (golint)
    • Line 235: warning: exported method PermissionController.GetByGroups should have comment or be unexported (golint)
    • Line 266: warning: exported method PermissionController.GetPermissionProjects should have comment or be unexported (golint)
    • sso-demo/config/env/env.go
    • Line 15: warning: exported type Config should have comment or be unexported (golint)
    • Line 41: warning: exported type Env should have comment or be unexported (golint)
    • Line 53: warning: exported method Env.SetAuth should have comment or be unexported (golint)
    • Line 57: warning: exported method Env.Auth should have comment or be unexported (golint)
    • Line 61: warning: exported method Env.SetDB should have comment or be unexported (golint)
    • Line 65: warning: exported method Env.IsDebugging should have comment or be unexported (golint)
    • Line 69: warning: exported method Env.SkipLoadResources should have comment or be unexported (golint)
    • Line 73: warning: exported method Env.IsSkipLoadResources should have comment or be unexported (golint)
    • Line 77: warning: exported method Env.Config should have comment or be unexported (golint)
    • Line 81: warning: exported method Env.RedisPool should have comment or be unexported (golint)
    • Line 85: warning: exported method Env.IsProduction should have comment or be unexported (golint)
    • Line 89: warning: exported method Env.IsLocal should have comment or be unexported (golint)
    • Line 93: warning: exported method Env.IsTesting should have comment or be unexported (golint)
    • Line 97: warning: exported method Env.SessionStore should have comment or be unexported (golint)
    • Line 101: warning: exported type Operator should have comment or be unexported (golint)
    • Line 103: warning: exported function NewEnv should have comment or be unexported (golint)
    • Line 119: warning: exported function WithUniversalTranslator should have comment or be unexported (golint)
    • Line 125: warning: exported function WithAuth should have comment or be unexported (golint)
    • Line 131: warning: exported function WithRootDir should have comment or be unexported (golint)
    • Line 137: warning: exported method Env.GetUniversalTranslator should have comment or be unexported (golint)
    • Line 141: warning: exported method Env.GetDB should have comment or be unexported (golint)
    • Line 145: warning: exported method Env.DBTransaction should have comment or be unexported (golint)
    • Line 151: warning: exported method Env.RootDir should have comment or be unexported (golint)
    • Line 155: warning: exported method Env.PrintConfig should have comment or be unexported (golint)
    • sso-demo/app/middlewares/jwt/jwt.go
    • Line 18: warning: exported type SsoJwtClaims should have comment or be unexported (golint)
    • Line 23: warning: exported function AuthMiddleware should have comment or be unexported (golint)
    • Line 57: warning: exported function Unauthorized should have comment or be unexported (golint)
    • Line 64: warning: exported function GetBearerToken should have comment or be unexported (golint)
    • Line 75: warning: exported function GenerateToken should have comment or be unexported (golint)
    • Line 94: warning: exported function Parse should have comment or be unexported (golint)
    • sso-demo/repositories/user_repository/user_repository.go
    • Line 1: warning: don't use an underscore in package name (golint)
    • Line 16: warning: exported type UserWithRBAC should have comment or be unexported (golint)
    • Line 27: warning: exported var ErrorTokenExpired should have comment or be unexported (golint)
    • Line 30: warning: exported type UserRepositoryImp should have comment or be unexported (golint)
    • Line 48: warning: exported type UserRepository should have comment or be unexported (golint)
    • Line 52: warning: exported function NewUserRepository should have comment or be unexported (golint)
    • Line 58: warning: exported method UserRepository.FindByEmail should have comment or be unexported (golint)
    • Line 70: warning: exported method UserRepository.GeneratePwd should have comment or be unexported (golint)
    • Line 79: warning: exported method UserRepository.ChangePwd should have comment or be unexported (golint)
    • Line 88: warning: exported method UserRepository.Create should have comment or be unexported (golint)
    • Line 96: warning: exported method UserRepository.FindById should have comment or be unexported (golint)
    • Line 108: warning: exported method UserRepository.SyncRoles should have comment or be unexported (golint)
    • Line 123: warning: exported method UserRepository.ForceLogout should have comment or be unexported (golint)
    • Line 128: warning: exported method UserRepository.GenerateApiToken should have comment or be unexported (golint)
    • Line 162: warning: exported method UserRepository.GenerateLogoutToken should have comment or be unexported (golint)
    • Line 167: warning: exported method UserRepository.GenerateAccessToken should have comment or be unexported (golint)
    • Line 202: warning: exported method UserRepository.FindByToken should have comment or be unexported (golint)
    • Line 227: warning: exported method UserRepository.SyncPermissions should have comment or be unexported (golint)
    • Line 239: warning: exported method UserRepository.UpdateLastLoginAt should have comment or be unexported (golint)
    • Line 243: warning: exported method UserRepository.FindWithRoles should have comment or be unexported (golint)
    • Line 254: warning: exported method UserRepository.LoadUserRoleAndPermissionPretty should have comment or be unexported (golint)
    • sso-demo/app/controllers/api/admin/rolecontroller/rolecontroller.go
    • Line 17: warning: exported type QueryInput should have comment or be unexported (golint)
    • Line 25: warning: exported type RoleStoreInput should have comment or be unexported (golint)
    • Line 31: warning: exported type RoleUpdateInput should have comment or be unexported (golint)
    • Line 37: warning: exported type RoleController should have comment or be unexported (golint)
    • Line 42: warning: exported function NewRoleController should have comment or be unexported (golint)
    • Line 46: warning: exported method RoleController.Index should have comment or be unexported (golint)
    • Line 103: warning: exported method RoleController.Store should have comment or be unexported (golint)
    • Line 140: warning: exported method RoleController.Show should have comment or be unexported (golint)
    • Line 158: warning: exported method RoleController.Update should have comment or be unexported (golint)
    • Line 216: warning: exported method RoleController.Destroy should have comment or be unexported (golint)
    • Line 244: warning: exported method RoleController.All should have comment or be unexported (golint)
    • sso-demo/app/models/user.go
    • Line 7: warning: exported type SimplePerm should have comment or be unexported (golint)
    • Line 12: warning: exported type User should have comment or be unexported (golint)
    • Line 31: warning: exported method User.TableName should have comment or be unexported (golint)
    • sso-demo/app/middlewares/jwt/blacklist.go
    • Line 10: warning: exported const BlacklistKeyPrefix should have comment or be unexported (golint)
    • Line 12: warning: exported function AddToBlacklist should have comment or be unexported (golint)
    • Line 20: warning: exported function KeyInBlacklist should have comment or be unexported (golint)

license100%

Checks whether your project has a LICENSE file.

No problems detected. Good job!


ineffassign100%

IneffAssign detects ineffectual assignments in Go code.

No problems detected. Good job!


misspell100%

Misspell Finds commonly misspelled English words

No problems detected. Good job!