Preparing report...

Report for github.com/decred/dcrdata

(v2.1.3+incompatible)

A+    Excellent!    Found 43 issues across 91 files

Tweet

gofmt94%

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!


gocyclo73%

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.

    • db/dcrpg/pgblockchain.go
    • Line 1285: warning: cyclomatic complexity 42 of function (*ChainDB).storeTxns() is high (> 15) (gocyclo)
    • Line 1123: warning: cyclomatic complexity 18 of function (*ChainDB).StoreBlock() is high (> 15) (gocyclo)
    • db/dcrpg/sync.go
    • Line 48: warning: cyclomatic complexity 36 of function (*ChainDB).SyncChainDB() is high (> 15) (gocyclo)
    • db/dcrsqlite/apisource.go
    • Line 1098: warning: cyclomatic complexity 21 of function (*wiredDB).GetExplorerTx() is high (> 15) (gocyclo)
    • Line 1217: warning: cyclomatic complexity 20 of function (*wiredDB).GetExplorerAddress() is high (> 15) (gocyclo)
    • mempool/mempool.go
    • Line 113: warning: cyclomatic complexity 19 of function (*mempoolMonitor).TxHandler() is high (> 15) (gocyclo)
    • api/insight/apiroutes.go
    • Line 854: warning: cyclomatic complexity 31 of function (*insightApiContext).getAddressInfo() is high (> 15) (gocyclo)
    • Line 392: warning: cyclomatic complexity 24 of function (*insightApiContext).getTransactions() is high (> 15) (gocyclo)
    • Line 521: warning: cyclomatic complexity 23 of function (*insightApiContext).getAddressesTxn() is high (> 15) (gocyclo)
    • Line 299: warning: cyclomatic complexity 19 of function (*insightApiContext).getAddressesTxnOutput() is high (> 15) (gocyclo)
    • explorer/mempool.go
    • Line 19: warning: cyclomatic complexity 16 of function (*explorerUI).mempoolMonitor() is high (> 15) (gocyclo)
    • main.go
    • Line 46: warning: cyclomatic complexity 59 of function mainCore() is high (> 15) (gocyclo)
    • explorer/explorerroutes.go
    • Line 346: warning: cyclomatic complexity 41 of function (*explorerUI).AddressPage() is high (> 15) (gocyclo)
    • Line 196: warning: cyclomatic complexity 24 of function (*explorerUI).TxPage() is high (> 15) (gocyclo)
    • config.go
    • Line 268: warning: cyclomatic complexity 32 of function loadConfig() is high (> 15) (gocyclo)

golint75%

Golint is a linter for Go source code.

    • db/dcrpg/pgblockchain.go
    • Line 785: warning: comment on exported method ChainDB.AddressTransactionRawDetails should be of the form "AddressTransactionRawDetails ..." (golint)
    • Line 824: warning: exported method ChainDB.DeleteDuplicates should have comment or be unexported (golint)
    • Line 856: warning: exported method ChainDB.DeleteDuplicatesRecovery should have comment or be unexported (golint)
    • Line 909: warning: exported method ChainDB.DeleteDuplicateVins should have comment or be unexported (golint)
    • Line 913: warning: exported method ChainDB.DeleteDuplicateVouts should have comment or be unexported (golint)
    • Line 917: warning: exported method ChainDB.DeleteDuplicateTxns should have comment or be unexported (golint)
    • Line 921: warning: exported method ChainDB.DeleteDuplicateTickets should have comment or be unexported (golint)
    • Line 925: warning: exported method ChainDB.DeleteDuplicateVotes should have comment or be unexported (golint)
    • Line 929: warning: exported method ChainDB.DeleteDuplicateMisses should have comment or be unexported (golint)
    • Line 1109: warning: exported method ChainDB.ExistsIndexVinOnVins should have comment or be unexported (golint)
    • Line 1113: warning: exported method ChainDB.ExistsIndexVoutOnTxHashIdx should have comment or be unexported (golint)
    • Line 1117: warning: exported method ChainDB.ExistsIndexAddressesVoutIDAddress should have comment or be unexported (golint)
    • Line 1565: warning: exported method ChainDB.CollectTicketSpendDBInfo should have comment or be unexported (golint)
    • db/dcrpg/internal/addrstmts.go
    • Line 7: warning: exported const InsertAddressRow should have comment (or a comment on this block) or be unexported (golint)
    • Line 8: warning: comment on exported const UpsertAddressRow should be of the form "UpsertAddressRow ..." (golint)
    • Line 100: warning: comment on exported const SelectAddressIDsByFundingOutpoint should be of the form "SelectAddressIDsByFundingOutpoint ..." (golint)
    • Line 129: warning: exported function MakeAddressRowInsertStatement should have comment or be unexported (golint)
    • db/dcrpg/internal/stakestmts.go
    • Line 6: warning: exported const CreateTicketsTable should have comment (or a comment on this block) or be unexported (golint)
    • Line 59: warning: comment on exported const SetTicketSpendingInfoForHash should be of the form "SetTicketSpendingInfoForHash ..." (golint)
    • Line 72: warning: comment on exported const IndexTicketsTableOnHashes should be of the form "IndexTicketsTableOnHashes ..." (golint)
    • Line 135: warning: comment on exported const IndexVotesTableOnHashes should be of the form "IndexVotesTableOnHashes ..." (golint)
    • Line 188: warning: comment on exported const IndexMissesTableOnHashes should be of the form "IndexMissesTableOnHashes ..." (golint)
    • Line 203: warning: exported function MakeTicketInsertStatement should have comment or be unexported (golint)
    • Line 210: warning: exported function MakeVoteInsertStatement should have comment or be unexported (golint)
    • Line 217: warning: exported function MakeMissInsertStatement should have comment or be unexported (golint)
    • db/dcrpg/internal/txstmts.go
    • Line 37: warning: exported const CreateTransactionTable should have comment (or a comment on this block) or be unexported (golint)
    • Line 108: warning: exported var SelectAllRevokes should have comment or be unexported (golint)
    • Line 124: warning: exported function MakeTxInsertStatement should have comment or be unexported (golint)
    • api/types/insightapitypes.go
    • Line 54: warning: exported type InsightMultiAddrsTxOutput should have comment or be unexported (golint)
    • Line 98: warning: exported type InsightTx should have comment or be unexported (golint)
    • Line 116: warning: exported type InsightVin should have comment or be unexported (golint)
    • Line 128: warning: exported type InsightScriptSig should have comment or be unexported (golint)
    • Line 133: warning: exported type InsightVout should have comment or be unexported (golint)
    • Line 142: warning: exported type InsightScriptPubKey should have comment or be unexported (golint)
    • db/dcrpg/queries.go
    • Line 23: warning: exported function ExistsIndex should have comment or be unexported (golint)
    • Line 31: warning: exported function IsUniqueIndex should have comment or be unexported (golint)
    • Line 36: warning: exported function RetrievePkScriptByID should have comment or be unexported (golint)
    • Line 41: warning: exported function RetrieveVoutIDByOutpoint should have comment or be unexported (golint)
    • Line 46: warning: exported function RetrieveMissedVotesInBlock should have comment or be unexported (golint)
    • Line 69: warning: exported function RetrieveAllRevokesDbIDHashHeight should have comment or be unexported (golint)
    • Line 98: warning: exported function RetrieveAllVotesDbIDsHeightsTicketDbIDs should have comment or be unexported (golint)
    • Line 153: warning: exported function RetrieveUnspentTickets should have comment or be unexported (golint)
    • Line 179: warning: exported function RetrieveTicketIDHeightByHash should have comment or be unexported (golint)
    • Line 184: warning: exported function RetrieveTicketIDByHash should have comment or be unexported (golint)
    • Line 189: warning: exported function RetrieveTicketStatusByHash should have comment or be unexported (golint)
    • Line 189: warning: don't use underscores in Go names; func result spend_status should be spendStatus (golint)
    • Line 190: warning: don't use underscores in Go names; func result pool_status should be poolStatus (golint)
    • Line 195: warning: exported function RetrieveTicketIDsByHashes should have comment or be unexported (golint)
    • Line 229: warning: exported function SetPoolStatusForTickets should have comment or be unexported (golint)
    • Line 268: warning: exported function SetPoolStatusForTicketsByHash should have comment or be unexported (golint)
    • Line 307: warning: exported function SetSpendingForTickets should have comment or be unexported (golint)
    • Line 369: warning: exported function SetSpendingForVinDbIDs should have comment or be unexported (golint)
    • Line 451: warning: exported function SetSpendingForVinDbID should have comment or be unexported (golint)
    • Line 496: warning: exported function SetSpendingForFundingOP should have comment or be unexported (golint)
    • Line 689: warning: exported function SetSpendingForAddressDbID should have comment or be unexported (golint)
    • Line 696: warning: exported function RetrieveAddressRecvCount should have comment or be unexported (golint)
    • Line 701: warning: exported function RetrieveAddressUnspent should have comment or be unexported (golint)
    • Line 707: warning: exported function RetrieveAddressSpent should have comment or be unexported (golint)
    • Line 713: warning: exported function RetrieveAddressSpentUnspent should have comment or be unexported (golint)
    • Line 749: warning: exported function RetrieveAllAddressTxns should have comment or be unexported (golint)
    • Line 763: warning: exported function RetrieveAddressTxns should have comment or be unexported (golint)
    • Line 768: warning: exported function RetrieveAddressTxnsAlt should have comment or be unexported (golint)
    • Line 773: warning: exported function RetrieveAddressDebitTxns should have comment or be unexported (golint)
    • Line 825: warning: exported function RetrieveAddressCreditTxns should have comment or be unexported (golint)
    • Line 884: warning: exported function RetrieveAllVinDbIDs should have comment or be unexported (golint)
    • Line 908: warning: exported function RetrieveSpendingTxByVinID should have comment or be unexported (golint)
    • Line 914: warning: exported function RetrieveFundingOutpointByTxIn should have comment or be unexported (golint)
    • Line 921: warning: exported function RetrieveFundingOutpointByVinID should have comment or be unexported (golint)
    • Line 927: warning: exported function RetrieveVinByID should have comment or be unexported (golint)
    • Line 936: warning: exported function RetrieveFundingTxByTxIn should have comment or be unexported (golint)
    • Line 942: warning: exported function RetrieveFundingTxByVinDbID should have comment or be unexported (golint)
    • Line 947: warning: exported function RetrieveFundingTxsByTx should have comment or be unexported (golint)
    • Line 975: warning: exported function RetrieveSpendingTxByTxOut should have comment or be unexported (golint)
    • Line 982: warning: exported function RetrieveSpendingTxsByFundingTx should have comment or be unexported (golint)
    • Line 1012: warning: exported function RetrieveDbTxByHash should have comment or be unexported (golint)
    • Line 1024: warning: exported function RetrieveFullTxByHash should have comment or be unexported (golint)
    • Line 1038: warning: exported function RetrieveTxByHash should have comment or be unexported (golint)
    • Line 1043: warning: exported function RetrieveTxIDHeightByHash should have comment or be unexported (golint)
    • Line 1048: warning: exported function RetrieveRegularTxByHash should have comment or be unexported (golint)
    • Line 1053: warning: exported function RetrieveStakeTxByHash should have comment or be unexported (golint)
    • Line 1058: warning: exported function RetrieveTxsByBlockHash should have comment or be unexported (golint)
    • Line 1117: warning: exported function RetrieveAddressTxnOutputWithTransaction should have comment or be unexported (golint)
    • Line 1159: warning: don't use underscores in Go names; var tx_hash should be txHash (golint)
    • Line 1187: warning: comment on exported function RetrieveAddressTxnsByFundingTx should be of the form "RetrieveAddressTxnsByFundingTx ..." (golint)
    • Line 1217: warning: exported function RetrieveBlockSummaryByTimeRange should have comment or be unexported (golint)
    • Line 1258: warning: exported function InsertBlock should have comment or be unexported (golint)
    • Line 1287: warning: exported function RetrieveBestBlockHeight should have comment or be unexported (golint)
    • Line 1292: warning: exported function RetrieveVoutValue should have comment or be unexported (golint)
    • Line 1297: warning: exported function RetrieveVoutValues should have comment or be unexported (golint)
    • Line 1326: warning: exported function InsertBlockPrevNext should have comment or be unexported (golint)
    • Line 1335: warning: exported function UpdateBlockNext should have comment or be unexported (golint)
    • Line 1350: warning: exported function InsertVin should have comment or be unexported (golint)
    • Line 1357: warning: exported function InsertVins should have comment or be unexported (golint)
    • Line 1393: warning: exported function InsertVout should have comment or be unexported (golint)
    • Line 1405: warning: exported function InsertVouts should have comment or be unexported (golint)
    • Line 1466: warning: exported function InsertAddressOuts should have comment or be unexported (golint)
    • Line 1740: warning: exported function InsertTx should have comment or be unexported (golint)
    • Line 1752: warning: exported function InsertTxns should have comment or be unexported (golint)
    • db/dcrpg/tables.go
    • Line 94: warning: exported function TableExists should have comment or be unexported (golint)
    • Line 108: warning: exported function DropTables should have comment or be unexported (golint)
    • Line 127: warning: exported function CreateTypes should have comment or be unexported (golint)
    • Line 154: warning: exported function TypeExists should have comment or be unexported (golint)
    • Line 168: warning: exported function CreateTables should have comment or be unexported (golint)
    • Line 236: warning: exported function TableUpgradesRequired should have comment or be unexported (golint)
    • Line 271: warning: exported function TableVersions should have comment or be unexported (golint)
    • Line 311: warning: exported function IndexVinTableOnVins should have comment or be unexported (golint)
    • Line 316: warning: exported function IndexVinTableOnPrevOuts should have comment or be unexported (golint)
    • Line 321: warning: exported function DeindexVinTableOnVins should have comment or be unexported (golint)
    • Line 326: warning: exported function DeindexVinTableOnPrevOuts should have comment or be unexported (golint)
    • Line 333: warning: exported function IndexTransactionTableOnHashes should have comment or be unexported (golint)
    • Line 338: warning: exported function DeindexTransactionTableOnHashes should have comment or be unexported (golint)
    • Line 343: warning: exported function IndexTransactionTableOnBlockIn should have comment or be unexported (golint)
    • Line 348: warning: exported function DeindexTransactionTableOnBlockIn should have comment or be unexported (golint)
    • Line 355: warning: exported function IndexBlockTableOnHash should have comment or be unexported (golint)
    • Line 360: warning: exported function DeindexBlockTableOnHash should have comment or be unexported (golint)
    • Line 372: warning: exported function IndexVoutTableOnTxHashIdx should have comment or be unexported (golint)
    • Line 382: warning: exported function DeindexVoutTableOnTxHashIdx should have comment or be unexported (golint)
    • Line 389: warning: exported function IndexAddressTableOnAddress should have comment or be unexported (golint)
    • Line 394: warning: exported function DeindexAddressTableOnAddress should have comment or be unexported (golint)
    • Line 399: warning: exported function IndexAddressTableOnVoutID should have comment or be unexported (golint)
    • Line 404: warning: exported function DeindexAddressTableOnVoutID should have comment or be unexported (golint)
    • Line 409: warning: exported function IndexAddressTableOnTxHash should have comment or be unexported (golint)
    • Line 414: warning: exported function DeindexAddressTableOnTxHash should have comment or be unexported (golint)
    • Line 421: warning: exported function IndexVotesTableOnHashes should have comment or be unexported (golint)
    • Line 426: warning: exported function DeindexVotesTableOnHash should have comment or be unexported (golint)
    • Line 431: warning: exported function IndexVotesTableOnCandidate should have comment or be unexported (golint)
    • Line 436: warning: exported function DeindexVotesTableOnCandidate should have comment or be unexported (golint)
    • Line 441: warning: exported function IndexVotesTableOnVoteVersion should have comment or be unexported (golint)
    • Line 446: warning: exported function DeindexVotesTableOnVoteVersion should have comment or be unexported (golint)
    • Line 453: warning: exported function IndexTicketsTableOnHashes should have comment or be unexported (golint)
    • Line 458: warning: exported function DeindexTicketsTableOnHash should have comment or be unexported (golint)
    • Line 463: warning: exported function IndexTicketsTableOnTxDbID should have comment or be unexported (golint)
    • Line 468: warning: exported function DeindexTicketsTableOnTxDbID should have comment or be unexported (golint)
    • Line 475: warning: exported function IndexMissesTableOnHashes should have comment or be unexported (golint)
    • Line 480: warning: exported function DeindexMissesTableOnHash should have comment or be unexported (golint)
    • db/dbtypes/types.go
    • Line 18: warning: exported type TicketSpendType should have comment or be unexported (golint)
    • Line 21: warning: exported const TicketUnspent should have comment (or a comment on this block) or be unexported (golint)
    • Line 44: warning: exported const AddrTxnAll should have comment (or a comment on this block) or be unexported (golint)
    • Line 82: warning: exported type TicketPoolStatus should have comment or be unexported (golint)
    • Line 85: warning: exported const PoolStatusLive should have comment (or a comment on this block) or be unexported (golint)
    • Line 366: warning: exported type BlockDataBasic should have comment or be unexported (golint)
    • explorer/explorertypes.go
    • Line 92: warning: exported method TxInfo.IsTicket should have comment or be unexported (golint)
    • Line 96: warning: exported method TxInfo.IsVote should have comment or be unexported (golint)
    • db/dcrpg/internal/vinoutstmts.go
    • Line 14: warning: exported const CreateVinTable should have comment (or a comment on this block) or be unexported (golint)
    • Line 27: warning: comment on exported const UpsertVinRow should be of the form "UpsertVinRow ..." (golint)
    • Line 138: warning: exported function MakeVinInsertStatement should have comment or be unexported (golint)
    • Line 153: warning: exported function MakeVoutCopyInStatement should have comment or be unexported (golint)
    • Line 157: warning: exported function MakeVinCopyInStatement should have comment or be unexported (golint)
    • Line 161: warning: exported function MakeVoutInsertStatement should have comment or be unexported (golint)
    • middleware/apimiddleware.go
    • Line 29: warning: exported const CtxAddress should have comment (or a comment on this block) or be unexported (golint)
    • Line 49: warning: exported type DataSource should have comment or be unexported (golint)
    • Line 55: warning: exported type StakeVersionsLatest should have comment or be unexported (golint)
    • Line 68: warning: comment on exported function GetBlockIndex0Ctx should be of the form "GetBlockIndex0Ctx ..." (golint)
    • Line 221: warning: comment on exported function GetOffsetCtx should be of the form "GetOffsetCtx ..." (golint)
    • explorer/explorer.go
    • Line 35: warning: exported const MaxAddressRows should have comment (or a comment on this block) or be unexported (golint)
    • db/dcrpg/internal/blockstmts.go
    • Line 38: warning: exported const UpdateLastBlockValid should have comment (or a comment on this block) or be unexported (golint)
    • Line 88: warning: comment on exported const CreateBlockPrevNextTable should be of the form "CreateBlockPrevNextTable ..." (golint)
    • Line 96: warning: comment on exported const InsertBlockPrevNext should be of the form "InsertBlockPrevNext ..." (golint)
    • Line 107: warning: exported function MakeBlockInsertStatement should have comment or be unexported (golint)
    • version/version.go
    • Line 5: warning: exported type Version should have comment or be unexported (golint)
    • Line 11: warning: exported var Ver should have comment or be unexported (golint)
    • Line 21: warning: exported const AppName should have comment or be unexported (golint)
    • db/dcrpg/insightapi.go
    • Line 45: warning: receiver name db should be consistent with previous receiver name pgb for ChainDBRPC (golint)
    • Line 72: warning: comment on exported method ChainDB.RetrieveAddressIDsByOutpoint should be of the form "RetrieveAddressIDsByOutpoint ..." (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!


misspell98%

Misspell Finds commonly misspelled English words