Preparing report...

Report for github.com/nknorg/nkn/v2

(v2.2.0)

A+    Excellent!    Found 44 issues across 172 files

Tweet

gofmt93%

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!


ineffassign100%

IneffAssign detects ineffectual assignments in Go code.

No problems detected. Good job!


gocyclo80%

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.

    • chain/store/stateGenerator.go
    • Line 18: warning: cyclomatic complexity 50 of function (*ChainStore).spendTransaction() is high (> 15) (gocyclo)
    • Line 198: warning: cyclomatic complexity 33 of function (*ChainStore).generateStateRoot() is high (> 15) (gocyclo)
    • consensus/proposal.go
    • Line 314: warning: cyclomatic complexity 38 of function (*Consensus).requestProposal() is high (> 15) (gocyclo)
    • Line 59: warning: cyclomatic complexity 25 of function (*Consensus).waitAndHandleProposal() is high (> 15) (gocyclo)
    • chain/trie/pruning.go
    • Line 103: warning: cyclomatic complexity 29 of function (*RefCounts).createRefCounts() is high (> 15) (gocyclo)
    • Line 221: warning: cyclomatic complexity 27 of function (*RefCounts).prune() is high (> 15) (gocyclo)
    • por/porserver.go
    • Line 705: warning: cyclomatic complexity 27 of function (*PorServer).AddSigChainObjection() is high (> 15) (gocyclo)
    • Line 263: warning: cyclomatic complexity 18 of function (*PorServer).GetMiningSigChainTxnHash() is high (> 15) (gocyclo)
    • lnode/syncblock.go
    • Line 430: warning: cyclomatic complexity 31 of function (*LocalNode).StartSyncing() is high (> 15) (gocyclo)
    • Line 581: warning: cyclomatic complexity 16 of function (*LocalNode).syncBlockHeaders() is high (> 15) (gocyclo)
    • lnode/transaction.go
    • Line 164: warning: cyclomatic complexity 16 of function (*LocalNode).startRequestingSigChainTxn() is high (> 15) (gocyclo)
    • consensus/state.go
    • Line 144: warning: cyclomatic complexity 21 of function (*Consensus).getNeighborsMajorityConsensusState() is high (> 15) (gocyclo)
    • chain/trie/trie.go
    • Line 196: warning: cyclomatic complexity 20 of function (*Trie).delete() is high (> 15) (gocyclo)
    • Line 340: warning: cyclomatic complexity 16 of function (*Trie).traverse() is high (> 15) (gocyclo)
    • consensus/message.go
    • Line 318: warning: cyclomatic complexity 17 of function (*Consensus).requestProposalTransactionsMessageHandler() is high (> 15) (gocyclo)
    • chain/store/statedb.go
    • Line 115: warning: cyclomatic complexity 34 of function (*StateDB).PruneStatesLowMemory() is high (> 15) (gocyclo)
    • Line 276: warning: cyclomatic complexity 18 of function (*StateDB).PruneStates() is high (> 15) (gocyclo)
    • Line 364: warning: cyclomatic complexity 16 of function (*StateDB).SequentialPrune() is high (> 15) (gocyclo)
    • config/config.go
    • Line 421: warning: cyclomatic complexity 32 of function Init() is high (> 15) (gocyclo)
    • Line 556: warning: cyclomatic complexity 18 of function (*Configuration).verify() is high (> 15) (gocyclo)
    • api/websocket/server/server.go
    • Line 389: warning: cyclomatic complexity 21 of function (*WsServer).OnDataHandle() is high (> 15) (gocyclo)
    • Line 140: warning: cyclomatic complexity 20 of function (*WsServer).registryMethod() is high (> 15) (gocyclo)
    • chain/blockvalidator.go
    • Line 503: warning: cyclomatic complexity 59 of function VerifyTransactionWithLedger() is high (> 15) (gocyclo)
    • Line 59: warning: cyclomatic complexity 34 of function TransactionCheck() is high (> 15) (gocyclo)
    • Line 198: warning: cyclomatic complexity 26 of function GetNextBlockSigner() is high (> 15) (gocyclo)
    • Line 370: warning: cyclomatic complexity 17 of function HeaderCheck() is high (> 15) (gocyclo)
    • chain/bvs.go
    • Line 127: warning: cyclomatic complexity 48 of function (*BlockValidationState).VerifyTransactionWithBlock() is high (> 15) (gocyclo)
    • Line 358: warning: cyclomatic complexity 27 of function (*BlockValidationState).CleanSubmittedTransactions() is high (> 15) (gocyclo)
    • chain/store/store.go
    • Line 439: warning: cyclomatic complexity 34 of function (*ChainStore).persist() is high (> 15) (gocyclo)
    • Line 174: warning: cyclomatic complexity 21 of function (*ChainStore).InitLedgerStoreWithGenesisBlock() is high (> 15) (gocyclo)
    • chain/pool/txpool.go
    • Line 288: warning: cyclomatic complexity 24 of function (*TxnPool).processTx() is high (> 15) (gocyclo)
    • Line 98: warning: cyclomatic complexity 21 of function (*TxnPool).DropTxns() is high (> 15) (gocyclo)
    • lnode/message.go
    • Line 44: warning: cyclomatic complexity 39 of function (*LocalNode).remoteMessageRouted() is high (> 15) (gocyclo)
    • cmd/nknd/commands/root.go
    • Line 107: warning: cyclomatic complexity 40 of function nknMain() is high (> 15) (gocyclo)
    • Line 567: warning: cyclomatic complexity 17 of function GetOrCreateID() is high (> 15) (gocyclo)
    • cmd/nknc/commands/info.go
    • Line 77: warning: cyclomatic complexity 38 of function infoAction() is high (> 15) (gocyclo)
    • Line 251: warning: cyclomatic complexity 23 of function TxnUnmarshal() is high (> 15) (gocyclo)
    • chain/mining.go
    • Line 57: warning: cyclomatic complexity 21 of function (*BuiltinMining).BuildBlock() is high (> 15) (gocyclo)
    • por/sigchain.go
    • Line 32: warning: cyclomatic complexity 19 of function VerifySigChainMeta() is high (> 15) (gocyclo)
    • Line 92: warning: cyclomatic complexity 16 of function VerifySigChainSignatures() is high (> 15) (gocyclo)
    • lnode/neighbor.go
    • Line 436: warning: cyclomatic complexity 18 of function (*LocalNode).VerifySigChain() is high (> 15) (gocyclo)

license100%

Checks whether your project has a LICENSE file.

No problems detected. Good job!


misspell99%

Misspell Finds commonly misspelled English words