Preparing report...

Report for github.com/XiaoMi/Gaea

A+    Excellent!    Found 58 issues across 261 files

Tweet

gofmt96%

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!


gocyclo90%

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.

    • Gaea/proxy/server/executor.go
    • Line 452: warning: cyclomatic complexity 23 of function (*SessionExecutor).executeInMultiSlices() is high (> 15) (gocyclo)
    • Line 270: warning: cyclomatic complexity 21 of function (*SessionExecutor).ExecuteCommand() is high (> 15) (gocyclo)
    • Gaea/mysql/result.go
    • Line 100: warning: cyclomatic complexity 33 of function (RowData).ParseBinary() is high (> 15) (gocyclo)
    • Line 613: warning: cyclomatic complexity 17 of function formatValue() is high (> 15) (gocyclo)
    • Gaea/mysql/encoding_test.go
    • Line 209: warning: cyclomatic complexity 31 of function TestEncString() is high (> 15) (gocyclo)
    • Line 177: warning: cyclomatic complexity 16 of function TestEncUint64() is high (> 15) (gocyclo)
    • Gaea/parser/types/field_type.go
    • Line 198: warning: cyclomatic complexity 25 of function (*FieldType).Restore() is high (> 15) (gocyclo)
    • Line 253: warning: cyclomatic complexity 20 of function (*FieldType).FormatAsCastType() is high (> 15) (gocyclo)
    • Gaea/util/resource_pool_test.go
    • Line 56: warning: cyclomatic complexity 36 of function TestOpen() is high (> 15) (gocyclo)
    • Line 390: warning: cyclomatic complexity 26 of function TestIdleTimeout() is high (> 15) (gocyclo)
    • Line 197: warning: cyclomatic complexity 25 of function TestShrinking() is high (> 15) (gocyclo)
    • Gaea/parser/analyzer.go
    • Line 50: warning: cyclomatic complexity 17 of function Preview() is high (> 15) (gocyclo)
    • Line 107: warning: cyclomatic complexity 16 of function StmtType() is high (> 15) (gocyclo)
    • Gaea/parser/lexer.go
    • Line 147: warning: cyclomatic complexity 21 of function (*Scanner).Lex() is high (> 15) (gocyclo)
    • Line 629: warning: cyclomatic complexity 18 of function startWithNumber() is high (> 15) (gocyclo)

golint91%

Golint is a linter for Go source code.

    • Gaea/proxy/sequence/sequence.go
    • Line 25: warning: exported type SequenceManager should have comment or be unexported (golint)
    • Line 29: warning: exported function NewSequenceManager should have comment or be unexported (golint)
    • Line 35: warning: exported method SequenceManager.SetSequence should have comment or be unexported (golint)
    • Line 47: warning: exported method SequenceManager.GetSequence should have comment or be unexported (golint)
    • Gaea/proxy/router/rule.go
    • Line 42: warning: exported const DefaultRuleType should have comment (or a comment on this block) or be unexported (golint)
    • Line 62: warning: exported type Rule should have comment or be unexported (golint)
    • Line 79: warning: exported type MycatRule should have comment or be unexported (golint)
    • Line 85: warning: exported type BaseRule should have comment or be unexported (golint)
    • Line 101: warning: exported type LinkedRule should have comment or be unexported (golint)
    • Line 109: warning: exported function NewDefaultRule should have comment or be unexported (golint)
    • Line 119: warning: exported method BaseRule.GetDB should have comment or be unexported (golint)
    • Line 123: warning: exported method BaseRule.GetTable should have comment or be unexported (golint)
    • Line 127: warning: exported method BaseRule.GetShardingColumn should have comment or be unexported (golint)
    • Line 131: warning: exported method BaseRule.IsLinkedRule should have comment or be unexported (golint)
    • Line 135: warning: exported method BaseRule.GetShard should have comment or be unexported (golint)
    • Line 139: warning: exported method BaseRule.FindTableIndex should have comment or be unexported (golint)
    • Line 143: warning: comment on exported method BaseRule.GetSlice should be of the form "GetSlice ..." (golint)
    • Line 148: warning: exported method BaseRule.GetSliceIndexFromTableIndex should have comment or be unexported (golint)
    • Line 156: warning: comment on exported method BaseRule.GetSlices should be of the form "GetSlices ..." (golint)
    • Line 162: warning: exported method BaseRule.GetSubTableIndexes should have comment or be unexported (golint)
    • Line 166: warning: exported method BaseRule.GetFirstTableIndex should have comment or be unexported (golint)
    • Line 170: warning: exported method BaseRule.GetLastTableIndex should have comment or be unexported (golint)
    • Line 174: warning: exported method BaseRule.GetType should have comment or be unexported (golint)
    • Line 178: warning: exported method BaseRule.GetDatabaseNameByTableIndex should have comment or be unexported (golint)
    • Line 188: warning: exported method BaseRule.GetTableIndexByDatabaseName should have comment or be unexported (golint)
    • Line 193: warning: exported method BaseRule.GetDatabases should have comment or be unexported (golint)
    • Line 197: warning: exported method LinkedRule.GetDB should have comment or be unexported (golint)
    • Line 201: warning: exported method LinkedRule.GetTable should have comment or be unexported (golint)
    • Line 205: warning: exported method LinkedRule.GetParentDB should have comment or be unexported (golint)
    • Line 209: warning: exported method LinkedRule.GetParentTable should have comment or be unexported (golint)
    • Line 213: warning: exported method LinkedRule.GetShardingColumn should have comment or be unexported (golint)
    • Line 217: warning: exported method LinkedRule.IsLinkedRule should have comment or be unexported (golint)
    • Line 221: warning: exported method LinkedRule.GetShard should have comment or be unexported (golint)
    • Line 225: warning: exported method LinkedRule.FindTableIndex should have comment or be unexported (golint)
    • Line 229: warning: exported method LinkedRule.GetFirstTableIndex should have comment or be unexported (golint)
    • Line 233: warning: exported method LinkedRule.GetLastTableIndex should have comment or be unexported (golint)
    • Line 237: warning: exported method LinkedRule.GetSlice should have comment or be unexported (golint)
    • Line 241: warning: exported method LinkedRule.GetSliceIndexFromTableIndex should have comment or be unexported (golint)
    • Line 245: warning: exported method LinkedRule.GetSlices should have comment or be unexported (golint)
    • Line 249: warning: exported method LinkedRule.GetSubTableIndexes should have comment or be unexported (golint)
    • Line 253: warning: exported method LinkedRule.GetType should have comment or be unexported (golint)
    • Line 257: warning: exported method LinkedRule.GetDatabaseNameByTableIndex should have comment or be unexported (golint)
    • Line 261: warning: exported method LinkedRule.GetDatabases should have comment or be unexported (golint)
    • Line 265: warning: exported method LinkedRule.GetTableIndexByDatabaseName should have comment or be unexported (golint)
    • Line 636: warning: exported function IsMycatShardingRule should have comment or be unexported (golint)
    • Gaea/proxy/router/shard.go
    • Line 47: warning: comment on exported type KeyError should be of the form "KeyError ..." (with optional leading article) (golint)
    • Line 50: warning: exported function NewKeyError should have comment or be unexported (golint)
    • Line 54: warning: exported function NewInvalidDateFormatKeyError should have comment or be unexported (golint)
    • Line 77: warning: comment on exported function EncodeValue should be of the form "EncodeValue ..." (golint)
    • Line 94: warning: exported function GetString should have comment or be unexported (golint)
    • Line 113: warning: exported function HashValue should have comment or be unexported (golint)
    • Line 124: warning: if block ends with a return statement, so drop this else and outdent its block (move short variable declaration to its own line if necessary) (golint)
    • Line 133: warning: exported function NumValue should have comment or be unexported (golint)
    • Line 157: warning: exported type Shard should have comment or be unexported (golint)
    • Line 161: warning: comment on exported type RangeShard should be of the form "RangeShard ..." (with optional leading article) (golint)
    • Line 167: warning: exported type HashShard should have comment or be unexported (golint)
    • Line 171: warning: exported method HashShard.FindForKey should have comment or be unexported (golint)
    • Line 177: warning: exported type ModShard should have comment or be unexported (golint)
    • Line 181: warning: exported method ModShard.FindForKey should have comment or be unexported (golint)
    • Line 186: warning: exported type NumRangeShard should have comment or be unexported (golint)
    • Line 190: warning: exported method NumRangeShard.FindForKey should have comment or be unexported (golint)
    • Line 200: warning: exported method NumRangeShard.EqualStart should have comment or be unexported (golint)
    • Line 205: warning: exported type DateYearShard should have comment or be unexported (golint)
    • Line 222: warning: if block ends with a return statement, so drop this else and outdent its block (move short variable declaration to its own line if necessary) (golint)
    • Line 229: warning: comment on exported method DateYearShard.FindForKey should be of the form "FindForKey ..." (golint)
    • Line 234: warning: exported method DateYearShard.EqualStart should have comment or be unexported (golint)
    • Line 243: warning: exported type DateMonthShard should have comment or be unexported (golint)
    • Line 283: warning: if block ends with a return statement, so drop this else and outdent its block (move short variable declaration to its own line if necessary) (golint)
    • Line 290: warning: comment on exported method DateMonthShard.FindForKey should be of the form "FindForKey ..." (golint)
    • Line 295: warning: exported method DateMonthShard.EqualStart should have comment or be unexported (golint)
    • Line 304: warning: exported type DateDayShard should have comment or be unexported (golint)
    • Line 344: warning: if block ends with a return statement, so drop this else and outdent its block (move short variable declaration to its own line if necessary) (golint)
    • Line 351: warning: comment on exported method DateDayShard.FindForKey should be of the form "FindForKey ..." (golint)
    • Line 356: warning: exported method DateDayShard.EqualStart should have comment or be unexported (golint)
    • Line 365: warning: exported type DefaultShard should have comment or be unexported (golint)
    • Line 368: warning: exported method DefaultShard.FindForKey should have comment or be unexported (golint)
    • Line 372: warning: exported type GlobalTableShard should have comment or be unexported (golint)
    • Line 375: warning: exported method GlobalTableShard.FindForKey should have comment or be unexported (golint)
    • Line 379: warning: exported function NewGlobalTableShard should have comment or be unexported (golint)
    • Gaea/models/namespace.go
    • Line 303: warning: if block ends with a return statement, so drop this else and outdent its block (move short variable declaration to its own line if necessary) (golint)
    • Gaea/models/namespace_test.go
    • Line 508: warning: don't use underscores in Go names; func testVerifyShardRules_Error_ShardMycatMod should be testVerifyShardRulesErrorShardMycatMod (golint)
    • Line 539: warning: don't use underscores in Go names; func testVerifyShardRules_Error_ShardMycatLong should be testVerifyShardRulesErrorShardMycatLong (golint)
    • Gaea/cc/server.go
    • Line 265: warning: exported method Server.Run should have comment or be unexported (golint)
    • Line 288: warning: exported method Server.Close should have comment or be unexported (golint)
    • Gaea/backend/interface.go
    • Line 10: warning: exported type PooledConnect should have comment or be unexported (golint)
    • Line 29: warning: exported type ConnectionPool should have comment or be unexported (golint)
    • Gaea/proxy/router/router.go
    • Line 1: warning: package comment should be of the form "Package router ..." (golint)
    • Line 23: warning: exported type Router should have comment or be unexported (golint)
    • Line 81: warning: if block ends with a return statement, so drop this else and outdent its block (move short variable declaration to its own line if necessary) (golint)
    • Line 103: warning: exported method Router.GetShardRule should have comment or be unexported (golint)
    • Line 113: warning: exported method Router.GetRule should have comment or be unexported (golint)
    • Line 124: warning: if block ends with a return statement, so drop this else and outdent its block (golint)
    • Gaea/proxy/server/namespace.go
    • Line 208: warning: exported method Namespace.GetSequences should have comment or be unexported (golint)
    • Line 249: warning: exported method Namespace.GetMaxExecuteTime should have comment or be unexported (golint)
    • Line 253: warning: exported method Namespace.GetMaxResultSize should have comment or be unexported (golint)
    • Line 300: warning: exported method Namespace.GetPhysicalDBs should have comment or be unexported (golint)

license100%

Checks whether your project has a LICENSE file.

No problems detected. Good job!


ineffassign93%

IneffAssign detects ineffectual assignments in Go code.

    • Gaea/mysql/conn.go
    • Line 560: warning: ineffectual assignment to pos (ineffassign)
    • Line 582: warning: ineffectual assignment to pos (ineffassign)
    • Line 605: warning: ineffectual assignment to pos (ineffassign)
    • Line 628: warning: ineffectual assignment to pos (ineffassign)
    • Line 664: warning: ineffectual assignment to ok (ineffassign)
    • Line 697: warning: ineffectual assignment to pos (ineffassign)
    • Gaea/mysql/encoding_test.go
    • Line 79: warning: ineffectual assignment to got (ineffassign)
    • Line 79: warning: ineffectual assignment to pos (ineffassign)
    • Line 104: warning: ineffectual assignment to got16 (ineffassign)
    • Line 104: warning: ineffectual assignment to pos (ineffassign)
    • Line 129: warning: ineffectual assignment to got (ineffassign)
    • Line 129: warning: ineffectual assignment to pos (ineffassign)
    • Line 140: warning: ineffectual assignment to b (ineffassign)
    • Line 140: warning: ineffectual assignment to pos (ineffassign)
    • Line 164: warning: ineffectual assignment to got32 (ineffassign)
    • Line 164: warning: ineffectual assignment to pos (ineffassign)
    • Line 196: warning: ineffectual assignment to got64 (ineffassign)
    • Line 196: warning: ineffectual assignment to pos (ineffassign)
    • Line 271: warning: ineffectual assignment to got (ineffassign)
    • Line 271: warning: ineffectual assignment to pos (ineffassign)
    • Line 277: warning: ineffectual assignment to got (ineffassign)
    • Line 277: warning: ineffectual assignment to pos (ineffassign)
    • Line 289: warning: ineffectual assignment to pos (ineffassign)
    • Line 295: warning: ineffectual assignment to pos (ineffassign)
    • Line 307: warning: ineffectual assignment to gotb (ineffassign)
    • Line 307: warning: ineffectual assignment to pos (ineffassign)
    • Line 313: warning: ineffectual assignment to gotb (ineffassign)
    • Line 313: warning: ineffectual assignment to pos (ineffassign)
    • Line 337: warning: ineffectual assignment to got (ineffassign)
    • Line 337: warning: ineffectual assignment to pos (ineffassign)

misspell97%

Misspell Finds commonly misspelled English words

    • Gaea/mysql/encoding_test.go
    • Line 72: warning: "succesful" is a misspelling of "successful" (misspell)
    • Line 264: warning: "succesful" is a misspelling of "successful" (misspell)
    • Line 282: warning: "succesful" is a misspelling of "successful" (misspell)
    • Line 300: warning: "succesful" is a misspelling of "successful" (misspell)
    • Line 330: warning: "succesful" is a misspelling of "successful" (misspell)