Preparing report...

Report for github.com/baidu-golang/pbrpc

A+    Excellent!    Found 20 issues across 21 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!


gocyclo95%

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.

    • pbrpc/server.go
    • Line 642: warning: cyclomatic complexity 19 of function suitableMethods() is high (> 15) (gocyclo)
    • Line 350: warning: cyclomatic complexity 16 of function (*TcpServer).handleResponse() is high (> 15) (gocyclo)

golint38%

Golint is a linter for Go source code.

    • pbrpc/log.go
    • Line 1: warning: package comment should be of the form "Package baidurpc ..." (golint)
    • pbrpc/rpcpackage.go
    • Line 1: warning: package comment should be of the form "Package baidurpc ..." (golint)
    • Line 31: warning: comment on exported var ERR_NO_SNAPPY should be of the form "ERR_NO_SNAPPY ..." (golint)
    • Line 32: warning: error var ERR_NO_SNAPPY should have name of the form ErrFoo (golint)
    • Line 33: warning: error var ERR_IGNORE_ERR should have name of the form ErrFoo (golint)
    • Line 33: warning: exported var ERR_IGNORE_ERR should have comment or be unexported (golint)
    • Line 34: warning: error var ERR_META should have name of the form ErrFoo (golint)
    • Line 34: warning: exported var ERR_META should have comment or be unexported (golint)
    • Line 36: warning: exported var LOG_INVALID_BYTES should have comment or be unexported (golint)
    • Line 38: warning: comment on exported type RpcDataPackage should be of the form "RpcDataPackage ..." (with optional leading article) (golint)
    • Line 92: warning: exported function NewRpcDataPackage should have comment or be unexported (golint)
    • Line 101: warning: exported method RpcDataPackage.MagicCode should have comment or be unexported (golint)
    • Line 111: warning: exported method RpcDataPackage.GetMagicCode should have comment or be unexported (golint)
    • Line 149: warning: exported method RpcDataPackage.ServiceName should have comment or be unexported (golint)
    • Line 157: warning: exported method RpcDataPackage.MethodName should have comment or be unexported (golint)
    • Line 165: warning: exported method RpcDataPackage.SetData should have comment or be unexported (golint)
    • Line 170: warning: exported method RpcDataPackage.SetAttachment should have comment or be unexported (golint)
    • Line 175: warning: exported method RpcDataPackage.AuthenticationData should have comment or be unexported (golint)
    • Line 182: warning: exported method RpcDataPackage.CorrelationId should have comment or be unexported (golint)
    • Line 189: warning: exported method RpcDataPackage.CompressType should have comment or be unexported (golint)
    • Line 196: warning: exported method RpcDataPackage.LogId should have comment or be unexported (golint)
    • Line 204: warning: exported method RpcDataPackage.GetLogId should have comment or be unexported (golint)
    • Line 209: warning: exported method RpcDataPackage.ErrorCode should have comment or be unexported (golint)
    • Line 217: warning: exported method RpcDataPackage.ErrorText should have comment or be unexported (golint)
    • Line 225: warning: exported method RpcDataPackage.ExtraParams should have comment or be unexported (golint)
    • Line 233: warning: exported method RpcDataPackage.ChunkInfo should have comment or be unexported (golint)
    • Line 248: warning: exported method RpcDataPackage.GetHead should have comment or be unexported (golint)
    • Line 255: warning: exported method RpcDataPackage.GetMeta should have comment or be unexported (golint)
    • Line 262: warning: exported method RpcDataPackage.GetData should have comment or be unexported (golint)
    • Line 266: warning: exported method RpcDataPackage.GetAttachment should have comment or be unexported (golint)
    • Line 270: warning: comment on exported method RpcDataPackage.WriteIO should be of the form "WriteIO ..." (golint)
    • Line 355: warning: comment on exported method RpcDataPackage.ReadIO should be of the form "ReadIO ..." (golint)
    • pbrpc/server.go
    • Line 1: warning: package comment should be of the form "Package baidurpc ..." (golint)
    • Line 38: warning: comment on exported const ST_SUCCESS should be of the form "ST_SUCCESS ..." (golint)
    • Line 41: warning: comment on exported const ST_SERVICE_NOTFOUND should be of the form "ST_SERVICE_NOTFOUND ..." (golint)
    • Line 44: warning: comment on exported const ST_ERROR should be of the form "ST_ERROR ..." (golint)
    • Line 47: warning: comment on exported const KT_LOGID should be of the form "KT_LOGID ..." (golint)
    • Line 50: warning: exported const RPC_STATUS_SERVICENAME should have comment (or a comment on this block) or be unexported (golint)
    • Line 52: warning: comment on exported const Reqeust_QPS_Expire should be of the form "Reqeust_QPS_Expire ..." (golint)
    • Line 53: warning: don't use underscores in Go names; const Reqeust_QPS_Expire should be ReqeustQPSExpire (golint)
    • Line 55: warning: don't use underscores in Go names; const Proto2_Version should be Proto2Version (golint)
    • Line 58: warning: comment on exported var ERR_SERVER_NOT_INIT should be of the form "ERR_SERVER_NOT_INIT ..." (golint)
    • Line 59: warning: error var ERR_SERVER_NOT_INIT should have name of the form ErrFoo (golint)
    • Line 60: warning: error var ERR_INVALID_PORT should have name of the form ErrFoo (golint)
    • Line 60: warning: exported var ERR_INVALID_PORT should have comment or be unexported (golint)
    • Line 61: warning: error var ERR_RESPONSE_TO_CLIENT should have name of the form ErrFoo (golint)
    • Line 61: warning: exported var ERR_RESPONSE_TO_CLIENT should have comment or be unexported (golint)
    • Line 62: warning: exported var LOG_SERVICE_NOTFOUND should have comment or be unexported (golint)
    • Line 63: warning: exported var LOG_SERVICE_DUPLICATE should have comment or be unexported (golint)
    • Line 64: warning: exported var LOG_SERVER_STARTED_INFO should have comment or be unexported (golint)
    • Line 65: warning: exported var LOG_INTERNAL_ERROR should have comment or be unexported (golint)
    • Line 66: warning: exported var LOG_TIMECOUST_INFO should have comment or be unexported (golint)
    • Line 67: warning: exported var LOG_TIMECOUST_INFO2 should have comment or be unexported (golint)
    • Line 69: warning: exported var DEAFULT_IDLE_TIME_OUT_SECONDS should have comment or be unexported (golint)
    • Line 72: warning: exported var MessageType should have comment or be unexported (golint)
    • Line 74: warning: exported type ServerMeta should have comment or be unexported (golint)
    • Line 167: warning: if block ends with a return statement, so drop this else and outdent its block (golint)
    • Line 173: warning: exported type PbFieldMeta should have comment or be unexported (golint)
    • Line 189: warning: exported type RPCFN should have comment or be unexported (golint)
    • Line 191: warning: exported type Service should have comment or be unexported (golint)
    • Line 236: warning: exported type Server should have comment or be unexported (golint)
    • Line 242: warning: comment on exported type ErrorContext should be of the form "ErrorContext ..." (with optional leading article) (golint)
    • Line 247: warning: exported type TcpServer should have comment or be unexported (golint)
    • Line 263: warning: exported function NewTpcServer should have comment or be unexported (golint)
    • Line 289: warning: exported method TcpServer.StartServer should have comment or be unexported (golint)
    • Line 307: warning: exported method TcpServer.Start should have comment or be unexported (golint)
    • Line 334: warning: exported method TcpServer.StartAndBlock should have comment or be unexported (golint)
    • Line 469: warning: exported function GetServiceId should have comment or be unexported (golint)
    • Line 473: warning: exported method TcpServer.Stop should have comment or be unexported (golint)
    • Line 752: warning: comment on exported function Attachement should be of the form "Attachement ..." (golint)
    • Line 772: warning: comment on exported function Errors should be of the form "Errors ..." (golint)
    • pbrpc/status.go
    • Line 1: warning: package comment should be of the form "Package baidurpc ..." (golint)
    • Line 1: warning: package comment should not have leading space (golint)
    • Line 18: warning: comment on exported type HttpStatusView should be of the form "HttpStatusView ..." (with optional leading article) (golint)
    • Line 23: warning: exported type RPCStatus should have comment or be unexported (golint)
    • Line 30: warning: exported type RPCMethod should have comment or be unexported (golint)
    • Line 37: warning: exported type QpsData should have comment or be unexported (golint)
    • Line 41: warning: exported method RPCStatus.Reset should have comment or be unexported (golint)
    • Line 43: warning: exported method RPCStatus.ProtoMessage should have comment or be unexported (golint)
    • Line 45: warning: exported method RPCMethod.Reset should have comment or be unexported (golint)
    • Line 47: warning: exported method RPCMethod.ProtoMessage should have comment or be unexported (golint)
    • Line 49: warning: exported method QpsData.Reset should have comment or be unexported (golint)
    • Line 51: warning: exported method QpsData.ProtoMessage should have comment or be unexported (golint)
    • Line 53: warning: exported method HttpStatusView.Status should have comment or be unexported (golint)
    • Line 91: warning: exported method HttpStatusView.QpsDataStatus should have comment or be unexported (golint)
    • Line 103: warning: comment on exported type RPCRequestStatus should be of the form "RPCRequestStatus ..." (with optional leading article) (golint)
    • Line 124: warning: comment on exported type RPCMethodReuqestStatus should be of the form "RPCMethodReuqestStatus ..." (with optional leading article) (golint)
    • Line 129: warning: comment on exported function NewRPCRequestStatus should be of the form "NewRPCRequestStatus ..." (golint)
    • Line 144: warning: comment on exported method RPCRequestStatus.Start should be of the form "Start ..." (golint)
    • Line 193: warning: comment on exported method RPCRequestStatus.RequestIn should be of the form "RequestIn ..." (golint)
    • Line 212: warning: comment on exported method RPCRequestStatus.Close should be of the form "Close ..." (golint)
    • pbrpc/client.go
    • Line 1: warning: package comment should be of the form "Package baidurpc ..." (golint)
    • Line 27: warning: error var ERR_NEED_INIT should have name of the form ErrFoo (golint)
    • Line 27: warning: exported var ERR_NEED_INIT should have comment or be unexported (golint)
    • Line 28: warning: error var ERR_RESPONSE_NIL should have name of the form ErrFoo (golint)
    • Line 28: warning: exported var ERR_RESPONSE_NIL should have comment or be unexported (golint)
    • Line 29: warning: exported var LOG_SERVER_REPONSE_ERROR should have comment or be unexported (golint)
    • Line 30: warning: exported var LOG_CLIENT_TIMECOUST_INFO should have comment or be unexported (golint)
    • Line 38: warning: exported const ST_READ_TIMEOUT should have comment (or a comment on this block) or be unexported (golint)
    • Line 41: warning: comment on exported type RpcClient should be of the form "RpcClient ..." (with optional leading article) (golint)
    • Line 51: warning: exported type URL should have comment or be unexported (golint)
    • Line 56: warning: exported method URL.SetHost should have comment or be unexported (golint)
    • Line 61: warning: exported method URL.SetPort should have comment or be unexported (golint)
    • Line 66: warning: exported type RpcInvocation should have comment or be unexported (golint)
    • Line 89: warning: exported function NewRpcInvocation should have comment or be unexported (golint)
    • Line 106: warning: exported method RpcInvocation.SetParameterIn should have comment or be unexported (golint)
    • Line 110: warning: exported method RpcInvocation.GetRequestRpcDataPackage should have comment or be unexported (golint)
    • Line 136: warning: exported method RpcClient.Close should have comment or be unexported (golint)
    • Line 237: warning: comment on exported method RpcClient.SendRpcRequestWithTimeout should be of the form "SendRpcRequestWithTimeout ..." (golint)
    • pbrpc/codec.go
    • Line 1: warning: package comment should be of the form "Package baidurpc ..." (golint)
    • Line 30: warning: exported const REQUIRED_TYPE should have comment or be unexported (golint)
    • Line 32: warning: error var ERR_INVALID_TYPE should have name of the form ErrFoo (golint)
    • Line 32: warning: exported var ERR_INVALID_TYPE should have comment or be unexported (golint)
    • Line 33: warning: exported var LOG_CLOSE_CONNECT_INFO should have comment or be unexported (golint)
    • Line 35: warning: comment on exported type RpcDataPackageCodec should be of the form "RpcDataPackageCodec ..." (with optional leading article) (golint)
    • Line 55: warning: comment on exported method RpcDataPackageCodec.Send should be of the form "Send ..." (golint)
    • Line 99: warning: comment on exported method RpcDataPackageCodec.Receive should be of the form "Receive ..." (golint)
    • Line 124: warning: comment on exported method RpcDataPackageCodec.Close should be of the form "Close ..." (golint)
    • Line 134: warning: comment on exported method RpcDataPackageCodec.SetTimeout should be of the form "SetTimeout ..." (golint)
    • Line 147: warning: comment on exported type RpcDataPackageProtocol should be of the form "RpcDataPackageProtocol ..." (with optional leading article) (golint)
    • Line 152: warning: exported method RpcDataPackageProtocol.NewCodec should have comment or be unexported (golint)
    • pbrpc/connection.go
    • Line 1: warning: package comment should be of the form "Package baidurpc ..." (golint)
    • Line 27: warning: error var ERR_SESSION_IS_NIL should have name of the form ErrFoo (golint)
    • Line 27: warning: exported var ERR_SESSION_IS_NIL should have comment or be unexported (golint)
    • Line 28: warning: error var ERR_INVALID_URL should have name of the form ErrFoo (golint)
    • Line 28: warning: exported var ERR_INVALID_URL should have comment or be unexported (golint)
    • Line 30: warning: exported var LOG_INVALID_PORT should have comment or be unexported (golint)
    • Line 32: warning: comment on exported type Connection should be of the form "Connection ..." (with optional leading article) (golint)
    • Line 40: warning: exported type ConnectionTester should have comment or be unexported (golint)
    • Line 44: warning: exported type TCPConnection should have comment or be unexported (golint)
    • Line 48: warning: comment on exported function NewTCPConnection should be of the form "NewTCPConnection ..." (golint)
    • Line 88: warning: exported method TCPConnection.TestConnection should have comment or be unexported (golint)
    • Line 99: warning: exported method TCPConnection.GetId should have comment or be unexported (golint)
    • Line 107: warning: exported method TCPConnection.SendReceive should have comment or be unexported (golint)
    • Line 137: warning: exported method TCPConnection.Close should have comment or be unexported (golint)
    • pbrpc/haclient.go
    • Line 47: warning: comment on exported function NewHaRpcCient should be of the form "NewHaRpcCient ..." (golint)
    • Line 79: warning: comment on exported method HaRpcClient.SendRpcRequest should be of the form "SendRpcRequest ..." (golint)
    • Line 96: warning: if block ends with a return statement, so drop this else and outdent its block (golint)
    • pbrpc/utility.go
    • Line 1: warning: package comment should be of the form "Package baidurpc ..." (golint)
    • Line 22: warning: exported var NANO_IN_SECONDS should have comment or be unexported (golint)
    • Line 24: warning: comment on exported function TimetookInSeconds should be of the form "TimetookInSeconds ..." (golint)
    • pbrpc/nettool/listener.go
    • Line 1: warning: package comment should be of the form "Package nettool ..." (golint)
    • Line 1: warning: package comment should not have leading space (golint)
    • Line 18: warning: don't use underscores in Go names; const Equal_Mode should be EqualMode (golint)
    • Line 18: warning: exported const Equal_Mode should have comment (or a comment on this block) or be unexported (golint)
    • Line 19: warning: don't use underscores in Go names; const StartWith_Mode should be StartWithMode (golint)
    • Line 22: warning: exported type NetInfo should have comment or be unexported (golint)
    • Line 34: warning: exported method CustomListener.Accept should have comment or be unexported (golint)
    • Line 39: warning: exported method CustomListener.Close should have comment or be unexported (golint)
    • Line 43: warning: exported method CustomListener.Addr should have comment or be unexported (golint)
    • Line 72: warning: comment on exported function NewCustomListenerSelectorByListener should be of the form "NewCustomListenerSelectorByListener ..." (golint)
    • Line 86: warning: comment on exported method CustomListenerSelector.RegisterListener should be of the form "RegisterListener ..." (golint)
    • Line 96: warning: comment on exported method CustomListenerSelector.RegisterDefaultListener should be of the form "RegisterDefaultListener ..." (golint)
    • Line 101: warning: exported method CustomListenerSelector.Serve should have comment or be unexported (golint)
    • Line 148: warning: comment on exported type ConnWrapper should be of the form "ConnWrapper ..." (with optional leading article) (golint)
    • pbrpc/connectionpool.go
    • Line 1: warning: package comment should be of the form "Package baidurpc ..." (golint)
    • Line 26: warning: don't use underscores in Go names; var Empty_Head should be EmptyHead (golint)
    • Line 26: warning: exported var Empty_Head should have comment or be unexported (golint)
    • Line 28: warning: error var ERR_POOL_NOT_INIT should have name of the form ErrFoo (golint)
    • Line 28: warning: exported var ERR_POOL_NOT_INIT should have comment or be unexported (golint)
    • Line 29: warning: error var ERR_GET_CONN_FAIL should have name of the form ErrFoo (golint)
    • Line 29: warning: exported var ERR_GET_CONN_FAIL should have comment or be unexported (golint)
    • Line 30: warning: error var ERR_DESTORY_OBJECT_NIL should have name of the form ErrFoo (golint)
    • Line 30: warning: exported var ERR_DESTORY_OBJECT_NIL should have comment or be unexported (golint)
    • Line 31: warning: error var ERR_POOL_URL_NIL should have name of the form ErrFoo (golint)
    • Line 31: warning: exported var ERR_POOL_URL_NIL should have comment or be unexported (golint)
    • Line 33: warning: exported var HB_SERVICE_NAME should have comment or be unexported (golint)
    • Line 34: warning: exported var HB_METHOD_NAME should have comment or be unexported (golint)
    • Line 43: warning: exported type TCPConnectionPool should have comment or be unexported (golint)
    • Line 49: warning: exported function NewDefaultTCPConnectionPool should have comment or be unexported (golint)
    • Line 53: warning: exported function NewTCPConnectionPool should have comment or be unexported (golint)
    • Line 107: warning: exported method TCPConnectionPool.SendReceive should have comment or be unexported (golint)
    • Line 118: warning: exported method TCPConnectionPool.Close should have comment or be unexported (golint)
    • Line 127: warning: exported method TCPConnectionPool.GetNumActive should have comment or be unexported (golint)
    • Line 135: warning: exported type ConnectionPoolFactory should have comment or be unexported (golint)
    • Line 140: warning: exported method ConnectionPoolFactory.MakeObject should have comment or be unexported (golint)
    • Line 154: warning: exported method ConnectionPoolFactory.DestroyObject should have comment or be unexported (golint)
    • Line 164: warning: exported method ConnectionPoolFactory.ValidateObject should have comment or be unexported (golint)
    • Line 176: warning: exported method ConnectionPoolFactory.ActivateObject should have comment or be unexported (golint)
    • Line 180: warning: exported method ConnectionPoolFactory.PassivateObject should have comment or be unexported (golint)
    • pbrpc/doc.go
    • Line 1: warning: package comment should be of the form "Package baidurpc ..." (golint)
    • pbrpc/header.go
    • Line 1: warning: package comment should be of the form "Package baidurpc ..." (golint)
    • Line 23: warning: exported const SIZE should have comment or be unexported (golint)
    • Line 25: warning: exported const MAGIC_CODE should have comment or be unexported (golint)
    • Line 27: warning: exported const COMPRESS_NO should have comment or be unexported (golint)
    • Line 28: warning: exported const COMPRESS_SNAPPY should have comment or be unexported (golint)
    • Line 29: warning: exported const COMPRESS_GZIP should have comment or be unexported (golint)
    • Line 43: warning: comment on exported type Header should be of the form "Header ..." (with optional leading article) (golint)
    • Line 87: warning: exported method Header.SetMagicCode should have comment or be unexported (golint)
    • Line 94: warning: exported method Header.GetMagicCode should have comment or be unexported (golint)
    • Line 98: warning: exported method Header.SetMessageSize should have comment or be unexported (golint)
    • Line 102: warning: exported method Header.GetMessageSize should have comment or be unexported (golint)
    • Line 106: warning: exported method Header.SetMetaSize should have comment or be unexported (golint)
    • Line 110: warning: exported method Header.GetMetaSize should have comment or be unexported (golint)

license100%

Checks whether your project has a LICENSE file.

No problems detected. Good job!


ineffassign85%

IneffAssign detects ineffectual assignments in Go code.

    • pbrpc/rpcpackage.go
    • Line 87: warning: undeclared name: RpcMeta (ineffassign)
    • Line 255: warning: undeclared name: RpcMeta (ineffassign)
    • Line 96: warning: undeclared name: Response (ineffassign)
    • Line 125: warning: undeclared name: RpcMeta (ineffassign)
    • Line 134: warning: undeclared name: Request (ineffassign)
    • Line 144: warning: undeclared name: Response (ineffassign)
    • Line 234: warning: undeclared name: ChunkInfo (ineffassign)

misspell19%

Misspell Finds commonly misspelled English words

    • pbrpc/connectionpool.go
    • Line 1: warning: "compatiable" is a misspelling of "compatible" (misspell)
    • Line 30: warning: "DESTORY" is a misspelling of "DESTROY" (misspell)
    • Line 157: warning: "DESTORY" is a misspelling of "DESTROY" (misspell)
    • pbrpc/server.go
    • Line 1: warning: "compatiable" is a misspelling of "compatible" (misspell)
    • Line 69: warning: "DEAFULT" is a misspelling of "DEFAULT" (misspell)
    • Line 199: warning: "attachemnt" is a misspelling of "attachment" (misspell)
    • Line 272: warning: "DEAFULT" is a misspelling of "DEFAULT" (misspell)
    • Line 301: warning: "inital" is a misspelling of "initial" (misspell)
    • Line 752: warning: "attachemnt" is a misspelling of "attachment" (misspell)
    • pbrpc/client.go
    • Line 1: warning: "compatiable" is a misspelling of "compatible" (misspell)
    • Line 29: warning: "REPONSE" is a misspelling of "RESPONSE" (misspell)
    • Line 217: warning: "REPONSE" is a misspelling of "RESPONSE" (misspell)
    • Line 263: warning: "REPONSE" is a misspelling of "RESPONSE" (misspell)
    • pbrpc/codec.go
    • Line 1: warning: "compatiable" is a misspelling of "compatible" (misspell)
    • Line 102: warning: "occured" is a misspelling of "occurred" (misspell)
    • Line 125: warning: "ocurred" is a misspelling of "occurred" (misspell)