Report for github.com/pingcap/tidb

(v1.0.9)

A+    Excellent!    Found 211 issues across 1151 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!


gofmt96%

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!


gocyclo83%

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.

    • kv/union_iter.go
    • Line 63: warning: cyclomatic complexity 19 of function (*UnionIter).updateCur() is high (> 15) (gocyclo)
    • plan/physical_plan_builder.go
    • Line 946: warning: cyclomatic complexity 34 of function (*LogicalJoin).convert2PhysicalPlan() is high (> 15) (gocyclo)
    • Line 219: warning: cyclomatic complexity 16 of function (*DataSource).convert2PhysicalPlan() is high (> 15) (gocyclo)
    • plan/resolver.go
    • Line 257: warning: cyclomatic complexity 43 of function (*nameResolver).Leave() is high (> 15) (gocyclo)
    • Line 159: warning: cyclomatic complexity 40 of function (*nameResolver).Enter() is high (> 15) (gocyclo)
    • Line 903: warning: cyclomatic complexity 34 of function (*nameResolver).fillShowFields() is high (> 15) (gocyclo)
    • Line 536: warning: cyclomatic complexity 24 of function (*nameResolver).resolveColumnNameInContext() is high (> 15) (gocyclo)
    • Line 640: warning: cyclomatic complexity 20 of function (*nameResolver).resolveColumnInTableSources() is high (> 15) (gocyclo)
    • Line 695: warning: cyclomatic complexity 17 of function (*nameResolver).resolveColumnInResultFields() is high (> 15) (gocyclo)
    • ddl/ddl_api.go
    • Line 837: warning: cyclomatic complexity 26 of function (*ddl).AlterTable() is high (> 15) (gocyclo)
    • Line 580: warning: cyclomatic complexity 25 of function (*ddl).buildTableInfo() is high (> 15) (gocyclo)
    • Line 346: warning: cyclomatic complexity 22 of function getDefaultValue() is high (> 15) (gocyclo)
    • Line 247: warning: cyclomatic complexity 21 of function columnDefToCol() is high (> 15) (gocyclo)
    • Line 985: warning: cyclomatic complexity 17 of function (*ddl).AddColumn() is high (> 15) (gocyclo)
    • Line 1174: warning: cyclomatic complexity 17 of function setDefaultAndComment() is high (> 15) (gocyclo)
    • executor/set.go
    • Line 57: warning: cyclomatic complexity 27 of function (*SetExecutor).executeSet() is high (> 15) (gocyclo)
    • parser/lexer.go
    • Line 131: warning: cyclomatic complexity 17 of function (*Scanner).Lex() is high (> 15) (gocyclo)
    • session.go
    • Line 820: warning: cyclomatic complexity 21 of function checkArgs() is high (> 15) (gocyclo)
    • ast/dml.go
    • Line 490: warning: cyclomatic complexity 20 of function (*SelectStmt).Accept() is high (> 15) (gocyclo)
    • table/tables/tables.go
    • Line 333: warning: cyclomatic complexity 17 of function (*Table).AddRecord() is high (> 15) (gocyclo)
    • Line 227: warning: cyclomatic complexity 16 of function (*Table).UpdateRecord() is high (> 15) (gocyclo)
    • Line 653: warning: cyclomatic complexity 16 of function (*Table).IterRecords() is high (> 15) (gocyclo)
    • executor/write.go
    • Line 47: warning: cyclomatic complexity 27 of function updateRecord() is high (> 15) (gocyclo)
    • Line 729: warning: cyclomatic complexity 20 of function (*InsertExec).Next() is high (> 15) (gocyclo)
    • Line 486: warning: cyclomatic complexity 16 of function (*LoadDataInfo).InsertData() is high (> 15) (gocyclo)
    • ast/flag.go
    • Line 34: warning: cyclomatic complexity 26 of function (*flagSetter).Leave() is high (> 15) (gocyclo)
    • util/types/datum.go
    • Line 389: warning: cyclomatic complexity 22 of function (*Datum).CompareDatum() is high (> 15) (gocyclo)
    • Line 1556: warning: cyclomatic complexity 20 of function CoerceDatum() is high (> 15) (gocyclo)
    • Line 340: warning: cyclomatic complexity 20 of function (*Datum).SetValue() is high (> 15) (gocyclo)
    • Line 1340: warning: cyclomatic complexity 20 of function (*Datum).toSignedInteger() is high (> 15) (gocyclo)
    • Line 819: warning: cyclomatic complexity 19 of function (*Datum).convertToUint() is high (> 15) (gocyclo)
    • Line 678: warning: cyclomatic complexity 16 of function (*Datum).convertToFloat() is high (> 15) (gocyclo)
    • Line 637: warning: cyclomatic complexity 16 of function (*Datum).ConvertTo() is high (> 15) (gocyclo)
    • _vendor/src/google.golang.org/grpc/server.go
    • Line 660: warning: cyclomatic complexity 41 of function (*Server).processUnaryRPC() is high (> 15) (gocyclo)
    • Line 918: warning: cyclomatic complexity 21 of function (*Server).handleStream() is high (> 15) (gocyclo)
    • Line 826: warning: cyclomatic complexity 16 of function (*Server).processStreamingRPC() is high (> 15) (gocyclo)
    • plan/planbuilder.go
    • Line 692: warning: cyclomatic complexity 37 of function (*planBuilder).buildInsert() is high (> 15) (gocyclo)
    • Line 1105: warning: cyclomatic complexity 23 of function buildShowSchema() is high (> 15) (gocyclo)
    • Line 136: warning: cyclomatic complexity 18 of function (*planBuilder).build() is high (> 15) (gocyclo)
    • util/types/field_type.go
    • Line 246: warning: cyclomatic complexity 22 of function DefaultTypeForValue() is high (> 15) (gocyclo)
    • Line 156: warning: cyclomatic complexity 20 of function (*FieldType).CompactStr() is high (> 15) (gocyclo)
    • expression/builtin_compare.go
    • Line 1010: warning: cyclomatic complexity 57 of function (*compareFunctionClass).generateCmpSigs() is high (> 15) (gocyclo)
    • Line 859: warning: cyclomatic complexity 27 of function GetAccurateCmpType() is high (> 15) (gocyclo)
    • Line 108: warning: cyclomatic complexity 22 of function (*coalesceFunctionClass).getFunction() is high (> 15) (gocyclo)
    • Line 1526: warning: cyclomatic complexity 22 of function (*builtinNullEQIntSig).evalInt() is high (> 15) (gocyclo)
    • Line 1799: warning: cyclomatic complexity 17 of function compareInt() is high (> 15) (gocyclo)
    • expression/builtin_control.go
    • Line 61: warning: cyclomatic complexity 26 of function inferType4ControlFuncs() is high (> 15) (gocyclo)
    • Line 135: warning: cyclomatic complexity 18 of function (*caseWhenFunctionClass).getFunction() is high (> 15) (gocyclo)
    • executor/show.go
    • Line 433: warning: cyclomatic complexity 45 of function (*ShowExec).fetchShowCreateTable() is high (> 15) (gocyclo)
    • Line 90: warning: cyclomatic complexity 23 of function (*ShowExec).fetchAll() is high (> 15) (gocyclo)
    • util/types/mytime.go
    • Line 371: warning: cyclomatic complexity 26 of function timestampDiff() is high (> 15) (gocyclo)
    • Line 242: warning: cyclomatic complexity 18 of function calcWeek() is high (> 15) (gocyclo)
    • model/ddl.go
    • Line 49: warning: cyclomatic complexity 17 of function (ActionType).String() is high (> 15) (gocyclo)
    • _vendor/src/google.golang.org/grpc/clientconn.go
    • Line 318: warning: cyclomatic complexity 29 of function DialContext() is high (> 15) (gocyclo)
    • Line 557: warning: cyclomatic complexity 17 of function (*ClientConn).resetAddrConn() is high (> 15) (gocyclo)
    • Line 815: warning: cyclomatic complexity 17 of function (*addrConn).resetTransport() is high (> 15) (gocyclo)
    • expression/builtin_arithmetic.go
    • Line 171: warning: cyclomatic complexity 26 of function (*builtinArithmeticPlusIntSig).evalInt() is high (> 15) (gocyclo)
    • Line 337: warning: cyclomatic complexity 23 of function (*builtinArithmeticMinusIntSig).evalInt() is high (> 15) (gocyclo)
    • Line 763: warning: cyclomatic complexity 16 of function (*builtinArithmeticModIntSig).evalInt() is high (> 15) (gocyclo)
    • store/localstore/local_region.go
    • Line 193: warning: cyclomatic complexity 25 of function (*localRegion).Handle() is high (> 15) (gocyclo)
    • Line 442: warning: cyclomatic complexity 20 of function (*localRegion).getRowsFromRange() is high (> 15) (gocyclo)
    • Line 737: warning: cyclomatic complexity 18 of function (*localRegion).getIndexRowFromRange() is high (> 15) (gocyclo)
    • plan/validator.go
    • Line 390: warning: cyclomatic complexity 20 of function checkColumn() is high (> 15) (gocyclo)
    • Line 83: warning: cyclomatic complexity 16 of function (*validator).Leave() is high (> 15) (gocyclo)
    • Line 176: warning: cyclomatic complexity 16 of function (*validator).checkAutoIncrement() is high (> 15) (gocyclo)
    • plan/join_reorder.go
    • Line 98: warning: cyclomatic complexity 18 of function (*joinReOrderSolver).reorderJoin() is high (> 15) (gocyclo)
    • util/types/mydecimal.go
    • Line 701: warning: cyclomatic complexity 44 of function (*MyDecimal).Round() is high (> 15) (gocyclo)
    • Line 1872: warning: cyclomatic complexity 43 of function doDivMod() is high (> 15) (gocyclo)
    • Line 1391: warning: cyclomatic complexity 40 of function doSub() is high (> 15) (gocyclo)
    • Line 301: warning: cyclomatic complexity 32 of function (*MyDecimal).FromString() is high (> 15) (gocyclo)
    • Line 432: warning: cyclomatic complexity 25 of function (*MyDecimal).Shift() is high (> 15) (gocyclo)
    • Line 1076: warning: cyclomatic complexity 25 of function (*MyDecimal).ToBin() is high (> 15) (gocyclo)
    • Line 1710: warning: cyclomatic complexity 22 of function DecimalMul() is high (> 15) (gocyclo)
    • Line 1210: warning: cyclomatic complexity 21 of function (*MyDecimal).FromBin() is high (> 15) (gocyclo)
    • Line 1556: warning: cyclomatic complexity 19 of function doAdd() is high (> 15) (gocyclo)
    • _vendor/src/google.golang.org/grpc/transport/http2_server.go
    • Line 756: warning: cyclomatic complexity 23 of function (*http2Server).Write() is high (> 15) (gocyclo)
    • Line 341: warning: cyclomatic complexity 21 of function (*http2Server).HandleStreams() is high (> 15) (gocyclo)
    • Line 683: warning: cyclomatic complexity 16 of function (*http2Server).WriteStatus() is high (> 15) (gocyclo)
    • Line 232: warning: cyclomatic complexity 16 of function (*http2Server).operateHeaders() is high (> 15) (gocyclo)
    • ddl/index.go
    • Line 176: warning: cyclomatic complexity 24 of function (*ddl).onCreateIndex() is high (> 15) (gocyclo)
    • Line 39: warning: cyclomatic complexity 21 of function buildIndexColumns() is high (> 15) (gocyclo)
    • _vendor/src/github.com/cznic/y/y.go
    • Line 1589: warning: cyclomatic complexity 76 of function (*y).rules0() is high (> 15) (gocyclo)
    • Line 751: warning: cyclomatic complexity 73 of function (*y).defs() is high (> 15) (gocyclo)
    • Line 601: warning: cyclomatic complexity 43 of function (*y).conflicts() is high (> 15) (gocyclo)
    • Line 1375: warning: cyclomatic complexity 41 of function (*y).report() is high (> 15) (gocyclo)
    • Line 1930: warning: cyclomatic complexity 34 of function (*y).xerrors() is high (> 15) (gocyclo)
    • Line 1267: warning: cyclomatic complexity 31 of function (*y).reductions() is high (> 15) (gocyclo)
    • Line 428: warning: cyclomatic complexity 30 of function processAST() is high (> 15) (gocyclo)
    • util/codec/codec.go
    • Line 45: warning: cyclomatic complexity 24 of function encode() is high (> 15) (gocyclo)
    • Line 205: warning: cyclomatic complexity 17 of function DecodeOne() is high (> 15) (gocyclo)
    • _vendor/src/github.com/pingcap/goleveldb/leveldb/db_compaction.go
    • Line 422: warning: cyclomatic complexity 21 of function (*tableCompactionBuilder).run() is high (> 15) (gocyclo)
    • Line 150: warning: cyclomatic complexity 20 of function (*DB).compactionTransact() is high (> 15) (gocyclo)
    • Line 85: warning: cyclomatic complexity 18 of function (*DB).compactionError() is high (> 15) (gocyclo)
    • Line 767: warning: cyclomatic complexity 17 of function (*DB).tCompaction() is high (> 15) (gocyclo)
    • store/tikv/tikvrpc/tikvrpc.go
    • Line 244: warning: cyclomatic complexity 20 of function (*Response).GetRegionError() is high (> 15) (gocyclo)
    • Line 157: warning: cyclomatic complexity 20 of function GenRegionErrorResp() is high (> 15) (gocyclo)
    • Line 104: warning: cyclomatic complexity 20 of function SetContext() is high (> 15) (gocyclo)
    • server/conn.go
    • Line 786: warning: cyclomatic complexity 17 of function (*clientConn).writeResultset() is high (> 15) (gocyclo)
    • Line 306: warning: cyclomatic complexity 16 of function (*clientConn).readOptionalSSLRequestAndHandshakeResponse() is high (> 15) (gocyclo)
    • Line 675: warning: cyclomatic complexity 16 of function (*clientConn).handleLoadData() is high (> 15) (gocyclo)
    • Line 500: warning: cyclomatic complexity 16 of function (*clientConn).dispatch() is high (> 15) (gocyclo)
    • plan/decorrelate.go
    • Line 89: warning: cyclomatic complexity 19 of function (*decorrelateSolver).optimize() is high (> 15) (gocyclo)
    • statistics/table.go
    • Line 71: warning: cyclomatic complexity 18 of function (*Handle).tableStatsFromStorage() is high (> 15) (gocyclo)
    • _vendor/src/golang.org/x/text/unicode/norm/maketables.go
    • Line 573: warning: cyclomatic complexity 39 of function printCharInfoTables() is high (> 15) (gocyclo)
    • Line 359: warning: cyclomatic complexity 31 of function completeCharFields() is high (> 15) (gocyclo)
    • Line 813: warning: cyclomatic complexity 19 of function verifyComputed() is high (> 15) (gocyclo)
    • Line 861: warning: cyclomatic complexity 16 of function testDerived() is high (> 15) (gocyclo)
    • _vendor/src/github.com/pingcap/goleveldb/leveldb/db.go
    • Line 275: warning: cyclomatic complexity 35 of function recoverTable() is high (> 15) (gocyclo)
    • Line 471: warning: cyclomatic complexity 29 of function (*DB).recoverJournal() is high (> 15) (gocyclo)
    • Line 919: warning: cyclomatic complexity 18 of function (*DB).GetProperty() is high (> 15) (gocyclo)
    • Line 634: warning: cyclomatic complexity 17 of function (*DB).recoverJournalRO() is high (> 15) (gocyclo)
    • _vendor/src/golang.org/x/text/transform/transform.go
    • Line 568: warning: cyclomatic complexity 24 of function String() is high (> 15) (gocyclo)
    • Line 145: warning: cyclomatic complexity 19 of function (*Reader).Read() is high (> 15) (gocyclo)
    • Line 234: warning: cyclomatic complexity 19 of function (*Writer).Write() is high (> 15) (gocyclo)
    • Line 407: warning: cyclomatic complexity 18 of function (*chain).Transform() is high (> 15) (gocyclo)
    • executor/builder.go
    • Line 56: warning: cyclomatic complexity 43 of function (*executorBuilder).build() is high (> 15) (gocyclo)
    • Line 413: warning: cyclomatic complexity 20 of function (*executorBuilder).buildUnionScanExec() is high (> 15) (gocyclo)
    • ddl/column_test.go
    • Line 411: warning: cyclomatic complexity 21 of function (*testColumnSuite).checkWriteOnlyColumn() is high (> 15) (gocyclo)
    • Line 310: warning: cyclomatic complexity 21 of function (*testColumnSuite).checkDeleteOnlyColumn() is high (> 15) (gocyclo)
    • Line 516: warning: cyclomatic complexity 19 of function (*testColumnSuite).checkReorganizationColumn() is high (> 15) (gocyclo)
    • Line 612: warning: cyclomatic complexity 18 of function (*testColumnSuite).checkPublicColumn() is high (> 15) (gocyclo)
    • expression/builtin_time.go
    • Line 1462: warning: cyclomatic complexity 23 of function (*builtinGetFormatSig).evalString() is high (> 15) (gocyclo)
    • Line 4444: warning: cyclomatic complexity 18 of function (*builtinTimestampAddSig).evalString() is high (> 15) (gocyclo)
    • Line 3760: warning: cyclomatic complexity 18 of function (*builtinMakeTimeSig).evalDuration() is high (> 15) (gocyclo)
    • Line 2545: warning: cyclomatic complexity 17 of function (*subDateFunctionClass).getFunction() is high (> 15) (gocyclo)
    • Line 2313: warning: cyclomatic complexity 17 of function (*addDateFunctionClass).getFunction() is high (> 15) (gocyclo)
    • plan/expression_rewriter.go
    • Line 274: warning: cyclomatic complexity 26 of function (*expressionRewriter).handleCompareSubquery() is high (> 15) (gocyclo)
    • Line 671: warning: cyclomatic complexity 24 of function (*expressionRewriter).Leave() is high (> 15) (gocyclo)
    • Line 214: warning: cyclomatic complexity 18 of function (*expressionRewriter).Enter() is high (> 15) (gocyclo)
    • Line 529: warning: cyclomatic complexity 17 of function (*expressionRewriter).handleInSubquery() is high (> 15) (gocyclo)
    • Line 888: warning: cyclomatic complexity 16 of function (*expressionRewriter).inToExpression() is high (> 15) (gocyclo)
    • executor/metrics.go
    • Line 113: warning: cyclomatic complexity 26 of function StatementLabel() is high (> 15) (gocyclo)
    • Line 237: warning: cyclomatic complexity 17 of function (*stmtAttributes).fromPlan() is high (> 15) (gocyclo)
    • _vendor/src/golang.org/x/net/http2/server.go
    • Line 2197: warning: cyclomatic complexity 30 of function (*responseWriterState).writeChunk() is high (> 15) (gocyclo)
    • Line 711: warning: cyclomatic complexity 24 of function (*serverConn).serve() is high (> 15) (gocyclo)
    • Line 2472: warning: cyclomatic complexity 22 of function (*responseWriter).push() is high (> 15) (gocyclo)
    • Line 1453: warning: cyclomatic complexity 22 of function (*serverConn).processData() is high (> 15) (gocyclo)
    • Line 1590: warning: cyclomatic complexity 17 of function (*serverConn).processHeaders() is high (> 15) (gocyclo)
    • Line 164: warning: cyclomatic complexity 16 of function ConfigureServer() is high (> 15) (gocyclo)
    • Line 1787: warning: cyclomatic complexity 16 of function (*serverConn).newWriterAndRequest() is high (> 15) (gocyclo)
    • server/util.go
    • Line 248: warning: cyclomatic complexity 25 of function dumpRowValuesBinary() is high (> 15) (gocyclo)
    • Line 319: warning: cyclomatic complexity 17 of function dumpTextValue() is high (> 15) (gocyclo)
    • executor/distsql.go
    • Line 202: warning: cyclomatic complexity 21 of function convertIndexRangeTypes() is high (> 15) (gocyclo)
    • Line 1008: warning: cyclomatic complexity 16 of function (*XSelectTableExec).Next() is high (> 15) (gocyclo)
    • Line 484: warning: cyclomatic complexity 16 of function (*XSelectIndexExec).nextForSingleRead() is high (> 15) (gocyclo)
    • util/types/time.go
    • Line 1840: warning: cyclomatic complexity 44 of function (Time).convertDateFormat() is high (> 15) (gocyclo)
    • Line 607: warning: cyclomatic complexity 26 of function parseDatetime() is high (> 15) (gocyclo)
    • Line 961: warning: cyclomatic complexity 24 of function ParseDuration() is high (> 15) (gocyclo)
    • plan/logical_plan_builder.go
    • Line 1092: warning: cyclomatic complexity 28 of function (*planBuilder).buildSelect() is high (> 15) (gocyclo)
    • Line 825: warning: cyclomatic complexity 23 of function (*havingAndOrderbyExprResolver).Leave() is high (> 15) (gocyclo)
    • Line 222: warning: cyclomatic complexity 21 of function (*planBuilder).buildJoin() is high (> 15) (gocyclo)
    • Line 1222: warning: cyclomatic complexity 18 of function (*planBuilder).buildDataSource() is high (> 15) (gocyclo)
    • bootstrap.go
    • Line 278: warning: cyclomatic complexity 19 of function upgrade() is high (> 15) (gocyclo)
    • util/types/convert.go
    • Line 356: warning: cyclomatic complexity 19 of function getValidFloatPrefix() is high (> 15) (gocyclo)
    • Line 403: warning: cyclomatic complexity 16 of function ToString() is high (> 15) (gocyclo)
    • Line 231: warning: cyclomatic complexity 16 of function floatStrToIntStr() is high (> 15) (gocyclo)
    • ddl/column.go
    • Line 441: warning: cyclomatic complexity 18 of function (*ddl).doModifyColumn() is high (> 15) (gocyclo)
    • plan/new_physical_plan_builder.go
    • Line 693: warning: cyclomatic complexity 28 of function (*DataSource).convertToIndexScan() is high (> 15) (gocyclo)
    • Line 901: warning: cyclomatic complexity 23 of function (*DataSource).convertToTableScan() is high (> 15) (gocyclo)
    • _vendor/src/golang.org/x/net/http2/transport.go
    • Line 706: warning: cyclomatic complexity 37 of function (*ClientConn).RoundTrip() is high (> 15) (gocyclo)
    • Line 1337: warning: cyclomatic complexity 25 of function (*clientConnReadLoop).run() is high (> 15) (gocyclo)
    • Line 1067: warning: cyclomatic complexity 23 of function (*ClientConn).encodeHeaders() is high (> 15) (gocyclo)
    • Line 930: warning: cyclomatic complexity 19 of function (*clientStream).writeRequestBody() is high (> 15) (gocyclo)
    • Line 1462: warning: cyclomatic complexity 18 of function (*clientConnReadLoop).handleResponse() is high (> 15) (gocyclo)
    • ddl/ddl_db_test.go
    • Line 482: warning: cyclomatic complexity 18 of function (*testDBSuite).TestAddIndex() is high (> 15) (gocyclo)
    • Line 300: warning: cyclomatic complexity 17 of function (*testDBSuite).TestCancelAddIndex() 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!