Preparing report...

Report for github.com/hdfchain/hdfd

A+    Excellent!    Found 92 issues across 529 files

Tweet

gofmt99%

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!


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.

    • hdfd/blockchain/chain.go
    • Line 931: warning: cyclomatic complexity 28 of function (*BlockChain).reorganizeChainInternal() is high (> 15) (gocyclo)
    • Line 523: warning: cyclomatic complexity 18 of function (*BlockChain).connectBlock() is high (> 15) (gocyclo)
    • Line 1296: warning: cyclomatic complexity 17 of function (*BlockChain).connectBestChain() is high (> 15) (gocyclo)
    • hdfd/peer/peer.go
    • Line 1272: warning: cyclomatic complexity 63 of function (*Peer).inHandler() is high (> 15) (gocyclo)
    • Line 1121: warning: cyclomatic complexity 26 of function (*Peer).stallHandler() is high (> 15) (gocyclo)
    • Line 1487: warning: cyclomatic complexity 23 of function (*Peer).queueHandler() is high (> 15) (gocyclo)
    • hdfd/blockchain/chainio.go
    • Line 1738: warning: cyclomatic complexity 27 of function (*BlockChain).initChainState() is high (> 15) (gocyclo)
    • Line 1003: warning: cyclomatic complexity 17 of function deserializeUtxoEntry() is high (> 15) (gocyclo)
    • hdfd/bech32/bech32.go
    • Line 41: warning: cyclomatic complexity 19 of function bech32Polymod() is high (> 15) (gocyclo)
    • Line 160: warning: cyclomatic complexity 16 of function DecodeNoLimit() is high (> 15) (gocyclo)
    • hdfd/server.go
    • Line 2932: warning: cyclomatic complexity 48 of function newServer() is high (> 15) (gocyclo)
    • Line 1675: warning: cyclomatic complexity 33 of function (*server).handleAddPeerMsg() is high (> 15) (gocyclo)
    • Line 1981: warning: cyclomatic complexity 23 of function (*server).handleQuery() is high (> 15) (gocyclo)
    • Line 335: warning: cyclomatic complexity 23 of function (*peerState).ResolveLocalAddress() is high (> 15) (gocyclo)
    • Line 2499: warning: cyclomatic complexity 21 of function (*server).rebroadcastHandler() is high (> 15) (gocyclo)
    • Line 2236: warning: cyclomatic complexity 18 of function (*server).peerHandler() is high (> 15) (gocyclo)
    • Line 972: warning: cyclomatic complexity 16 of function (*serverPeer).OnGetData() is high (> 15) (gocyclo)
    • hdfd/hdfd.go
    • Line 36: warning: cyclomatic complexity 26 of function hdfdMain() is high (> 15) (gocyclo)
    • hdfd/blockchain/upgrade.go
    • Line 443: warning: cyclomatic complexity 20 of function migrateBlockIndex() is high (> 15) (gocyclo)
    • Line 1167: warning: cyclomatic complexity 19 of function migrateBlockIndexVersion2To3() is high (> 15) (gocyclo)
    • Line 110: warning: cyclomatic complexity 18 of function upgradeToVersion2() is high (> 15) (gocyclo)
    • Line 960: warning: cyclomatic complexity 16 of function initializeGCSFilters() is high (> 15) (gocyclo)
    • hdfd/database/ffldb/interface_test.go
    • Line 1661: warning: cyclomatic complexity 39 of function testClosedTxInterface() is high (> 15) (gocyclo)
    • Line 883: warning: cyclomatic complexity 35 of function testMetadataTxInterface() is high (> 15) (gocyclo)
    • Line 1195: warning: cyclomatic complexity 35 of function testFetchBlockIO() is high (> 15) (gocyclo)
    • Line 380: warning: cyclomatic complexity 34 of function testBucketInterface() is high (> 15) (gocyclo)
    • Line 1485: warning: cyclomatic complexity 30 of function testBlockIOTxInterface() is high (> 15) (gocyclo)
    • Line 615: warning: cyclomatic complexity 29 of function testMetadataManualTxInterface() is high (> 15) (gocyclo)
    • Line 1969: warning: cyclomatic complexity 24 of function testConcurrecy() is high (> 15) (gocyclo)
    • Line 235: warning: cyclomatic complexity 21 of function testCursorInterface() is high (> 15) (gocyclo)
    • hdfd/blockchain/stake/tickets_test.go
    • Line 633: warning: cyclomatic complexity 55 of function TestTicketDBGeneral() is high (> 15) (gocyclo)
    • Line 253: warning: cyclomatic complexity 35 of function TestTicketDBLongChain() is high (> 15) (gocyclo)
    • Line 182: warning: cyclomatic complexity 25 of function nodesEqual() is high (> 15) (gocyclo)
    • hdfd/blockchain/difficulty.go
    • Line 736: warning: cyclomatic complexity 33 of function (*BlockChain).estimateNextStakeDifficultyV1() is high (> 15) (gocyclo)
    • Line 254: warning: cyclomatic complexity 29 of function (*BlockChain).calcNextRequiredStakeDifficultyV1() is high (> 15) (gocyclo)
    • Line 55: warning: cyclomatic complexity 16 of function (*BlockChain).calcNextRequiredDifficulty() is high (> 15) (gocyclo)
    • hdfd/connmgr/connmanager.go
    • Line 285: warning: cyclomatic complexity 25 of function (*ConnManager).connHandler() is high (> 15) (gocyclo)
    • Line 487: warning: cyclomatic complexity 17 of function (*ConnManager).Connect() is high (> 15) (gocyclo)
    • hdfd/txscript/sign.go
    • Line 185: warning: cyclomatic complexity 28 of function sign() is high (> 15) (gocyclo)
    • Line 319: warning: cyclomatic complexity 18 of function mergeMultiSig() is high (> 15) (gocyclo)
    • hdfd/blockmanager.go
    • Line 1814: warning: cyclomatic complexity 49 of function (*blockManager).handleBlockchainNotification() is high (> 15) (gocyclo)
    • Line 1420: warning: cyclomatic complexity 33 of function (*blockManager).handleInvMsg() is high (> 15) (gocyclo)
    • Line 1627: warning: cyclomatic complexity 27 of function (*blockManager).blockHandler() is high (> 15) (gocyclo)
    • Line 1016: warning: cyclomatic complexity 27 of function (*blockManager).handleBlockMsg() is high (> 15) (gocyclo)
    • Line 2296: warning: cyclomatic complexity 16 of function (*blockManager).requestFromPeer() is high (> 15) (gocyclo)
    • hdfd/wire/common.go
    • Line 198: warning: cyclomatic complexity 40 of function readElement() is high (> 15) (gocyclo)
    • Line 376: warning: cyclomatic complexity 28 of function writeElement() is high (> 15) (gocyclo)
    • hdfd/blockchain/stake/staketx_test.go
    • Line 330: warning: cyclomatic complexity 44 of function TestSSGenErrors() is high (> 15) (gocyclo)
    • Line 70: warning: cyclomatic complexity 32 of function TestSSTxErrors() is high (> 15) (gocyclo)
    • Line 669: warning: cyclomatic complexity 19 of function TestIsSSRtxErrors() is high (> 15) (gocyclo)
    • hdfd/txscript/opcode.go
    • Line 2553: warning: cyclomatic complexity 30 of function opcodeCheckMultiSig() is high (> 15) (gocyclo)
    • Line 2751: warning: cyclomatic complexity 26 of function opcodeCheckSigAlt() is high (> 15) (gocyclo)
    • hdfd/config.go
    • Line 544: warning: cyclomatic complexity 126 of function loadConfig() is high (> 15) (gocyclo)
    • hdfd/txscript/reference_test.go
    • Line 254: warning: cyclomatic complexity 51 of function parseExpectedResult() is high (> 15) (gocyclo)
    • Line 101: warning: cyclomatic complexity 29 of function parseShortForm() is high (> 15) (gocyclo)
    • Line 518: warning: cyclomatic complexity 23 of function TestTxInvalidTests() is high (> 15) (gocyclo)
    • Line 660: warning: cyclomatic complexity 23 of function TestTxValidTests() is high (> 15) (gocyclo)
    • Line 817: warning: cyclomatic complexity 21 of function TestCalcSignatureHashReference() is high (> 15) (gocyclo)
    • Line 389: warning: cyclomatic complexity 16 of function testScripts() is high (> 15) (gocyclo)
    • hdfd/txscript/engine.go
    • Line 471: warning: cyclomatic complexity 18 of function (*Engine).Step() is high (> 15) (gocyclo)
    • Line 689: warning: cyclomatic complexity 16 of function NewEngine() is high (> 15) (gocyclo)
    • Line 252: warning: cyclomatic complexity 16 of function checkMinimalDataPush() is high (> 15) (gocyclo)
    • hdfd/blockchain/validate.go
    • Line 2901: warning: cyclomatic complexity 40 of function (*BlockChain).checkConnectBlock() is high (> 15) (gocyclo)
    • Line 2120: warning: cyclomatic complexity 38 of function CheckTransactionInputs() is high (> 15) (gocyclo)
    • Line 584: warning: cyclomatic complexity 36 of function checkBlockSanity() is high (> 15) (gocyclo)
    • Line 219: warning: cyclomatic complexity 31 of function CheckTransactionSanity() is high (> 15) (gocyclo)
    • Line 868: warning: cyclomatic complexity 24 of function (*BlockChain).checkBlockHeaderPositional() is high (> 15) (gocyclo)
    • Line 2717: warning: cyclomatic complexity 21 of function (*BlockChain).checkTransactionsAndConnect() is high (> 15) (gocyclo)
    • Line 1358: warning: cyclomatic complexity 17 of function (*BlockChain).checkBlockContext() is high (> 15) (gocyclo)
    • hdfd/addrmgr/addrmanager.go
    • Line 1088: warning: cyclomatic complexity 20 of function getReachabilityFrom() is high (> 15) (gocyclo)
    • Line 465: warning: cyclomatic complexity 20 of function (*AddrManager).deserializePeers() is high (> 15) (gocyclo)
    • hdfd/blockchain/stake/tickets.go
    • Line 702: warning: cyclomatic complexity 27 of function disconnectNode() is high (> 15) (gocyclo)
    • Line 964: warning: cyclomatic complexity 26 of function WriteDisconnectedBestNode() is high (> 15) (gocyclo)
    • Line 474: warning: cyclomatic complexity 25 of function connectNode() is high (> 15) (gocyclo)
    • Line 859: warning: cyclomatic complexity 21 of function WriteConnectedBestNode() is high (> 15) (gocyclo)
    • Line 312: warning: cyclomatic complexity 18 of function LoadBestNode() is high (> 15) (gocyclo)
    • hdfd/internal/rpcserver/rpcserver.go
    • Line 3887: warning: cyclomatic complexity 40 of function handleSearchRawTransactions() is high (> 15) (gocyclo)
    • Line 5279: warning: cyclomatic complexity 37 of function (*Server).jsonRPCRead() is high (> 15) (gocyclo)
    • Line 733: warning: cyclomatic complexity 35 of function handleCreateRawSStx() is high (> 15) (gocyclo)
    • Line 623: warning: cyclomatic complexity 26 of function handleCreateRawTransaction() is high (> 15) (gocyclo)
    • Line 924: warning: cyclomatic complexity 22 of function handleCreateRawSSRtx() is high (> 15) (gocyclo)
    • Line 518: warning: cyclomatic complexity 19 of function handleNode() is high (> 15) (gocyclo)
    • Line 3727: warning: cyclomatic complexity 18 of function createVinListPrevOut() is high (> 15) (gocyclo)
    • Line 1816: warning: cyclomatic complexity 18 of function handleGetBlock() is high (> 15) (gocyclo)
    • Line 2642: warning: cyclomatic complexity 17 of function handleGetRawMempool() is high (> 15) (gocyclo)
    • Line 2717: warning: cyclomatic complexity 16 of function handleGetRawTransaction() is high (> 15) (gocyclo)

golint99%

Golint is a linter for Go source code.

    • hdfd/txscript/opcode.go
    • Line 49: warning: don't use underscores in Go names; const OP_0 should be OP0 (golint)
    • Line 131: warning: don't use underscores in Go names; const OP_1 should be OP1 (golint)
    • Line 133: warning: don't use underscores in Go names; const OP_2 should be OP2 (golint)
    • Line 134: warning: don't use underscores in Go names; const OP_3 should be OP3 (golint)
    • Line 135: warning: don't use underscores in Go names; const OP_4 should be OP4 (golint)
    • Line 136: warning: don't use underscores in Go names; const OP_5 should be OP5 (golint)
    • Line 137: warning: don't use underscores in Go names; const OP_6 should be OP6 (golint)
    • Line 138: warning: don't use underscores in Go names; const OP_7 should be OP7 (golint)
    • Line 139: warning: don't use underscores in Go names; const OP_8 should be OP8 (golint)
    • Line 140: warning: don't use underscores in Go names; const OP_9 should be OP9 (golint)
    • hdfd/dcrec/secp256k1/pubkey.go
    • Line 27: warning: comment on exported const PubKeyBytesLenUncompressed should be of the form "PubKeyBytesLenUncompressed ..." (golint)
    • Line 55: warning: comment on exported const PubKeyFormatHybridOdd should be of the form "PubKeyFormatHybridOdd ..." (golint)

license100%

Checks whether your project has a LICENSE file.

No problems detected. Good job!


ineffassign100%

IneffAssign detects ineffectual assignments in Go code.

No problems detected. Good job!


misspell99%

Misspell Finds commonly misspelled English words