Preparing report...

Report for github.com/picfight/pfcd

A+    Excellent!    Found 90 issues across 450 files

Tweet

gofmt98%

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!


gocyclo81%

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.

    • pfcd/server.go
    • Line 2320: warning: cyclomatic complexity 56 of function newServer() is high (> 15) (gocyclo)
    • Line 1973: warning: cyclomatic complexity 22 of function (*server).rebroadcastHandler() is high (> 15) (gocyclo)
    • Line 1496: warning: cyclomatic complexity 21 of function (*server).handleQuery() is high (> 15) (gocyclo)
    • Line 1719: warning: cyclomatic complexity 19 of function (*server).peerHandler() is high (> 15) (gocyclo)
    • pfcd/config.go
    • Line 433: warning: cyclomatic complexity 123 of function loadConfig() is high (> 15) (gocyclo)
    • pfcd/wire/common.go
    • Line 192: warning: cyclomatic complexity 40 of function readElement() is high (> 15) (gocyclo)
    • Line 370: warning: cyclomatic complexity 28 of function writeElement() is high (> 15) (gocyclo)
    • pfcd/addrmgr/addrmanager.go
    • Line 461: warning: cyclomatic complexity 20 of function (*AddrManager).deserializePeers() is high (> 15) (gocyclo)
    • Line 1022: warning: cyclomatic complexity 20 of function getReachabilityFrom() is high (> 15) (gocyclo)
    • pfcd/blockchain/stake/tickets.go
    • Line 680: warning: cyclomatic complexity 27 of function disconnectNode() is high (> 15) (gocyclo)
    • Line 942: warning: cyclomatic complexity 26 of function WriteDisconnectedBestNode() is high (> 15) (gocyclo)
    • Line 452: warning: cyclomatic complexity 25 of function connectNode() is high (> 15) (gocyclo)
    • Line 837: warning: cyclomatic complexity 21 of function WriteConnectedBestNode() is high (> 15) (gocyclo)
    • Line 290: warning: cyclomatic complexity 18 of function LoadBestNode() is high (> 15) (gocyclo)
    • pfcd/txscript/standard.go
    • Line 1108: warning: cyclomatic complexity 30 of function ExtractPkScriptAddrs() is high (> 15) (gocyclo)
    • Line 1360: warning: cyclomatic complexity 29 of function ExtractAtomicSwapDataPushes() is high (> 15) (gocyclo)
    • Line 1277: warning: cyclomatic complexity 18 of function extractOneBytePush() is high (> 15) (gocyclo)
    • Line 87: warning: cyclomatic complexity 17 of function isOneByteMaxDataPush() is high (> 15) (gocyclo)
    • pfcd/blockchain/validate.go
    • Line 2091: warning: cyclomatic complexity 38 of function CheckTransactionInputs() is high (> 15) (gocyclo)
    • Line 606: warning: cyclomatic complexity 38 of function checkBlockSanity() is high (> 15) (gocyclo)
    • Line 2870: warning: cyclomatic complexity 35 of function (*BlockChain).checkConnectBlock() is high (> 15) (gocyclo)
    • Line 240: warning: cyclomatic complexity 31 of function CheckTransactionSanity() is high (> 15) (gocyclo)
    • Line 915: warning: cyclomatic complexity 27 of function (*BlockChain).checkBlockHeaderPositional() is high (> 15) (gocyclo)
    • Line 2690: warning: cyclomatic complexity 21 of function (*BlockChain).checkTransactionsAndConnect() is high (> 15) (gocyclo)
    • Line 1335: warning: cyclomatic complexity 16 of function (*BlockChain).checkBlockContext() is high (> 15) (gocyclo)
    • pfcd/txscript/sign.go
    • Line 229: warning: cyclomatic complexity 28 of function sign() is high (> 15) (gocyclo)
    • Line 427: warning: cyclomatic complexity 18 of function mergeMultiSig() is high (> 15) (gocyclo)
    • pfcd/blockchain/stake/tickets_test.go
    • Line 589: warning: cyclomatic complexity 55 of function TestTicketDBGeneral() is high (> 15) (gocyclo)
    • Line 209: warning: cyclomatic complexity 35 of function TestTicketDBLongChain() is high (> 15) (gocyclo)
    • Line 138: warning: cyclomatic complexity 25 of function nodesEqual() is high (> 15) (gocyclo)
    • pfcd/pfcd.go
    • Line 33: warning: cyclomatic complexity 27 of function pfcdMain() is high (> 15) (gocyclo)
    • pfcd/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 819: warning: cyclomatic complexity 24 of function TestCalcSignatureHashReference() is high (> 15) (gocyclo)
    • Line 661: warning: cyclomatic complexity 23 of function TestTxValidTests() is high (> 15) (gocyclo)
    • Line 517: warning: cyclomatic complexity 23 of function TestTxInvalidTests() is high (> 15) (gocyclo)
    • Line 389: warning: cyclomatic complexity 16 of function testScripts() is high (> 15) (gocyclo)
    • pfcd/blockchain/upgrade.go
    • Line 250: warning: cyclomatic complexity 20 of function migrateBlockIndex() is high (> 15) (gocyclo)
    • Line 112: warning: cyclomatic complexity 18 of function upgradeToVersion2() is high (> 15) (gocyclo)
    • pfcd/database/ffldb/interface_test.go
    • Line 1662: 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 1486: 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 1970: warning: cyclomatic complexity 24 of function testConcurrecy() is high (> 15) (gocyclo)
    • Line 235: warning: cyclomatic complexity 21 of function testCursorInterface() is high (> 15) (gocyclo)
    • pfcd/blockchain/validate_test.go
    • Line 252: warning: cyclomatic complexity 34 of function TestLegacySequenceLocks() is high (> 15) (gocyclo)
    • Line 944: warning: cyclomatic complexity 29 of function TestCheckConnectBlockTemplate() is high (> 15) (gocyclo)
    • pfcd/rpcserver.go
    • Line 6085: warning: cyclomatic complexity 40 of function (*rpcServer).jsonRPCRead() is high (> 15) (gocyclo)
    • Line 4734: warning: cyclomatic complexity 40 of function handleSearchRawTransactions() is high (> 15) (gocyclo)
    • Line 738: warning: cyclomatic complexity 39 of function handleCreateRawSStx() is high (> 15) (gocyclo)
    • Line 2837: warning: cyclomatic complexity 37 of function chainErrToGBTErrString() is high (> 15) (gocyclo)
    • Line 622: warning: cyclomatic complexity 27 of function handleCreateRawTransaction() is high (> 15) (gocyclo)
    • Line 2436: warning: cyclomatic complexity 26 of function (*gbtWorkState).blockTemplateResult() is high (> 15) (gocyclo)
    • Line 947: warning: cyclomatic complexity 25 of function handleCreateRawSSRtx() is high (> 15) (gocyclo)
    • Line 519: warning: cyclomatic complexity 19 of function handleNode() is high (> 15) (gocyclo)
    • Line 1807: warning: cyclomatic complexity 18 of function handleGetBlock() is high (> 15) (gocyclo)
    • Line 4574: warning: cyclomatic complexity 18 of function createVinListPrevOut() is high (> 15) (gocyclo)
    • Line 6413: warning: cyclomatic complexity 17 of function newRPCServer() is high (> 15) (gocyclo)
    • Line 4009: warning: cyclomatic complexity 16 of function handleGetWorkRequest() is high (> 15) (gocyclo)
    • Line 2757: warning: cyclomatic complexity 16 of function handleGetBlockTemplateRequest() is high (> 15) (gocyclo)
    • Line 3460: warning: cyclomatic complexity 16 of function handleGetRawTransaction() is high (> 15) (gocyclo)
    • pfcd/txscript/engine.go
    • Line 418: warning: cyclomatic complexity 21 of function (*Engine).checkSignatureEncoding() is high (> 15) (gocyclo)
    • Line 266: warning: cyclomatic complexity 16 of function (*Engine).Step() is high (> 15) (gocyclo)
    • pfcd/blockmanager.go
    • Line 1692: warning: cyclomatic complexity 43 of function (*blockManager).handleNotifyMsg() is high (> 15) (gocyclo)
    • Line 859: warning: cyclomatic complexity 32 of function (*blockManager).handleBlockMsg() is high (> 15) (gocyclo)
    • Line 1281: warning: cyclomatic complexity 32 of function (*blockManager).handleInvMsg() is high (> 15) (gocyclo)
    • Line 1478: warning: cyclomatic complexity 31 of function (*blockManager).blockHandler() is high (> 15) (gocyclo)
    • Line 690: warning: cyclomatic complexity 26 of function (*blockManager).checkBlockForHiddenVotes() is high (> 15) (gocyclo)
    • pfcd/peer/peer.go
    • Line 1250: warning: cyclomatic complexity 57 of function (*Peer).inHandler() is high (> 15) (gocyclo)
    • Line 1101: warning: cyclomatic complexity 26 of function (*Peer).stallHandler() is high (> 15) (gocyclo)
    • Line 1464: warning: cyclomatic complexity 23 of function (*Peer).queueHandler() is high (> 15) (gocyclo)
    • pfcd/mining.go
    • Line 1093: warning: cyclomatic complexity 130 of function (*BlkTmplGenerator).NewBlockTemplate() is high (> 15) (gocyclo)
    • Line 757: warning: cyclomatic complexity 20 of function handleTooFewVoters() is high (> 15) (gocyclo)
    • pfcd/blockchain/difficulty.go
    • Line 964: warning: cyclomatic complexity 33 of function (*BlockChain).estimateNextStakeDifficultyV1() is high (> 15) (gocyclo)
    • Line 438: warning: cyclomatic complexity 29 of function (*BlockChain).calcNextRequiredStakeDifficultyV1() is high (> 15) (gocyclo)
    • Line 231: warning: cyclomatic complexity 16 of function (*BlockChain).calcNextRequiredDifficulty() is high (> 15) (gocyclo)
    • pfcd/blockchain/chainio.go
    • Line 1528: warning: cyclomatic complexity 33 of function (*BlockChain).initChainState() is high (> 15) (gocyclo)
    • Line 994: warning: cyclomatic complexity 17 of function deserializeUtxoEntry() is high (> 15) (gocyclo)
    • pfcd/blockchain/chain.go
    • Line 1068: warning: cyclomatic complexity 27 of function (*BlockChain).reorganizeChainInternal() is high (> 15) (gocyclo)
    • Line 712: warning: cyclomatic complexity 16 of function (*BlockChain).connectBlock() is high (> 15) (gocyclo)
    • Line 1424: warning: cyclomatic complexity 16 of function (*BlockChain).connectBestChain() is high (> 15) (gocyclo)
    • pfcd/gcs/bits.go
    • Line 126: warning: cyclomatic complexity 16 of function (*bitReader).readNBits() is high (> 15) (gocyclo)
    • pfcd/txscript/opcode.go
    • Line 2700: warning: cyclomatic complexity 30 of function opcodeCheckMultiSig() is high (> 15) (gocyclo)
    • Line 2899: warning: cyclomatic complexity 26 of function opcodeCheckSigAlt() is high (> 15) (gocyclo)
    • Line 682: warning: cyclomatic complexity 16 of function (*parsedOpcode).checkMinimalDataPush() is high (> 15) (gocyclo)
    • pfcd/blockchain/agendas_test.go
    • Line 338: warning: cyclomatic complexity 31 of function TestFixedSequenceLocks() is high (> 15) (gocyclo)
    • Line 24: warning: cyclomatic complexity 17 of function testLNFeaturesDeployment() is high (> 15) (gocyclo)
    • pfcd/rpcwebsocket.go
    • Line 1213: warning: cyclomatic complexity 84 of function (*wsClient).inHandler() is high (> 15) (gocyclo)
    • Line 483: warning: cyclomatic complexity 33 of function (*wsNotificationManager).notificationHandler() is high (> 15) (gocyclo)

golint99%

Golint is a linter for Go source code.

    • pfcd/chaincfg/premine.go
    • Line 12: warning: exported function BlockOneLedgerPicfightCoin should have comment or be unexported (golint)
    • Line 24: warning: exported var BlockOneLedgerDecredMainNet should have comment or be unexported (golint)
    • pfcd/chaincfg/premine_test.go
    • Line 68: warning: don't use underscores in Go names; var block1_subsidy should be block1Subsidy (golint)
    • Line 72: warning: don't use underscores in Go names; var block1_spremined should be block1Spremined (golint)
    • Line 87: warning: don't use underscores in Go names; var block1_subsidy should be block1Subsidy (golint)
    • Line 91: warning: don't use underscores in Go names; var block1_spremined should be block1Spremined (golint)
    • pfcd/txscript/opcode.go
    • Line 44: warning: don't use underscores in Go names; const OP_0 should be OP0 (golint)
    • Line 126: warning: don't use underscores in Go names; const OP_1 should be OP1 (golint)
    • Line 128: warning: don't use underscores in Go names; const OP_2 should be OP2 (golint)
    • Line 129: warning: don't use underscores in Go names; const OP_3 should be OP3 (golint)
    • Line 130: warning: don't use underscores in Go names; const OP_4 should be OP4 (golint)
    • Line 131: warning: don't use underscores in Go names; const OP_5 should be OP5 (golint)
    • Line 132: warning: don't use underscores in Go names; const OP_6 should be OP6 (golint)
    • Line 133: warning: don't use underscores in Go names; const OP_7 should be OP7 (golint)
    • Line 134: warning: don't use underscores in Go names; const OP_8 should be OP8 (golint)
    • Line 135: warning: don't use underscores in Go names; const OP_9 should be OP9 (golint)

license100%

Checks whether your project has a LICENSE file.

No problems detected. Good job!


ineffassign99%

IneffAssign detects ineffectual assignments in Go code.


misspell100%

Misspell Finds commonly misspelled English words

No problems detected. Good job!