Preparing report...

Report for github.com/swagchat/chat-api

A    Great!    Found 84 issues across 154 files

Tweet

gofmt72%

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


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!


golint77%

Golint is a linter for Go source code.

    • chat-api/model/blockUser.go
    • Line 10: warning: exported type BlockUser should have comment or be unexported (golint)
    • Line 14: warning: exported type AddBlockUsersRequest should have comment or be unexported (golint)
    • Line 18: warning: exported method AddBlockUsersRequest.Validate should have comment or be unexported (golint)
    • Line 54: warning: exported method AddBlockUsersRequest.GenerateBlockUsers should have comment or be unexported (golint)
    • Line 67: warning: exported type RetrieveBlockUsersRequest should have comment or be unexported (golint)
    • Line 71: warning: exported type BlockUsersResponse should have comment or be unexported (golint)
    • Line 76: warning: exported method BlockUsersResponse.ConvertToPbBlockUsers should have comment or be unexported (golint)
    • Line 102: warning: exported type BlockUserIdsResponse should have comment or be unexported (golint)
    • Line 106: warning: exported method BlockUserIdsResponse.ConvertToPbBlockUserIds should have comment or be unexported (golint)
    • Line 116: warning: exported type RetrieveBlockedUsersRequest should have comment or be unexported (golint)
    • Line 120: warning: exported type BlockedUsersResponse should have comment or be unexported (golint)
    • Line 125: warning: exported method BlockedUsersResponse.ConvertToPbBlockedUsers should have comment or be unexported (golint)
    • Line 151: warning: exported type BlockedUserIdsResponse should have comment or be unexported (golint)
    • Line 155: warning: exported method BlockedUserIdsResponse.ConvertToPbBlockedUserIds should have comment or be unexported (golint)
    • Line 165: warning: exported type DeleteBlockUsersRequest should have comment or be unexported (golint)
    • Line 169: warning: exported method DeleteBlockUsersRequest.Validate should have comment or be unexported (golint)
    • chat-api/model/roomUser.go
    • Line 9: warning: exported type RoomUser should have comment or be unexported (golint)
    • Line 13: warning: exported method RoomUser.UpdateRoomUser should have comment or be unexported (golint)
    • Line 23: warning: exported type AddRoomUsersRequest should have comment or be unexported (golint)
    • Line 28: warning: exported method AddRoomUsersRequest.Validate should have comment or be unexported (golint)
    • Line 74: warning: exported method AddRoomUsersRequest.GenerateRoomUsers should have comment or be unexported (golint)
    • Line 87: warning: exported type RetrieveRoomUsersRequest should have comment or be unexported (golint)
    • Line 91: warning: exported type RoomUsersResponse should have comment or be unexported (golint)
    • Line 96: warning: exported method RoomUsersResponse.ConvertToPbRoomUsers should have comment or be unexported (golint)
    • Line 115: warning: exported type RoomUserIdsResponse should have comment or be unexported (golint)
    • Line 119: warning: exported method RoomUserIdsResponse.ConvertToPbRoomUserIDs should have comment or be unexported (golint)
    • Line 125: warning: exported type UpdateRoomUserRequest should have comment or be unexported (golint)
    • Line 129: warning: exported type DeleteRoomUsersRequest should have comment or be unexported (golint)
    • Line 134: warning: exported method DeleteRoomUsersRequest.Validate should have comment or be unexported (golint)
    • chat-api/model/setting.go
    • Line 8: warning: exported type Setting should have comment or be unexported (golint)
    • Line 16: warning: exported method Setting.MarshalJSON should have comment or be unexported (golint)
    • chat-api/datastore/subscriptionStore.go
    • Line 14: warning: exported type SelectDeletedSubscriptionsOption should have comment or be unexported (golint)
    • Line 16: warning: exported function SelectDeletedSubscriptionsOptionFilterByRoomID should have comment or be unexported (golint)
    • Line 22: warning: exported function SelectDeletedSubscriptionsOptionFilterByUserID should have comment or be unexported (golint)
    • Line 28: warning: exported function SelectDeletedSubscriptionsOptionFilterByPlatform should have comment or be unexported (golint)
    • Line 41: warning: exported type DeleteSubscriptionsOption should have comment or be unexported (golint)
    • Line 43: warning: exported function DeleteSubscriptionsOptionWithLogicalDeleted should have comment or be unexported (golint)
    • Line 49: warning: exported function DeleteSubscriptionsOptionFilterByRoomID should have comment or be unexported (golint)
    • Line 55: warning: exported function DeleteSubscriptionsOptionFilterByUserID should have comment or be unexported (golint)
    • Line 61: warning: exported function DeleteSubscriptionsOptionFilterByPlatform should have comment or be unexported (golint)
    • chat-api/model/errorResponse.go
    • Line 12: warning: exported type ErrorResponseOption should have comment or be unexported (golint)
    • Line 14: warning: exported function WithError should have comment or be unexported (golint)
    • Line 20: warning: exported function WithInvalidParams should have comment or be unexported (golint)
    • Line 26: warning: exported type ErrorResponse should have comment or be unexported (golint)
    • chat-api/model/user.go
    • Line 12: warning: exported type User should have comment or be unexported (golint)
    • Line 18: warning: exported method User.MarshalJSON should have comment or be unexported (golint)
    • Line 60: warning: exported method User.IsRole should have comment or be unexported (golint)
    • Line 74: warning: exported method User.ConvertToPbUser should have comment or be unexported (golint)
    • Line 108: warning: exported method User.UpdateUser should have comment or be unexported (golint)
    • Line 141: warning: exported type MiniRoom should have comment or be unexported (golint)
    • Line 147: warning: exported method MiniRoom.MarshalJSON should have comment or be unexported (golint)
    • Line 186: warning: exported type CreateUserRequest should have comment or be unexported (golint)
    • Line 191: warning: exported method CreateUserRequest.Validate should have comment or be unexported (golint)
    • Line 251: warning: exported method CreateUserRequest.GenerateUser should have comment or be unexported (golint)
    • Line 312: warning: exported method CreateUserRequest.GenerateBlockUsers should have comment or be unexported (golint)
    • Line 325: warning: exported method CreateUserRequest.GenerateUserRoles should have comment or be unexported (golint)
    • Line 338: warning: exported method User.DoPostProcessing should have comment or be unexported (golint)
    • Line 352: warning: exported type RetrieveUsersRequest should have comment or be unexported (golint)
    • Line 356: warning: exported type UsersResponse should have comment or be unexported (golint)
    • Line 361: warning: exported method UsersResponse.ConvertToPbUsers should have comment or be unexported (golint)
    • Line 387: warning: exported type RetrieveUserRequest should have comment or be unexported (golint)
    • Line 391: warning: exported type UpdateUserRequest should have comment or be unexported (golint)
    • Line 396: warning: exported method UpdateUserRequest.Validate should have comment or be unexported (golint)
    • Line 435: warning: exported method UpdateUserRequest.GenerateUserRoles should have comment or be unexported (golint)
    • Line 448: warning: exported type DeleteUserRequest should have comment or be unexported (golint)
    • Line 452: warning: exported type RetrieveUserRoomsRequest should have comment or be unexported (golint)
    • Line 456: warning: exported type UserRoomsResponse should have comment or be unexported (golint)
    • Line 461: warning: exported method UserRoomsResponse.ConvertToPbUserRooms should have comment or be unexported (golint)
    • Line 509: warning: exported type RetrieveContactsRequest should have comment or be unexported (golint)
    • Line 513: warning: exported type RetrieveProfileRequest should have comment or be unexported (golint)
    • Line 517: warning: exported type RetrieveRoleUsersRequest should have comment or be unexported (golint)
    • Line 521: warning: exported method RetrieveRoleUsersRequest.Validate should have comment or be unexported (golint)
    • Line 536: warning: exported type RoleUsersResponse should have comment or be unexported (golint)
    • Line 540: warning: exported method RoleUsersResponse.ConvertToPbRoleUsers should have comment or be unexported (golint)
    • chat-api/datastore/userStore.go
    • Line 8: warning: exported type InsertUserOption should have comment or be unexported (golint)
    • Line 15: warning: exported function InsertUserOptionWithBlockUsers should have comment or be unexported (golint)
    • Line 21: warning: exported function InsertUserOptionWithUserRoles should have comment or be unexported (golint)
    • Line 27: warning: exported type SelectUsersOption should have comment or be unexported (golint)
    • Line 33: warning: exported function SelectUsersOptionWithOrders should have comment or be unexported (golint)
    • Line 39: warning: exported type SelectContactsOption should have comment or be unexported (golint)
    • Line 45: warning: exported function SelectContactsOptionWithOrders should have comment or be unexported (golint)
    • Line 57: warning: exported type SelectUserOption should have comment or be unexported (golint)
    • Line 59: warning: exported function SelectUserOptionWithBlocks should have comment or be unexported (golint)
    • Line 65: warning: exported function SelectUserOptionWithDevices should have comment or be unexported (golint)
    • Line 71: warning: exported function SelectUserOptionWithRoles should have comment or be unexported (golint)
    • Line 77: warning: exported type UpdateUserOption should have comment or be unexported (golint)
    • Line 85: warning: exported function UpdateUserOptionWithBlockUsers should have comment or be unexported (golint)
    • Line 91: warning: exported function UpdateUserOptionWithUserRoles should have comment or be unexported (golint)
    • Line 97: warning: exported function UpdateUserOptionMarkAllAsRead should have comment or be unexported (golint)
    • chat-api/datastore/messageStore.go
    • Line 16: warning: exported type SelectMessagesOption should have comment or be unexported (golint)
    • Line 18: warning: exported function SelectMessagesOptionFilterByRoomID should have comment or be unexported (golint)
    • Line 24: warning: exported function SelectMessagesOptionFilterByRoleIDs should have comment or be unexported (golint)
    • Line 30: warning: exported function SelectMessagesOptionOrders should have comment or be unexported (golint)
    • Line 36: warning: exported function SelectMessagesOptionLimitTimestamp should have comment or be unexported (golint)
    • Line 42: warning: exported function SelectMessagesOptionOffsetTimestamp should have comment or be unexported (golint)
    • chat-api/config/config.go
    • Line 109: warning: exported type Datastore should have comment or be unexported (golint)
    • Line 126: warning: exported type SQLite should have comment or be unexported (golint)
    • Line 131: warning: exported type ServerInfo should have comment or be unexported (golint)
    • Line 140: warning: exported type Producer should have comment or be unexported (golint)
    • Line 165: warning: exported type Consumer should have comment or be unexported (golint)
    • Line 186: warning: exported type Notification should have comment or be unexported (golint)
    • Line 201: warning: exported function NewConfig should have comment or be unexported (golint)
    • chat-api/model/room.go
    • Line 14: warning: exported type Room should have comment or be unexported (golint)
    • Line 20: warning: exported method Room.MarshalJSON should have comment or be unexported (golint)
    • Line 64: warning: exported method Room.ConvertToPbRoom should have comment or be unexported (golint)
    • Line 77: warning: exported method Room.UpdateRoom should have comment or be unexported (golint)
    • Line 115: warning: exported type MiniUser should have comment or be unexported (golint)
    • Line 119: warning: exported method MiniUser.MarshalJSON should have comment or be unexported (golint)
    • Line 146: warning: exported type CreateRoomRequest should have comment or be unexported (golint)
    • Line 151: warning: exported method CreateRoomRequest.Validate should have comment or be unexported (golint)
    • Line 239: warning: exported method CreateRoomRequest.GenerateRoom should have comment or be unexported (golint)
    • Line 239: warning: receiver name crr should be consistent with previous receiver name r for CreateRoomRequest (golint)
    • Line 306: warning: exported method CreateRoomRequest.GenerateRoomUsers should have comment or be unexported (golint)
    • Line 306: warning: receiver name crr should be consistent with previous receiver name r for CreateRoomRequest (golint)
    • Line 326: warning: exported type RetrieveRoomsRequest should have comment or be unexported (golint)
    • Line 330: warning: exported type RoomsResponse should have comment or be unexported (golint)
    • Line 335: warning: exported method RoomsResponse.ConvertToPbRooms should have comment or be unexported (golint)
    • Line 355: warning: exported type RetrieveRoomRequest should have comment or be unexported (golint)
    • Line 359: warning: exported type UpdateRoomRequest should have comment or be unexported (golint)
    • Line 364: warning: exported method UpdateRoomRequest.Validate should have comment or be unexported (golint)
    • Line 399: warning: exported method UpdateRoomRequest.GenerateRoomUsers should have comment or be unexported (golint)
    • Line 419: warning: exported type DeleteRoomRequest should have comment or be unexported (golint)
    • Line 423: warning: exported type RetrieveRoomMessagesRequest should have comment or be unexported (golint)
    • Line 427: warning: exported method RetrieveRoomMessagesRequest.SetDefaultPagingParamsIfParamsNotSet should have comment or be unexported (golint)
    • Line 445: warning: exported type RoomMessagesResponse should have comment or be unexported (golint)
    • Line 450: warning: exported method RoomMessagesResponse.ConvertToPbRoomMessages should have comment or be unexported (golint)
    • chat-api/model/webhook.go
    • Line 9: warning: comment on exported type WebhookProtocol should be of the form "WebhookProtocol ..." (with optional leading article) (golint)
    • Line 13: warning: exported const WebhookProtocolHTTP should have comment (or a comment on this block) or be unexported (golint)
    • Line 21: warning: exported const WebhookEventTypeRoom should have comment (or a comment on this block) or be unexported (golint)
    • Line 25: warning: exported type Webhook should have comment or be unexported (golint)
    • Line 40: warning: exported method Webhook.MarshalJSON should have comment or be unexported (golint)
    • chat-api/datastore/blockUserStore.go
    • Line 9: warning: exported type InsertBlockUsersOption should have comment or be unexported (golint)
    • Line 11: warning: exported function InsertBlockUsersOptionBeforeClean should have comment or be unexported (golint)
    • Line 22: warning: exported type DeleteBlockUsersOption should have comment or be unexported (golint)
    • Line 24: warning: exported function DeleteBlockUsersOptionFilterByUserIDs should have comment or be unexported (golint)
    • Line 30: warning: exported function DeleteBlockUsersOptionFilterByBlockUserIDs should have comment or be unexported (golint)
    • chat-api/datastore/appClientStore.go
    • Line 5: warning: exported type SelectAppClientOption should have comment or be unexported (golint)
    • Line 12: warning: exported function SelectAppClientOptionFilterByName should have comment or be unexported (golint)
    • Line 18: warning: exported function SelectAppClientOptionFilterByClientID should have comment or be unexported (golint)
    • chat-api/datastore/deviceStore.go
    • Line 12: warning: exported type InsertDeviceOption should have comment or be unexported (golint)
    • Line 14: warning: exported function InsertDeviceOptionBeforeClean should have comment or be unexported (golint)
    • Line 27: warning: exported type SelectDevicesOption should have comment or be unexported (golint)
    • Line 29: warning: exported function SelectDevicesOptionFilterByDeleted should have comment or be unexported (golint)
    • Line 35: warning: exported function SelectDevicesOptionFilterByUserID should have comment or be unexported (golint)
    • Line 41: warning: exported function SelectDevicesOptionFilterByPlatform should have comment or be unexported (golint)
    • Line 47: warning: exported function SelectDevicesOptionFilterByToken should have comment or be unexported (golint)
    • Line 59: warning: exported type DeleteDevicesOption should have comment or be unexported (golint)
    • Line 61: warning: exported function DeleteDevicesOptionWithLogicalDeleted should have comment or be unexported (golint)
    • Line 67: warning: exported function DeleteDevicesOptionFilterByUserID should have comment or be unexported (golint)
    • Line 73: warning: exported function DeleteDevicesOptionFilterByPlatform should have comment or be unexported (golint)
    • chat-api/datastore/roomStore.go
    • Line 8: warning: exported type InsertRoomOption should have comment or be unexported (golint)
    • Line 14: warning: exported function InsertRoomOptionWithRoomUser should have comment or be unexported (golint)
    • Line 20: warning: exported type SelectRoomsOption should have comment or be unexported (golint)
    • Line 26: warning: exported function SelectRoomsOptionWithOrders should have comment or be unexported (golint)
    • Line 32: warning: exported type SelectRoomOption should have comment or be unexported (golint)
    • Line 38: warning: exported function SelectRoomOptionWithUsers should have comment or be unexported (golint)
    • Line 44: warning: exported type UpdateRoomOption should have comment or be unexported (golint)
    • Line 50: warning: exported function UpdateRoomOptionWithRoomUser should have comment or be unexported (golint)
    • chat-api/datastore/userRoleStore.go
    • Line 11: warning: exported type InsertUserRolesOption should have comment or be unexported (golint)
    • Line 13: warning: exported function InsertUserRolesOptionBeforeClean should have comment or be unexported (golint)
    • Line 24: warning: exported type DeleteUserRolesOption should have comment or be unexported (golint)
    • Line 26: warning: exported function DeleteUserRolesOptionFilterByUserIDs should have comment or be unexported (golint)
    • Line 32: warning: exported function DeleteUserRolesOptionFilterByRoles should have comment or be unexported (golint)
    • chat-api/datastore/webhookStore.go
    • Line 6: warning: exported const RoomIDAll should have comment (or a comment on this block) or be unexported (golint)
    • Line 15: warning: exported type SelectWebhooksOption should have comment or be unexported (golint)
    • Line 17: warning: exported function SelectWebhooksOptionWithRoomID should have comment or be unexported (golint)
    • Line 23: warning: exported function SelectWebhooksOptionWithTriggerWord should have comment or be unexported (golint)
    • Line 29: warning: exported function SelectWebhooksOptionWithRole should have comment or be unexported (golint)
    • chat-api/grpc/user.go
    • Line 82: warning: receiver name urs should be consistent with previous receiver name us for userServiceServer (golint)
    • chat-api/model/asset.go
    • Line 26: warning: exported var ImageMimes should have comment or be unexported (golint)
    • Line 32: warning: exported type Asset should have comment or be unexported (golint)
    • Line 46: warning: exported method Asset.MarshalJSON should have comment or be unexported (golint)
    • Line 72: warning: exported method Asset.Validate should have comment or be unexported (golint)
    • Line 80: warning: exported method Asset.BeforePost should have comment or be unexported (golint)
    • chat-api/model/device.go
    • Line 9: warning: exported type Device should have comment or be unexported (golint)
    • Line 13: warning: exported method Device.ConvertToPbDevice should have comment or be unexported (golint)
    • Line 22: warning: exported type AddDeviceRequest should have comment or be unexported (golint)
    • Line 26: warning: exported method AddDeviceRequest.Validate should have comment or be unexported (golint)
    • Line 50: warning: exported method AddDeviceRequest.GenerateDevice should have comment or be unexported (golint)
    • Line 58: warning: exported type RetrieveDevicesRequest should have comment or be unexported (golint)
    • Line 62: warning: exported type DevicesResponse should have comment or be unexported (golint)
    • Line 66: warning: exported method DevicesResponse.ConvertToPbDevices should have comment or be unexported (golint)
    • Line 83: warning: exported type DeleteDeviceRequest should have comment or be unexported (golint)
    • chat-api/notification/provider.go
    • Line 13: warning: exported type MessageInfo should have comment or be unexported (golint)
    • Line 18: warning: exported type NotificationResult should have comment or be unexported (golint)
    • Line 23: warning: exported type NotificationChannel should have comment or be unexported (golint)
    • Line 35: warning: exported function Provider should have comment or be unexported (golint)
    • chat-api/model/message.go
    • Line 14: warning: exported const MessageTypeText should have comment (or a comment on this block) or be unexported (golint)
    • Line 24: warning: exported type Message should have comment or be unexported (golint)
    • Line 29: warning: exported method Message.MarshalJSON should have comment or be unexported (golint)
    • Line 54: warning: exported method Message.ConvertToPbMessage should have comment or be unexported (golint)
    • Line 68: warning: exported method Message.ConvertToSendMessageRequest should have comment or be unexported (golint)
    • Line 79: warning: exported type PayloadText should have comment or be unexported (golint)
    • Line 83: warning: exported type PayloadImage should have comment or be unexported (golint)
    • Line 90: warning: exported type PayloadUsers should have comment or be unexported (golint)
    • Line 94: warning: exported type SendMessageRequest should have comment or be unexported (golint)
    • Line 99: warning: exported method SendMessageRequest.Validate should have comment or be unexported (golint)
    • Line 201: warning: exported method SendMessageRequest.GenerateMessage should have comment or be unexported (golint)
    • Line 201: warning: receiver name cmr should be consistent with previous receiver name m for SendMessageRequest (golint)
    • chat-api/model/userRole.go
    • Line 8: warning: exported type UserRole should have comment or be unexported (golint)
    • Line 12: warning: exported type AddUserRolesRequest should have comment or be unexported (golint)
    • Line 16: warning: exported method AddUserRolesRequest.GenerateUserRoles should have comment or be unexported (golint)
    • Line 29: warning: exported type DeleteUserRolesRequest should have comment or be unexported (golint)
    • Line 33: warning: exported method DeleteUserRolesRequest.GenerateRoles should have comment or be unexported (golint)
    • chat-api/datastore/roomUserStore.go
    • Line 12: warning: exported type InsertRoomUsersOption should have comment or be unexported (golint)
    • Line 14: warning: exported function InsertRoomUsersOptionBeforeCleanRoomID should have comment or be unexported (golint)
    • Line 26: warning: exported type SelectRoomUsersOption should have comment or be unexported (golint)
    • Line 28: warning: exported function SelectRoomUsersOptionWithRoomID should have comment or be unexported (golint)
    • Line 34: warning: exported function SelectRoomUsersOptionWithUserIDs should have comment or be unexported (golint)
    • Line 40: warning: exported function SelectRoomUsersOptionWithRoles should have comment or be unexported (golint)
    • Line 52: warning: exported type SelectUserIDsOfRoomUserOption should have comment or be unexported (golint)
    • Line 54: warning: exported function SelectUserIDsOfRoomUserOptionWithRoomID should have comment or be unexported (golint)
    • Line 60: warning: exported function SelectUserIDsOfRoomUserOptionWithUserIDs should have comment or be unexported (golint)
    • Line 66: warning: exported function SelectUserIDsOfRoomUserOptionWithRoles should have comment or be unexported (golint)
    • Line 77: warning: exported type SelectMiniRoomsOption should have comment or be unexported (golint)
    • Line 79: warning: exported function SelectMiniRoomsOptionWithOrders should have comment or be unexported (golint)
    • Line 85: warning: exported function SelectMiniRoomsOptionFilter should have comment or be unexported (golint)
    • Line 96: warning: exported type DeleteRoomUsersOption should have comment or be unexported (golint)
    • Line 98: warning: exported function DeleteRoomUsersOptionFilterByRoomIDs should have comment or be unexported (golint)
    • Line 104: warning: exported function DeleteRoomUsersOptionFilterByUserIDs should have comment or be unexported (golint)

gocyclo88%

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.

    • chat-api/config/config.go
    • Line 292: warning: cyclomatic complexity 127 of function (*config).loadEnv() is high (> 15) (gocyclo)
    • Line 684: warning: cyclomatic complexity 43 of function (*config).parseFlag() is high (> 15) (gocyclo)
    • Line 967: warning: cyclomatic complexity 23 of function (*config).validate() is high (> 15) (gocyclo)
    • chat-api/datastore/rdbRoomUserStore.go
    • Line 80: warning: cyclomatic complexity 19 of function rdbSelectRoomUsers() is high (> 15) (gocyclo)
    • Line 220: warning: cyclomatic complexity 19 of function rdbSelectUserIDsOfRoomUser() is high (> 15) (gocyclo)
    • Line 553: warning: cyclomatic complexity 18 of function rdbDeleteRoomUsers() is high (> 15) (gocyclo)

ineffassign98%

IneffAssign detects ineffectual assignments in Go code.


license100%

Checks whether your project has a LICENSE file.

No problems detected. Good job!


misspell100%

Misspell Finds commonly misspelled English words

No problems detected. Good job!