Preparing report...

Report for github.com/youtube/vitess

D    Needs lots of improvement    Found 256 issues across 2167 files

Tweet

gofmt0%

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

An error occurred while running this test (AddError: could not parse "_repos/src/github.com/youtube/vitess/go/vt/vttablet/grpctabletconn/stat conn.go: no such file or directory:1::warning: file is not gofmted with -s (gofmt)" - strconv.Atoi: parsing " no such file or directory": invalid syntax)


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!


golint0%

Golint is a linter for Go source code.

An error occurred while running this test (exit status 3)


gocyclo89%

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.

    • vitess/go/vt/topo/topotests/srv_keyspace_test.go
    • Line 247: warning: cyclomatic complexity 35 of function TestUpdateSrvKeyspacePartitions() is high (> 15) (gocyclo)
    • Line 76: warning: cyclomatic complexity 30 of function TestWatchSrvKeyspace() is high (> 15) (gocyclo)
    • Line 892: warning: cyclomatic complexity 30 of function TestMasterMigrateServedType() is high (> 15) (gocyclo)
    • Line 488: warning: cyclomatic complexity 23 of function TestUpdateUpdateDisableQueryService() is high (> 15) (gocyclo)
    • vitess/go/vt/vtctl/vtctl.go
    • Line 1929: warning: cyclomatic complexity 70 of function commandVRWorkflow() is high (> 15) (gocyclo)
    • Line 2861: warning: cyclomatic complexity 26 of function commandOnlineDDL() is high (> 15) (gocyclo)
    • Line 1557: warning: cyclomatic complexity 24 of function commandCreateKeyspace() is high (> 15) (gocyclo)
    • Line 3135: warning: cyclomatic complexity 24 of function commandApplyVSchema() is high (> 15) (gocyclo)
    • vitess/go/vt/vttablet/tabletserver/tabletserver.go
    • Line 1300: warning: cyclomatic complexity 20 of function (*TabletServer).convertAndLogError() is high (> 15) (gocyclo)
    • Line 825: warning: cyclomatic complexity 20 of function (*TabletServer).ExecuteBatch() is high (> 15) (gocyclo)
    • Line 1405: warning: cyclomatic complexity 17 of function convertErrorCode() is high (> 15) (gocyclo)
    • vitess/go/vt/vttablet/onlineddl/executor.go
    • Line 1653: warning: cyclomatic complexity 46 of function (*Executor).executeMigration() is high (> 15) (gocyclo)
    • Line 1432: warning: cyclomatic complexity 24 of function (*Executor).executeRevert() is high (> 15) (gocyclo)
    • Line 2670: warning: cyclomatic complexity 22 of function (*Executor).VExec() is high (> 15) (gocyclo)
    • Line 754: warning: cyclomatic complexity 19 of function (*Executor).ExecuteWithGhost() is high (> 15) (gocyclo)
    • Line 1366: warning: cyclomatic complexity 17 of function (*Executor).validateMigrationRevertible() is high (> 15) (gocyclo)
    • Line 945: warning: cyclomatic complexity 16 of function (*Executor).ExecuteWithPTOSC() is high (> 15) (gocyclo)
    • Line 513: warning: cyclomatic complexity 16 of function (*Executor).cutOverVReplMigration() is high (> 15) (gocyclo)
    • vitess/go/vt/wrangler/materializer.go
    • Line 367: warning: cyclomatic complexity 51 of function (*Wrangler).prepareCreateLookup() is high (> 15) (gocyclo)
    • Line 68: warning: cyclomatic complexity 39 of function (*Wrangler).MoveTables() is high (> 15) (gocyclo)
    • Line 650: warning: cyclomatic complexity 21 of function (*Wrangler).ExternalizeVindex() is high (> 15) (gocyclo)
    • Line 887: warning: cyclomatic complexity 19 of function (*materializer).deploySchema() is high (> 15) (gocyclo)
    • vitess/go/vt/sqlparser/ast_format.go
    • Line 251: warning: cyclomatic complexity 40 of function (*PartitionSpec).Format() is high (> 15) (gocyclo)
    • Line 643: warning: cyclomatic complexity 30 of function (*ShowLegacy).Format() is high (> 15) (gocyclo)
    • Line 433: warning: cyclomatic complexity 28 of function (*ColumnType).Format() is high (> 15) (gocyclo)
    • vitess/go/vt/orchestrator/logic/topology_recovery.go
    • Line 620: warning: cyclomatic complexity 46 of function SuggestReplacementForPromotedReplica() is high (> 15) (gocyclo)
    • Line 1922: warning: cyclomatic complexity 29 of function GracefulMasterTakeover() is high (> 15) (gocyclo)
    • Line 829: warning: cyclomatic complexity 29 of function checkAndRecoverDeadMaster() is high (> 15) (gocyclo)
    • Line 1268: warning: cyclomatic complexity 25 of function RecoverDeadCoMaster() is high (> 15) (gocyclo)
    • Line 495: warning: cyclomatic complexity 23 of function recoverDeadMaster() is high (> 15) (gocyclo)
    • Line 1631: warning: cyclomatic complexity 22 of function executeCheckAndRecoverFunction() is high (> 15) (gocyclo)
    • Line 1540: warning: cyclomatic complexity 22 of function getCheckAndRecoverFunction() is high (> 15) (gocyclo)
    • Line 1133: warning: cyclomatic complexity 22 of function RecoverDeadIntermediateMaster() is high (> 15) (gocyclo)
    • Line 389: warning: cyclomatic complexity 19 of function recoverDeadMasterInBinlogServerTopology() is high (> 15) (gocyclo)
    • Line 2048: warning: cyclomatic complexity 19 of function electNewMaster() is high (> 15) (gocyclo)
    • Line 1075: warning: cyclomatic complexity 17 of function GetCandidateSiblingOfIntermediateMaster() is high (> 15) (gocyclo)
    • vitess/go/vt/mysqlctl/builtinbackupengine.go
    • Line 139: warning: cyclomatic complexity 27 of function (*BuiltinBackupEngine).ExecuteBackup() is high (> 15) (gocyclo)
    • Line 524: warning: cyclomatic complexity 17 of function (*BuiltinBackupEngine).restoreFile() is high (> 15) (gocyclo)
    • Line 363: warning: cyclomatic complexity 17 of function (*BuiltinBackupEngine).backupFile() is high (> 15) (gocyclo)
    • vitess/go/vt/srvtopo/resilient_server_test.go
    • Line 41: warning: cyclomatic complexity 50 of function TestGetSrvKeyspace() is high (> 15) (gocyclo)
    • Line 490: warning: cyclomatic complexity 23 of function TestGetSrvKeyspaceNames() is high (> 15) (gocyclo)
    • Line 406: warning: cyclomatic complexity 16 of function TestWatchSrvVSchema() is high (> 15) (gocyclo)
    • vitess/go/mysql/binlog_event_rbr.go
    • Line 336: warning: cyclomatic complexity 115 of function CellValue() is high (> 15) (gocyclo)
    • Line 200: warning: cyclomatic complexity 28 of function cellLength() is high (> 15) (gocyclo)
    • Line 962: warning: cyclomatic complexity 24 of function (binlogEvent).Rows() is high (> 15) (gocyclo)
    • vitess/go/mysql/endtoend/replication_test.go
    • Line 196: warning: cyclomatic complexity 54 of function TestRowReplicationWithRealDatabase() is high (> 15) (gocyclo)
    • Line 380: warning: cyclomatic complexity 40 of function TestRowReplicationTypes() is high (> 15) (gocyclo)
    • Line 40: warning: cyclomatic complexity 20 of function connectForReplication() is high (> 15) (gocyclo)
    • vitess/go/mysql/server.go
    • Line 293: warning: cyclomatic complexity 38 of function (*Listener).handle() is high (> 15) (gocyclo)
    • Line 624: warning: cyclomatic complexity 25 of function (*Listener).parseClientHandshakePacket() is high (> 15) (gocyclo)
    • vitess/go/vt/sqlparser/ast_clone.go
    • Line 21: warning: cyclomatic complexity 150 of function CloneSQLNode() is high (> 15) (gocyclo)
    • Line 2112: warning: cyclomatic complexity 44 of function CloneStatement() is high (> 15) (gocyclo)
    • Line 1948: warning: cyclomatic complexity 34 of function CloneExpr() is high (> 15) (gocyclo)
    • Line 1786: warning: cyclomatic complexity 22 of function CloneAlterOption() is high (> 15) (gocyclo)
    • vitess/go/vt/vttest/local_cluster.go
    • Line 538: warning: cyclomatic complexity 25 of function LoadSQLFile() is high (> 15) (gocyclo)
    • Line 354: warning: cyclomatic complexity 19 of function (*LocalCluster).loadSchema() is high (> 15) (gocyclo)
    • Line 219: warning: cyclomatic complexity 19 of function (*LocalCluster).Setup() is high (> 15) (gocyclo)
    • vitess/go/pools/resource_pool_flaky_test.go
    • Line 62: warning: cyclomatic complexity 40 of function TestOpen() is high (> 15) (gocyclo)
    • Line 449: warning: cyclomatic complexity 27 of function TestIdleTimeout() is high (> 15) (gocyclo)
    • Line 251: warning: cyclomatic complexity 26 of function TestShrinking() is high (> 15) (gocyclo)
    • vitess/go/vt/orchestrator/inst/instance_topology.go
    • Line 2639: warning: cyclomatic complexity 31 of function relocateBelowInternal() is high (> 15) (gocyclo)
    • Line 354: warning: cyclomatic complexity 23 of function MoveUpReplicas() is high (> 15) (gocyclo)
    • Line 935: warning: cyclomatic complexity 23 of function MakeCoMaster() is high (> 15) (gocyclo)
    • Line 1275: warning: cyclomatic complexity 21 of function ErrantGTIDResetMaster() is high (> 15) (gocyclo)
    • Line 2766: warning: cyclomatic complexity 19 of function relocateReplicasInternal() is high (> 15) (gocyclo)
    • Line 483: warning: cyclomatic complexity 19 of function MoveBelow() is high (> 15) (gocyclo)
    • Line 268: warning: cyclomatic complexity 18 of function MoveUp() is high (> 15) (gocyclo)
    • Line 1533: warning: cyclomatic complexity 17 of function MatchBelow() is high (> 15) (gocyclo)
    • Line 1747: warning: cyclomatic complexity 17 of function TakeMaster() is high (> 15) (gocyclo)
    • Line 2185: warning: cyclomatic complexity 16 of function chooseCandidateReplica() is high (> 15) (gocyclo)
    • Line 775: warning: cyclomatic complexity 16 of function Repoint() is high (> 15) (gocyclo)
    • vitess/go/vt/sqlparser/goyacc/goyacc.go
    • Line 379: warning: cyclomatic complexity 77 of function setup() is high (> 15) (gocyclo)
    • Line 849: warning: cyclomatic complexity 59 of function gettok() is high (> 15) (gocyclo)
    • Line 1436: warning: cyclomatic complexity 49 of function cpyact() is high (> 15) (gocyclo)
    • Line 2994: warning: cyclomatic complexity 29 of function others() is high (> 15) (gocyclo)
    • Line 1966: warning: cyclomatic complexity 26 of function closure() is high (> 15) (gocyclo)
    • Line 2316: warning: cyclomatic complexity 22 of function output() is high (> 15) (gocyclo)
    • Line 2746: warning: cyclomatic complexity 21 of function callopt() is high (> 15) (gocyclo)
    • Line 2249: warning: cyclomatic complexity 20 of function apack() is high (> 15) (gocyclo)
    • Line 2443: warning: cyclomatic complexity 20 of function wract() is high (> 15) (gocyclo)
    • Line 2098: warning: cyclomatic complexity 19 of function state() is high (> 15) (gocyclo)
    • Line 1721: warning: cyclomatic complexity 18 of function cempty() is high (> 15) (gocyclo)
    • Line 1119: warning: cyclomatic complexity 18 of function parsetypes() is high (> 15) (gocyclo)
    • Line 1234: warning: cyclomatic complexity 17 of function isPackageClause() is high (> 15) (gocyclo)
    • Line 1361: warning: cyclomatic complexity 17 of function cpyyvalaccess() is high (> 15) (gocyclo)
    • Line 2910: warning: cyclomatic complexity 17 of function stin() is high (> 15) (gocyclo)
    • Line 1874: warning: cyclomatic complexity 16 of function stagen() is high (> 15) (gocyclo)
    • Line 2533: warning: cyclomatic complexity 16 of function wrstate() is high (> 15) (gocyclo)
    • vitess/go/vt/wrangler/vdiff.go
    • Line 900: warning: cyclomatic complexity 29 of function (*tableDiffer).diff() is high (> 15) (gocyclo)
    • Line 149: warning: cyclomatic complexity 26 of function (*Wrangler).VDiff() is high (> 15) (gocyclo)
    • Line 415: warning: cyclomatic complexity 18 of function (*vdiff).buildTablePlan() is high (> 15) (gocyclo)
    • vitess/go/vt/sqlparser/analyzer.go
    • Line 235: warning: cyclomatic complexity 27 of function (StatementType).String() is high (> 15) (gocyclo)
    • Line 157: warning: cyclomatic complexity 27 of function Preview() is high (> 15) (gocyclo)
    • Line 68: warning: cyclomatic complexity 25 of function ASTToStatementType() is high (> 15) (gocyclo)
    • Line 410: warning: cyclomatic complexity 18 of function NewPlanValue() is high (> 15) (gocyclo)
    • vitess/go/mysql/client.go
    • Line 230: warning: cyclomatic complexity 24 of function (*Conn).clientHandshake() is high (> 15) (gocyclo)
    • Line 356: warning: cyclomatic complexity 22 of function (*Conn).parseInitialHandshakePacket() is high (> 15) (gocyclo)
    • vitess/go/vt/vttablet/tabletmanager/restore.go
    • Line 140: warning: cyclomatic complexity 27 of function (*TabletManager).restoreDataLocked() is high (> 15) (gocyclo)
    • Line 391: warning: cyclomatic complexity 20 of function (*TabletManager).catchupToGTID() is high (> 15) (gocyclo)
    • Line 482: warning: cyclomatic complexity 17 of function (*TabletManager).startReplication() is high (> 15) (gocyclo)
    • vitess/go/vt/sqlparser/ast_visit.go
    • Line 20: warning: cyclomatic complexity 150 of function VisitSQLNode() is high (> 15) (gocyclo)
    • Line 2614: warning: cyclomatic complexity 44 of function VisitStatement() is high (> 15) (gocyclo)
    • Line 2462: warning: cyclomatic complexity 34 of function VisitExpr() is high (> 15) (gocyclo)
    • Line 2314: warning: cyclomatic complexity 22 of function VisitAlterOption() is high (> 15) (gocyclo)
    • vitess/go/vt/sqlparser/ast_equals.go
    • Line 21: warning: cyclomatic complexity 300 of function EqualsSQLNode() is high (> 15) (gocyclo)
    • Line 3389: warning: cyclomatic complexity 88 of function EqualsStatement() is high (> 15) (gocyclo)
    • Line 3023: warning: cyclomatic complexity 68 of function EqualsExpr() is high (> 15) (gocyclo)
    • Line 2684: warning: cyclomatic complexity 44 of function EqualsAlterOption() is high (> 15) (gocyclo)
    • Line 2933: warning: cyclomatic complexity 22 of function EqualsDDLStatement() is high (> 15) (gocyclo)
    • Line 2141: warning: cyclomatic complexity 17 of function EqualsRefOfSelect() is high (> 15) (gocyclo)
    • vitess/go/vt/vtgate/executor.go
    • Line 594: warning: cyclomatic complexity 45 of function (*Executor).handleShow() is high (> 15) (gocyclo)
    • Line 249: warning: cyclomatic complexity 26 of function (*Executor).addNeededBindVars() is high (> 15) (gocyclo)
    • Line 1005: warning: cyclomatic complexity 21 of function (*Executor).StreamExecute() is high (> 15) (gocyclo)
    • Line 848: warning: cyclomatic complexity 20 of function (*Executor).showTablets() is high (> 15) (gocyclo)
    • Line 1167: warning: cyclomatic complexity 16 of function (*Executor).getPlan() is high (> 15) (gocyclo)
    • vitess/go/vt/mysqlctl/mysqld.go
    • Line 483: warning: cyclomatic complexity 21 of function (*Mysqld).Shutdown() is high (> 15) (gocyclo)
    • Line 340: warning: cyclomatic complexity 17 of function (*Mysqld).startNoWait() is high (> 15) (gocyclo)
    • vitess/go/vt/wrangler/keyspace.go
    • Line 660: warning: cyclomatic complexity 33 of function (*Wrangler).masterMigrateServedType() is high (> 15) (gocyclo)
    • Line 391: warning: cyclomatic complexity 17 of function (*Wrangler).MigrateServedTypes() is high (> 15) (gocyclo)
    • vitess/go/cmd/zk/zkcmd.go
    • Line 277: warning: cyclomatic complexity 28 of function cmdLs() is high (> 15) (gocyclo)
    • Line 516: warning: cyclomatic complexity 16 of function cmdCat() is high (> 15) (gocyclo)
    • vitess/go/sqltypes/type.go
    • Line 193: warning: cyclomatic complexity 21 of function modifyType() is high (> 15) (gocyclo)
    • Line 251: warning: cyclomatic complexity 21 of function AreTypesEquivalent() is high (> 15) (gocyclo)
    • vitess/go/vt/wrangler/traffic_switcher.go
    • Line 480: warning: cyclomatic complexity 29 of function (*Wrangler).SwitchWrites() is high (> 15) (gocyclo)
    • Line 380: warning: cyclomatic complexity 27 of function (*Wrangler).SwitchReads() is high (> 15) (gocyclo)
    • Line 807: warning: cyclomatic complexity 21 of function (*Wrangler).buildTrafficSwitcher() is high (> 15) (gocyclo)
    • Line 259: warning: cyclomatic complexity 18 of function (*Wrangler).getWorkflowState() is high (> 15) (gocyclo)
    • Line 744: warning: cyclomatic complexity 16 of function (*Wrangler).DropSources() is high (> 15) (gocyclo)
    • vitess/go/vt/sqlparser/ast_rewrite.go
    • Line 20: warning: cyclomatic complexity 150 of function (*application).rewriteSQLNode() is high (> 15) (gocyclo)
    • Line 5012: warning: cyclomatic complexity 44 of function (*application).rewriteStatement() is high (> 15) (gocyclo)
    • Line 4860: warning: cyclomatic complexity 34 of function (*application).rewriteExpr() is high (> 15) (gocyclo)
    • Line 4712: warning: cyclomatic complexity 22 of function (*application).rewriteAlterOption() is high (> 15) (gocyclo)
    • vitess/go/vt/topo/srv_keyspace.go
    • Line 400: warning: cyclomatic complexity 23 of function (*Server).UpdateDisableQueryService() is high (> 15) (gocyclo)
    • Line 488: warning: cyclomatic complexity 23 of function (*Server).MigrateServedType() is high (> 15) (gocyclo)
    • Line 237: warning: cyclomatic complexity 18 of function (*Server).AddSrvKeyspacePartitions() is high (> 15) (gocyclo)
    • Line 327: warning: cyclomatic complexity 18 of function (*Server).DeleteSrvKeyspacePartitions() is high (> 15) (gocyclo)
    • vitess/go/vt/vttablet/tabletserver/rules/rules.go
    • Line 787: warning: cyclomatic complexity 30 of function BuildQueryRule() is high (> 15) (gocyclo)
    • Line 872: warning: cyclomatic complexity 23 of function buildBindVarCondition() is high (> 15) (gocyclo)
    • Line 647: warning: cyclomatic complexity 20 of function (bvcint64).eval() is high (> 15) (gocyclo)
    • Line 593: warning: cyclomatic complexity 20 of function (bvcuint64).eval() is high (> 15) (gocyclo)
    • vitess/go/vt/worker/split_clone.go
    • Line 160: warning: cyclomatic complexity 20 of function newCloneWorker() is high (> 15) (gocyclo)
    • Line 666: warning: cyclomatic complexity 20 of function (*SplitCloneWorker).sanityCheckShardInfos() is high (> 15) (gocyclo)
    • Line 435: warning: cyclomatic complexity 18 of function (*SplitCloneWorker).run() is high (> 15) (gocyclo)
    • vitess/go/vt/vtctl/grpcvtctldserver/server.go
    • Line 627: warning: cyclomatic complexity 32 of function (*VtctldServer).GetTablets() is high (> 15) (gocyclo)
    • Line 856: warning: cyclomatic complexity 27 of function (*VtctldServer).InitShardPrimaryLocked() is high (> 15) (gocyclo)
    • Line 130: warning: cyclomatic complexity 16 of function (*VtctldServer).CreateKeyspace() is high (> 15) (gocyclo)
    • vitess/go/vt/wrangler/shard.go
    • Line 118: warning: cyclomatic complexity 25 of function (*Wrangler).DeleteShard() is high (> 15) (gocyclo)
    • Line 238: warning: cyclomatic complexity 19 of function (*Wrangler).RemoveShardCell() is high (> 15) (gocyclo)
    • vitess/go/vt/vtgate/evalengine/evalengine.go
    • Line 255: warning: cyclomatic complexity 21 of function compareNumeric() is high (> 15) (gocyclo)
    • Line 30: warning: cyclomatic complexity 18 of function Cast() is high (> 15) (gocyclo)
    • Line 199: warning: cyclomatic complexity 16 of function (EvalResult).toSQLValue() is high (> 15) (gocyclo)
    • vitess/go/mysql/query.go
    • Line 1159: warning: cyclomatic complexity 62 of function val2MySQL() is high (> 15) (gocyclo)
    • Line 631: warning: cyclomatic complexity 56 of function (*Conn).parseStmtArgs() is high (> 15) (gocyclo)
    • Line 353: warning: cyclomatic complexity 22 of function (*Conn).ReadQueryResult() is high (> 15) (gocyclo)
    • Line 546: warning: cyclomatic complexity 19 of function (*Conn).parseComStmtExecute() is high (> 15) (gocyclo)
    • Line 1469: warning: cyclomatic complexity 17 of function val2MySQLLen() is high (> 15) (gocyclo)
    • Line 84: warning: cyclomatic complexity 17 of function (*Conn).readColumnDefinition() is high (> 15) (gocyclo)
    • vitess/go/vt/topo/wildcards.go
    • Line 193: warning: cyclomatic complexity 18 of function (*Server).resolveRecursive() is high (> 15) (gocyclo)
    • Line 75: warning: cyclomatic complexity 17 of function (*Server).ResolveShardWildcard() is high (> 15) (gocyclo)
    • vitess/test.go
    • Line 252: warning: cyclomatic complexity 68 of function main() is high (> 15) (gocyclo)
    • Line 705: warning: cyclomatic complexity 19 of function selectedTests() is high (> 15) (gocyclo)

ineffassign99%

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!