Preparing report...

Report for github.com/mattermost/mattermost-server

(v4.10.10+incompatible)

A+    Excellent!    Found 103 issues across 681 files

Tweet

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!


gofmt97%

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


ineffassign100%

IneffAssign detects ineffectual assignments in Go code.

No problems detected. Good job!


gocyclo86%

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.

    • model/config.go
    • Line 230: warning: cyclomatic complexity 60 of function (*ServiceSettings).SetDefaults() is high (> 15) (gocyclo)
    • Line 1009: warning: cyclomatic complexity 26 of function (*TeamSettings).SetDefaults() is high (> 15) (gocyclo)
    • Line 1338: warning: cyclomatic complexity 25 of function (*SamlSettings).SetDefaults() is high (> 15) (gocyclo)
    • Line 1164: warning: cyclomatic complexity 25 of function (*LdapSettings).SetDefaults() is high (> 15) (gocyclo)
    • Line 2269: warning: cyclomatic complexity 24 of function (*MessageExportSettings).isValid() is high (> 15) (gocyclo)
    • Line 1860: warning: cyclomatic complexity 22 of function (*Config).IsValid() is high (> 15) (gocyclo)
    • Line 749: warning: cyclomatic complexity 20 of function (*EmailSettings).SetDefaults() is high (> 15) (gocyclo)
    • Line 2153: warning: cyclomatic complexity 18 of function (*ServiceSettings).isValid() is high (> 15) (gocyclo)
    • Line 2082: warning: cyclomatic complexity 16 of function (*SamlSettings).isValid() is high (> 15) (gocyclo)
    • api/file_test.go
    • Line 27: warning: cyclomatic complexity 31 of function TestUploadFile() is high (> 15) (gocyclo)
    • Line 632: warning: cyclomatic complexity 26 of function TestMigrateFilenamesToFileInfos() is high (> 15) (gocyclo)
    • Line 145: warning: cyclomatic complexity 16 of function TestGetFileInfo() is high (> 15) (gocyclo)
    • Line 215: warning: cyclomatic complexity 16 of function TestGetFile() is high (> 15) (gocyclo)
    • api/channel_test.go
    • Line 1413: warning: cyclomatic complexity 26 of function TestUpdateNotifyProps() is high (> 15) (gocyclo)
    • Line 1013: warning: cyclomatic complexity 23 of function TestDeleteChannel() is high (> 15) (gocyclo)
    • Line 16: warning: cyclomatic complexity 22 of function TestCreateChannel() is high (> 15) (gocyclo)
    • Line 396: warning: cyclomatic complexity 20 of function TestUpdateChannelHeader() is high (> 15) (gocyclo)
    • Line 531: warning: cyclomatic complexity 18 of function TestUpdateChannelPurpose() is high (> 15) (gocyclo)
    • Line 231: warning: cyclomatic complexity 17 of function TestUpdateChannel() is high (> 15) (gocyclo)
    • model/user.go
    • Line 119: warning: cyclomatic complexity 21 of function (*User).IsValid() is high (> 15) (gocyclo)
    • model/team.go
    • Line 113: warning: cyclomatic complexity 17 of function (*Team).IsValid() is high (> 15) (gocyclo)
    • api/context.go
    • Line 102: warning: cyclomatic complexity 45 of function (handler).ServeHTTP() is high (> 15) (gocyclo)
    • api/admin_test.go
    • Line 226: warning: cyclomatic complexity 27 of function TestGetTeamAnalyticsStandard() is high (> 15) (gocyclo)
    • Line 373: warning: cyclomatic complexity 25 of function TestGetTeamAnalyticsExtra() is high (> 15) (gocyclo)
    • Line 62: warning: cyclomatic complexity 18 of function TestGetConfig() is high (> 15) (gocyclo)
    • app/webhook.go
    • Line 566: warning: cyclomatic complexity 22 of function (*App).HandleIncomingWebhook() is high (> 15) (gocyclo)
    • Line 229: warning: cyclomatic complexity 17 of function (*App).CreateWebhookPost() is high (> 15) (gocyclo)
    • Line 27: warning: cyclomatic complexity 16 of function (*App).handleWebhookEvents() is high (> 15) (gocyclo)
    • app/plugin.go
    • Line 365: warning: cyclomatic complexity 19 of function (*App).InitPlugins() is high (> 15) (gocyclo)
    • Line 139: warning: cyclomatic complexity 17 of function (*App).installPlugin() is high (> 15) (gocyclo)
    • store/storetest/team_store.go
    • Line 564: warning: cyclomatic complexity 22 of function testTeamMembers() is high (> 15) (gocyclo)
    • Line 225: warning: cyclomatic complexity 18 of function testTeamStoreSearchOpen() is high (> 15) (gocyclo)
    • app/notification_test.go
    • Line 541: warning: cyclomatic complexity 84 of function TestGetMentionKeywords() is high (> 15) (gocyclo)
    • Line 715: warning: cyclomatic complexity 34 of function TestDoesNotifyPropsAllowPushNotification() is high (> 15) (gocyclo)
    • Line 919: warning: cyclomatic complexity 25 of function TestDoesStatusAllowPushNotification() is high (> 15) (gocyclo)
    • api4/context.go
    • Line 91: warning: cyclomatic complexity 25 of function (handler).ServeHTTP() is high (> 15) (gocyclo)
    • model/license.go
    • Line 85: warning: cyclomatic complexity 20 of function (*Features).SetDefaults() is high (> 15) (gocyclo)
    • api4/team_test.go
    • Line 890: warning: cyclomatic complexity 16 of function TestSearchAllTeamsSanitization() is high (> 15) (gocyclo)
    • Line 1012: warning: cyclomatic complexity 16 of function TestGetTeamsForUserSanitization() is high (> 15) (gocyclo)
    • Line 1266: warning: cyclomatic complexity 16 of function TestAddTeamMember() is high (> 15) (gocyclo)
    • api/team_test.go
    • Line 383: warning: cyclomatic complexity 17 of function TestGetAllTeamListingsSanitization() is high (> 15) (gocyclo)
    • Line 269: warning: cyclomatic complexity 17 of function TestGetAllTeamsSanitization() is high (> 15) (gocyclo)
    • store/sqlstore/post_store.go
    • Line 763: warning: cyclomatic complexity 26 of function (*SqlPostStore).Search() is high (> 15) (gocyclo)
    • Line 476: warning: cyclomatic complexity 17 of function (*SqlPostStore).GetPosts() is high (> 15) (gocyclo)
    • app/user_test.go
    • Line 303: warning: cyclomatic complexity 22 of function TestGetUsersByStatus() is high (> 15) (gocyclo)
    • utils/config.go
    • Line 437: warning: cyclomatic complexity 18 of function GenerateClientConfig() is high (> 15) (gocyclo)
    • utils/markdown/inlines.go
    • Line 356: warning: cyclomatic complexity 22 of function CharacterReference() is high (> 15) (gocyclo)
    • Line 278: warning: cyclomatic complexity 17 of function (*inlineParser).lookForLinkOrImage() is high (> 15) (gocyclo)
    • app/web_hub.go
    • Line 374: warning: cyclomatic complexity 18 of function (*Hub).Start() is high (> 15) (gocyclo)
    • api/channel.go
    • Line 146: warning: cyclomatic complexity 17 of function updateChannel() is high (> 15) (gocyclo)
    • app/channel.go
    • Line 35: warning: cyclomatic complexity 17 of function (*App).JoinDefaultChannels() is high (> 15) (gocyclo)
    • model/oauth.go
    • Line 38: warning: cyclomatic complexity 20 of function (*OAuthApp).IsValid() is high (> 15) (gocyclo)
    • jobs/workers.go
    • Line 88: warning: cyclomatic complexity 30 of function (*Workers).handleConfigChange() is high (> 15) (gocyclo)
    • utils/config_test.go
    • Line 65: warning: cyclomatic complexity 26 of function TestConfigFromEnviroVars() is high (> 15) (gocyclo)
    • Line 190: warning: cyclomatic complexity 21 of function TestValidateLocales() is high (> 15) (gocyclo)
    • app/post.go
    • Line 112: warning: cyclomatic complexity 25 of function (*App).CreatePost() is high (> 15) (gocyclo)
    • Line 598: warning: cyclomatic complexity 22 of function (*App).SearchPostsInTeam() is high (> 15) (gocyclo)
    • Line 324: warning: cyclomatic complexity 16 of function (*App).UpdatePost() is high (> 15) (gocyclo)
    • store/storetest/user_store.go
    • Line 1375: warning: cyclomatic complexity 108 of function testUserStoreSearch() is high (> 15) (gocyclo)
    • Line 766: warning: cyclomatic complexity 33 of function testUserStoreGetProfilesByIds() is high (> 15) (gocyclo)
    • Line 2028: warning: cyclomatic complexity 26 of function testUserStoreGetProfilesNotInTeam() is high (> 15) (gocyclo)
    • Line 908: warning: cyclomatic complexity 19 of function testUserStoreGetProfilesByUsernames() is high (> 15) (gocyclo)
    • app/analytics.go
    • Line 19: warning: cyclomatic complexity 37 of function (*App).GetAnalytics() is high (> 15) (gocyclo)
    • app/command.go
    • Line 155: warning: cyclomatic complexity 19 of function (*App).ExecuteCommand() is high (> 15) (gocyclo)
    • model/command.go
    • Line 62: warning: cyclomatic complexity 18 of function (*Command).IsValid() is high (> 15) (gocyclo)
    • cmd/commands/sampledata.go
    • Line 132: warning: cyclomatic complexity 57 of function sampleDataCmdF() is high (> 15) (gocyclo)
    • Line 332: warning: cyclomatic complexity 22 of function createUser() is high (> 15) (gocyclo)
    • api4/params.go
    • Line 56: warning: cyclomatic complexity 36 of function ApiParamsFromRequest() is high (> 15) (gocyclo)
    • api4/user_test.go
    • Line 2736: warning: cyclomatic complexity 24 of function TestGetUsersByStatus() is high (> 15) (gocyclo)
    • Line 987: warning: cyclomatic complexity 16 of function TestPatchUser() is high (> 15) (gocyclo)
    • Line 503: warning: cyclomatic complexity 16 of function TestSearchUsers() is high (> 15) (gocyclo)
    • Line 686: warning: cyclomatic complexity 16 of function TestAutocompleteUsers() is high (> 15) (gocyclo)
    • api4/channel.go
    • Line 839: warning: cyclomatic complexity 21 of function addChannelMember() is high (> 15) (gocyclo)
    • Line 77: warning: cyclomatic complexity 18 of function updateChannel() is high (> 15) (gocyclo)
    • model/post.go
    • Line 154: warning: cyclomatic complexity 21 of function (*Post).IsValid() is high (> 15) (gocyclo)
    • app/notification.go
    • Line 26: warning: cyclomatic complexity 85 of function (*App).SendNotifications() is high (> 15) (gocyclo)
    • Line 867: warning: cyclomatic complexity 31 of function GetExplicitMentions() is high (> 15) (gocyclo)
    • Line 1019: warning: cyclomatic complexity 18 of function DoesNotifyPropsAllowPushNotification() is high (> 15) (gocyclo)
    • Line 356: warning: cyclomatic complexity 17 of function (*App).sendNotificationEmail() is high (> 15) (gocyclo)
    • app/import.go
    • Line 476: warning: cyclomatic complexity 82 of function (*App).ImportUser() is high (> 15) (gocyclo)
    • Line 908: warning: cyclomatic complexity 46 of function validateUserImportData() is high (> 15) (gocyclo)
    • Line 1447: warning: cyclomatic complexity 29 of function (*App).ImportDirectPost() is high (> 15) (gocyclo)
    • Line 1137: warning: cyclomatic complexity 24 of function (*App).ImportPost() is high (> 15) (gocyclo)
    • Line 1574: warning: cyclomatic complexity 19 of function validateDirectPostImportData() is high (> 15) (gocyclo)
    • Line 833: warning: cyclomatic complexity 18 of function (*App).ImportUserChannels() is high (> 15) (gocyclo)
    • Line 1335: warning: cyclomatic complexity 16 of function (*App).ImportDirectChannel() is high (> 15) (gocyclo)
    • app/session.go
    • Line 28: warning: cyclomatic complexity 23 of function (*App).GetSession() is high (> 15) (gocyclo)
    • api/user.go
    • Line 1130: warning: cyclomatic complexity 16 of function completeSaml() is high (> 15) (gocyclo)
    • api/post_test.go
    • Line 24: warning: cyclomatic complexity 24 of function TestCreatePost() is high (> 15) (gocyclo)
    • Line 381: warning: cyclomatic complexity 22 of function TestUpdatePost() is high (> 15) (gocyclo)
    • app/oauth.go
    • Line 156: warning: cyclomatic complexity 18 of function (*App).GetOAuthAccessToken() is high (> 15) (gocyclo)
    • model/search_params_test.go
    • Line 72: warning: cyclomatic complexity 88 of function TestParseSearchFlags() is high (> 15) (gocyclo)
    • Line 171: warning: cyclomatic complexity 63 of function TestParseSearchParams() is high (> 15) (gocyclo)
    • Line 10: warning: cyclomatic complexity 52 of function TestSplitWords() is high (> 15) (gocyclo)
    • api/user_test.go
    • Line 2202: warning: cyclomatic complexity 73 of function TestSearchUsers() is high (> 15) (gocyclo)
    • Line 2532: warning: cyclomatic complexity 33 of function TestAutocompleteUsers() is high (> 15) (gocyclo)
    • Line 384: warning: cyclomatic complexity 32 of function TestGetUser() is high (> 15) (gocyclo)
    • Line 88: warning: cyclomatic complexity 19 of function TestLogin() is high (> 15) (gocyclo)
    • Line 748: warning: cyclomatic complexity 19 of function TestUserUploadProfileImage() is high (> 15) (gocyclo)
    • Line 1961: warning: cyclomatic complexity 17 of function TestUserTyping() is high (> 15) (gocyclo)
    • api4/file_test.go
    • Line 130: warning: cyclomatic complexity 26 of function TestUploadFileAsRequestBody() is high (> 15) (gocyclo)
    • Line 17: warning: cyclomatic complexity 22 of function TestUploadFileAsMultipart() is high (> 15) (gocyclo)
    • store/storetest/channel_store.go
    • Line 1798: warning: cyclomatic complexity 24 of function testChannelStoreSearchInTeam() is high (> 15) (gocyclo)
    • Line 1643: warning: cyclomatic complexity 16 of function testChannelStoreSearchMore() is high (> 15) (gocyclo)
    • api/webhook_test.go
    • Line 122: warning: cyclomatic complexity 21 of function TestUpdateIncomingHook() is high (> 15) (gocyclo)
    • Line 634: warning: cyclomatic complexity 20 of function TestUpdateOutgoingHook() is high (> 15) (gocyclo)
    • Line 459: warning: cyclomatic complexity 17 of function TestCreateOutgoingHook() is high (> 15) (gocyclo)
    • Line 972: warning: cyclomatic complexity 17 of function TestIncomingWebhooks() is high (> 15) (gocyclo)
    • app/import_test.go
    • Line 1410: warning: cyclomatic complexity 106 of function TestImportImportUser() is high (> 15) (gocyclo)
    • Line 2675: warning: cyclomatic complexity 61 of function TestImportImportDirectPost() is high (> 15) (gocyclo)
    • Line 2091: warning: cyclomatic complexity 60 of function TestImportImportPost() is high (> 15) (gocyclo)
    • Line 1250: warning: cyclomatic complexity 36 of function TestImportImportChannel() is high (> 15) (gocyclo)
    • Line 1141: warning: cyclomatic complexity 25 of function TestImportImportTeam() is high (> 15) (gocyclo)
    • Line 2464: warning: cyclomatic complexity 22 of function TestImportImportDirectChannel() is high (> 15) (gocyclo)
    • Line 296: warning: cyclomatic complexity 20 of function TestImportValidateUserImportData() is high (> 15) (gocyclo)
    • Line 81: warning: cyclomatic complexity 16 of function TestImportValidateTeamImportData() is high (> 15) (gocyclo)
    • Line 183: warning: cyclomatic complexity 16 of function TestImportValidateChannelImportData() is high (> 15) (gocyclo)
    • api4/reaction_test.go
    • Line 258: warning: cyclomatic complexity 27 of function TestDeleteReaction() is high (> 15) (gocyclo)
    • Line 15: warning: cyclomatic complexity 17 of function TestSaveReaction() is high (> 15) (gocyclo)
    • api4/post_test.go
    • Line 854: warning: cyclomatic complexity 26 of function TestGetFlaggedPostsForUser() is high (> 15) (gocyclo)
    • Line 1097: warning: cyclomatic complexity 19 of function TestGetPostsAfterAndBefore() is high (> 15) (gocyclo)
    • Line 742: warning: cyclomatic complexity 17 of function TestGetPostsForChannel() is high (> 15) (gocyclo)
    • app/server.go
    • Line 97: warning: cyclomatic complexity 19 of function (*App).StartServer() is high (> 15) (gocyclo)
    • api/oauth_test.go
    • Line 502: warning: cyclomatic complexity 36 of function TestOAuthAccessToken() is high (> 15) (gocyclo)
    • Line 110: warning: cyclomatic complexity 18 of function TestOAuthAllow() is high (> 15) (gocyclo)
    • api4/user.go
    • Line 281: warning: cyclomatic complexity 34 of function getUsers() is high (> 15) (gocyclo)
    • Line 427: warning: cyclomatic complexity 19 of function searchUsers() is high (> 15) (gocyclo)
    • app/web_conn.go
    • Line 152: warning: cyclomatic complexity 21 of function (*WebConn).writePump() is high (> 15) (gocyclo)
    • Line 283: warning: cyclomatic complexity 17 of function (*WebConn).ShouldSendEvent() is high (> 15) (gocyclo)

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!