Preparing report...

Report for github.com/lodastack/registry

A+    Excellent!    Found 43 issues across 64 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!


gocyclo73%

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.

    • registry/authorize/perm_test.go
    • Line 170: warning: cyclomatic complexity 39 of function TestRemoveGroup() is high (> 15) (gocyclo)
    • Line 15: warning: cyclomatic complexity 35 of function TestUpdateGroupMember() is high (> 15) (gocyclo)
    • Line 97: warning: cyclomatic complexity 29 of function TestRemoveUser() is high (> 15) (gocyclo)
    • registry/tree/resource_test.go
    • Line 271: warning: cyclomatic complexity 29 of function TestMoveResource() is high (> 15) (gocyclo)
    • Line 106: warning: cyclomatic complexity 28 of function TestSearchResource() is high (> 15) (gocyclo)
    • Line 376: warning: cyclomatic complexity 27 of function TestCopyResource() is high (> 15) (gocyclo)
    • Line 209: warning: cyclomatic complexity 20 of function TestGetResAfterSetOtherNs() is high (> 15) (gocyclo)
    • registry/tree/tree_test.go
    • Line 79: warning: cyclomatic complexity 20 of function TestCopyTemplateDuringCreateNode() is high (> 15) (gocyclo)
    • Line 17: warning: cyclomatic complexity 16 of function TestCreateNodeAndLeafCache() is high (> 15) (gocyclo)
    • registry/httpd/api.go
    • Line 684: warning: cyclomatic complexity 29 of function (*Service).handlerResourceAdd() is high (> 15) (gocyclo)
    • Line 892: warning: cyclomatic complexity 24 of function (*Service).handlerNsGet() is high (> 15) (gocyclo)
    • Line 1004: warning: cyclomatic complexity 18 of function (*Service).handlerNsNew() is high (> 15) (gocyclo)
    • Line 633: warning: cyclomatic complexity 17 of function (*Service).handleResourcePut() is high (> 15) (gocyclo)
    • registry/tree/machine_test.go
    • Line 228: warning: cyclomatic complexity 36 of function TestRegisterMachine() is high (> 15) (gocyclo)
    • Line 148: warning: cyclomatic complexity 20 of function TestUpdateStatusByHostname() is high (> 15) (gocyclo)
    • Line 31: warning: cyclomatic complexity 17 of function TestMatchNs() is high (> 15) (gocyclo)
    • registry/model/resource_test.go
    • Line 82: warning: cyclomatic complexity 21 of function TestAppendResource() is high (> 15) (gocyclo)
    • Line 47: warning: cyclomatic complexity 17 of function TestRsUnmarshal() is high (> 15) (gocyclo)

golint57%

Golint is a linter for Go source code.

    • registry/tree/tree_ffjson.go
    • Line 16: warning: exported method Tree.MarshalJSON should have comment or be unexported (golint)
    • Line 28: warning: exported method Tree.MarshalJSONBuf should have comment or be unexported (golint)
    • Line 62: warning: don't use underscores in Go names; const ffj_t_Treebase should be ffjTTreebase (golint)
    • Line 63: warning: don't use underscores in Go names; const ffj_t_Treeno_such_key should be ffjTTreenoSuchKey (golint)
    • Line 65: warning: don't use underscores in Go names; const ffj_t_Tree_Nodes should be ffjTTreeNodes (golint)
    • Line 67: warning: don't use underscores in Go names; const ffj_t_Tree_Mu should be ffjTTreeMu (golint)
    • Line 70: warning: don't use underscores in Go names; var ffj_key_Tree_Nodes should be ffjKeyTreeNodes (golint)
    • Line 72: warning: don't use underscores in Go names; var ffj_key_Tree_Mu should be ffjKeyTreeMu (golint)
    • Line 74: warning: exported method Tree.UnmarshalJSON should have comment or be unexported (golint)
    • Line 74: warning: receiver name uj should be consistent with previous receiver name mj for Tree (golint)
    • Line 79: warning: exported method Tree.UnmarshalJSONFFLexer should have comment or be unexported (golint)
    • Line 79: warning: receiver name uj should be consistent with previous receiver name mj for Tree (golint)
    • registry/model/dashboard.go
    • Line 3: warning: exported type Target should have comment or be unexported (golint)
    • Line 11: warning: exported type Panel should have comment or be unexported (golint)
    • Line 20: warning: exported type Dashboard should have comment or be unexported (golint)
    • Line 25: warning: exported type DashboardData should have comment or be unexported (golint)
    • registry/model/search.go
    • Line 12: warning: exported type HandleFunc should have comment or be unexported (golint)
    • Line 14: warning: exported type ResourceSearch should have comment or be unexported (golint)
    • Line 23: warning: exported function NewSearch should have comment or be unexported (golint)
    • Line 44: warning: exported method ResourceSearch.Init should have comment or be unexported (golint)
    • Line 58: warning: exported method ResourceSearch.IdSearch should have comment or be unexported (golint)
    • Line 109: warning: exported method ResourceSearch.ValueSearch should have comment or be unexported (golint)
    • registry/model/template.go
    • Line 4: warning: exported var Machine should have comment or be unexported (golint)
    • Line 525: warning: exported var RootTemplate should have comment or be unexported (golint)
    • registry/limit/limit.go
    • Line 9: warning: exported type Limit should have comment or be unexported (golint)
    • Line 15: warning: exported function NewLimit should have comment or be unexported (golint)
    • Line 19: warning: exported method Limit.Take should have comment or be unexported (golint)
    • Line 24: warning: exported method Limit.Release should have comment or be unexported (golint)
    • Line 33: warning: exported method Limit.Close should have comment or be unexported (golint)
    • registry/common/uuid.go
    • Line 9: warning: exported function GenUUID should have comment or be unexported (golint)
    • Line 13: warning: exported function IsDocker should have comment or be unexported (golint)
    • registry/tree/test_sample/test_sample.go
    • Line 1: warning: don't use an underscore in package name (golint)
    • Line 9: warning: exported function LoadFromFile should have comment or be unexported (golint)
    • Line 18: warning: exported function LoadJsonFromFile should have comment or be unexported (golint)
    • registry/model/alarm.go
    • Line 14: warning: exported type AlarmResource should have comment or be unexported (golint)
    • Line 20: warning: exported function NewAlarm should have comment or be unexported (golint)
    • Line 28: warning: exported method AlarmResource.SetID should have comment or be unexported (golint)
    • Line 32: warning: exported method AlarmResource.SetQuery should have comment or be unexported (golint)
    • Line 50: warning: exported method AlarmResource.SetBlock should have comment or be unexported (golint)
    • Line 64: warning: exported method AlarmResource.SetAlert should have comment or be unexported (golint)
    • Line 72: warning: exported method AlarmResource.EnableSelf should have comment or be unexported (golint)
    • Line 76: warning: exported method AlarmResource.DisableSelf should have comment or be unexported (golint)
    • Line 80: warning: exported method AlarmResource.SetMD5AndVersion should have comment or be unexported (golint)
    • Line 111: warning: exported function NewAlarmByRes should have comment or be unexported (golint)
    • Line 172: warning: exported function TransAlarmToResource should have comment or be unexported (golint)
    • Line 185: warning: exported function NewAlarmResourceByMap should have comment or be unexported (golint)
    • registry/config/config.go
    • Line 10: warning: comment on exported const AppName should be of the form "AppName ..." (golint)
    • Line 12: warning: comment on exported const Usage should be of the form "Usage ..." (golint)
    • Line 14: warning: comment on exported const Version should be of the form "Version ..." (golint)
    • Line 25: warning: comment on exported var C should be of the form "C ..." (golint)
    • Line 29: warning: exported type Config should have comment or be unexported (golint)
    • Line 41: warning: exported type PluginConfig should have comment or be unexported (golint)
    • Line 49: warning: exported type EventConfig should have comment or be unexported (golint)
    • Line 53: warning: exported type CommonConfig should have comment or be unexported (golint)
    • Line 61: warning: exported type HTTPConfig should have comment or be unexported (golint)
    • Line 68: warning: exported type DataConfig should have comment or be unexported (golint)
    • Line 92: warning: comment on exported type DNSConfig should be of the form "DNSConfig ..." (with optional leading article) (golint)
    • Line 107: warning: exported function ParseConfig should have comment or be unexported (golint)
    • Line 117: warning: exported function GetConfig should have comment or be unexported (golint)
    • registry/model/gitlab/projects.go
    • Line 14: warning: error var InvalidProject should have name of the form ErrFoo (golint)
    • Line 14: warning: exported var InvalidProject should have comment or be unexported (golint)
    • Line 17: warning: exported type ProjectInfo should have comment or be unexported (golint)
    • registry/tree/node/node.go
    • Line 24: warning: comment on exported const NsFormat should be of the form "NsFormat ..." (golint)
    • Line 26: warning: comment on exported const IDFormat should be of the form "IDFormat ..." (golint)
    • registry/utils/http.go
    • Line 13: warning: exported var Form should have comment or be unexported (golint)
    • Line 17: warning: exported type HttpQuery should have comment or be unexported (golint)
    • Line 26: warning: exported type HttpResult should have comment or be unexported (golint)
    • Line 31: warning: exported method HttpQuery.DoQuery should have comment or be unexported (golint)
    • registry/model/collect.go
    • Line 15: warning: exported var ProcCollect should have comment or be unexported (golint)
    • Line 24: warning: comment on exported function GetResNameFromMeasurements should be of the form "GetResNameFromMeasurements ..." (golint)
    • Line 62: warning: exported function GenCollectName should have comment or be unexported (golint)
    • Line 85: warning: exported function UpdateCollectName should have comment or be unexported (golint)
    • Line 171: warning: exported function GetAlarmFromCollect should have comment or be unexported (golint)
    • registry/httpd/user.go
    • Line 51: warning: comment on exported method Service.HandlerSignin should be of the form "HandlerSignin ..." (golint)
    • Line 86: warning: exported const WCtokenAPI should have comment or be unexported (golint)
    • Line 88: warning: exported var WCTOKEN should have comment or be unexported (golint)
    • Line 89: warning: exported var WCTOKEN_CREATETIME should have comment or be unexported (golint)
    • Line 129: warning: if block ends with a return statement, so drop this else and outdent its block (golint)
    • Line 189: warning: comment on exported method Service.HandlerSignout should be of the form "HandlerSignout ..." (golint)
    • Line 233: warning: exported method Service.HandlerGroupCreate should have comment or be unexported (golint)
    • Line 270: warning: comment on exported method Service.HandlerUpdateGroupItem should be of the form "HandlerUpdateGroupItem ..." (golint)
    • Line 288: warning: exported method Service.HandlerUpdateGroupMember should have comment or be unexported (golint)
    • Line 341: warning: comment on exported method Service.HandlerUserGet should be of the form "HandlerUserGet ..." (golint)
    • Line 388: warning: exported method Service.HandlerRemoveUser should have comment or be unexported (golint)
    • registry/model/gitlab/file.go
    • Line 14: warning: error var InvalidFile should have name of the form ErrFoo (golint)
    • Line 14: warning: exported var InvalidFile should have comment or be unexported (golint)
    • Line 17: warning: exported type FileDetail should have comment or be unexported (golint)
    • Line 43: warning: exported function GetFileContent should have comment or be unexported (golint)
    • registry/model/machine.go
    • Line 7: warning: exported type Report should have comment or be unexported (golint)
    • Line 10: warning: exported var HostnameProp should have comment or be unexported (golint)
    • registry/model/row.go
    • Line 7: warning: comment on exported var LogBackend should be of the form "LogBackend ..." (golint)
    • Line 10: warning: exported type Row should have comment or be unexported (golint)
    • registry/common/slice.go
    • Line 3: warning: exported function ContainString should have comment or be unexported (golint)
    • Line 12: warning: exported function AddIfNotContain should have comment or be unexported (golint)
    • Line 34: warning: exported function Reverse should have comment or be unexported (golint)
    • Line 45: warning: exported function CheckStringInList should have comment or be unexported (golint)
    • registry/model/resource.go
    • Line 13: warning: exported const IdKey should have comment (or a comment on this block) or be unexported (golint)
    • Line 30: warning: exported var ErrResMarshal should have comment or be unexported (golint)
    • Line 48: warning: exported type ResourceList should have comment or be unexported (golint)
    • Line 50: warning: exported type Resource should have comment or be unexported (golint)
    • Line 52: warning: exported function NewResourceList should have comment or be unexported (golint)
    • Line 61: warning: exported function NewResource should have comment or be unexported (golint)
    • Line 73: warning: comment on exported method ResourceList.WalkRsByte should be of the form "WalkRsByte ..." (golint)
    • Line 128: warning: comment on exported function UpdateResByID should be of the form "UpdateResByID ..." (golint)
    • Line 174: warning: comment on exported function DeleteResource should be of the form "DeleteResource ..." (golint)
    • Line 264: warning: exported method ResourceList.AppendResourceByte should have comment or be unexported (golint)
    • Line 273: warning: exported method ResourceList.AppendResource should have comment or be unexported (golint)
    • Line 277: warning: exported method ResourceList.AppendResources should have comment or be unexported (golint)
    • Line 281: warning: exported method Resource.Unmarshal should have comment or be unexported (golint)
    • Line 412: warning: exported method Resource.NewID should have comment or be unexported (golint)
    • Line 418: warning: exported method Resource.ID should have comment or be unexported (golint)
    • Line 422: warning: comment on exported function AppendResources should be of the form "AppendResources ..." (golint)
    • registry/httpd/response.go
    • Line 13: warning: exported type Response should have comment or be unexported (golint)
    • Line 28: warning: comment on exported function ReturnOK should be of the form "ReturnOK ..." (golint)
    • Line 33: warning: comment on exported function ReturnBadRequest should be of the form "ReturnBadRequest ..." (golint)
    • Line 38: warning: comment on exported function ReturnUnauthorized should be of the form "ReturnUnauthorized ..." (golint)
    • Line 43: warning: comment on exported function ReturnForbidden should be of the form "ReturnForbidden ..." (golint)
    • Line 48: warning: comment on exported function ReturnNotFound should be of the form "ReturnNotFound ..." (golint)
    • Line 53: warning: comment on exported function ReturnServerError should be of the form "ReturnServerError ..." (golint)
    • Line 58: warning: exported function ReturnJson should have comment or be unexported (golint)
    • Line 65: warning: comment on exported function ReturnByte should be of the form "ReturnByte ..." (golint)
    • registry/tree/node/interface.go
    • Line 34: warning: comment on exported function NewNode should be of the form "NewNode ..." (golint)
    • Line 44: warning: receiver name m should be consistent with previous receiver name n for node (golint)
    • Line 49: warning: receiver name m should be consistent with previous receiver name n for node (golint)
    • Line 54: warning: receiver name m should be consistent with previous receiver name n for node (golint)
    • Line 68: warning: receiver name m should be consistent with previous receiver name n for node (golint)
    • Line 80: warning: receiver name m should be consistent with previous receiver name n for node (golint)
    • Line 89: warning: receiver name m should be consistent with previous receiver name n for node (golint)
    • Line 102: warning: receiver name m should be consistent with previous receiver name n for node (golint)
    • registry/tree/test_sample/mock_store.go
    • Line 1: warning: don't use an underscore in package name (golint)
    • Line 13: warning: exported function MustNewStore should have comment or be unexported (golint)
    • Line 23: warning: exported function MustNewStoreB should have comment or be unexported (golint)
    • Line 42: warning: exported type MockTransport should have comment or be unexported (golint)
    • Line 54: warning: exported method MockTransport.Dial should have comment or be unexported (golint)
    • Line 58: warning: exported method MockTransport.Accept should have comment or be unexported (golint)
    • Line 60: warning: exported method MockTransport.Close should have comment or be unexported (golint)
    • Line 62: warning: exported method MockTransport.Addr should have comment or be unexported (golint)

license100%

Checks whether your project has a LICENSE file.

No problems detected. Good job!


ineffassign95%

IneffAssign detects ineffectual assignments in Go code.


misspell82%

Misspell Finds commonly misspelled English words

    • registry/httpd/api.go
    • Line 111: warning: "infomation" is a misspelling of "information" (misspell)
    • Line 387: warning: "desinged" is a misspelling of "designed" (misspell)
    • Line 1040: warning: "creater" is a misspelling of "creature" (misspell)
    • Line 1045: warning: "creater" is a misspelling of "creature" (misspell)