Preparing report...

Report for github.com/PlatONnetwork/PlatON-Go

(v1.4.2)

A+    Excellent!    Found 300 issues across 1144 files

Tweet

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!


gofmt85%

Gofmt formats Go programs. We run gofmt -s on your code, where -s is for the "simplify" command


ineffassign100%

IneffAssign detects ineffectual assignments in Go code.

No problems detected. Good job!


gocyclo87%

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.

    • p2p/simulations/network_test.go
    • Line 38: warning: cyclomatic complexity 49 of function TestSnapshot() is high (> 15) (gocyclo)
    • Line 289: warning: cyclomatic complexity 19 of function TestNetworkSimulation() is high (> 15) (gocyclo)
    • p2p/simulations/http_test.go
    • Line 598: warning: cyclomatic complexity 33 of function TestHTTPSnapshot() is high (> 15) (gocyclo)
    • Line 479: warning: cyclomatic complexity 16 of function (*expectEvents).expect() is high (> 15) (gocyclo)
    • common/json/decode.go
    • Line 850: warning: cyclomatic complexity 52 of function (*decodeState).literalStore() is high (> 15) (gocyclo)
    • Line 603: warning: cyclomatic complexity 47 of function (*decodeState).object() is high (> 15) (gocyclo)
    • Line 1187: warning: cyclomatic complexity 28 of function unquoteBytes() is high (> 15) (gocyclo)
    • Line 422: warning: cyclomatic complexity 23 of function indirect() is high (> 15) (gocyclo)
    • Line 497: warning: cyclomatic complexity 23 of function (*decodeState).array() is high (> 15) (gocyclo)
    • x/plugin/staking_plugin.go
    • Line 2440: warning: cyclomatic complexity 41 of function (*StakingPlugin).toSlash() is high (> 15) (gocyclo)
    • Line 1098: warning: cyclomatic complexity 39 of function (*StakingPlugin).WithdrewDelegation() is high (> 15) (gocyclo)
    • Line 2026: warning: cyclomatic complexity 38 of function (*StakingPlugin).Election() is high (> 15) (gocyclo)
    • Line 732: warning: cyclomatic complexity 24 of function (*StakingPlugin).HandleUnCandidateItem() is high (> 15) (gocyclo)
    • Line 123: warning: cyclomatic complexity 20 of function (*StakingPlugin).BeginBlock() is high (> 15) (gocyclo)
    • core/bloombits/matcher.go
    • Line 260: warning: cyclomatic complexity 30 of function (*Matcher).subMatch() is high (> 15) (gocyclo)
    • Line 382: warning: cyclomatic complexity 24 of function (*Matcher).distributor() is high (> 15) (gocyclo)
    • ethstats/ethstats.go
    • Line 183: warning: cyclomatic complexity 29 of function (*Service).loop() is high (> 15) (gocyclo)
    • Line 333: warning: cyclomatic complexity 20 of function (*Service).readLoop() is high (> 15) (gocyclo)
    • core/vm/evm.go
    • Line 482: warning: cyclomatic complexity 23 of function (*EVM).create() is high (> 15) (gocyclo)
    • Line 58: warning: cyclomatic complexity 18 of function run() is high (> 15) (gocyclo)
    • Line 284: warning: cyclomatic complexity 18 of function (*EVM).Call() is high (> 15) (gocyclo)
    • eth/handler.go
    • Line 243: warning: cyclomatic complexity 21 of function (*handler).runEthPeer() is high (> 15) (gocyclo)
    • core/vm/staking_contract.go
    • Line 349: warning: cyclomatic complexity 26 of function (*StakingContract).editCandidate() is high (> 15) (gocyclo)
    • Line 628: warning: cyclomatic complexity 20 of function (*StakingContract).delegate() is high (> 15) (gocyclo)
    • Line 132: warning: cyclomatic complexity 20 of function (*StakingContract).createStaking() is high (> 15) (gocyclo)
    • core/vm/wagon_runtime.go
    • Line 1508: warning: cyclomatic complexity 25 of function MigrateInnerContract() is high (> 15) (gocyclo)
    • Line 2164: warning: cyclomatic complexity 23 of function CreateContract() is high (> 15) (gocyclo)
    • Line 1231: warning: cyclomatic complexity 18 of function CallContract() is high (> 15) (gocyclo)
    • eth/filters/api.go
    • Line 467: warning: cyclomatic complexity 24 of function (*FilterCriteria).UnmarshalJSON() is high (> 15) (gocyclo)
    • miner/miner.go
    • Line 82: warning: cyclomatic complexity 20 of function (*Miner).update() is high (> 15) (gocyclo)
    • core/state/sync_test.go
    • Line 404: warning: cyclomatic complexity 18 of function TestIncompleteStateSync() is high (> 15) (gocyclo)
    • Line 165: warning: cyclomatic complexity 17 of function testIterativeStateSync() is high (> 15) (gocyclo)
    • cmd/utils/flags.go
    • Line 1123: warning: cyclomatic complexity 40 of function SetEthConfig() is high (> 15) (gocyclo)
    • Line 793: warning: cyclomatic complexity 18 of function setHTTP() is high (> 15) (gocyclo)
    • accounts/scwallet/wallet.go
    • Line 442: warning: cyclomatic complexity 25 of function (*Wallet).selfDerive() is high (> 15) (gocyclo)
    • Line 340: warning: cyclomatic complexity 16 of function (*Wallet).Open() is high (> 15) (gocyclo)
    • rlp/rlpgen/gen.go
    • Line 616: warning: cyclomatic complexity 18 of function (*buildContext).makeOp() is high (> 15) (gocyclo)
    • metrics/ewma_test.go
    • Line 155: warning: cyclomatic complexity 17 of function TestEWMA15() is high (> 15) (gocyclo)
    • Line 17: warning: cyclomatic complexity 17 of function TestEWMA1() is high (> 15) (gocyclo)
    • Line 86: warning: cyclomatic complexity 17 of function TestEWMA5() is high (> 15) (gocyclo)
    • node/node.go
    • Line 75: warning: cyclomatic complexity 16 of function New() is high (> 15) (gocyclo)
    • eth/api_tx_maker.go
    • Line 119: warning: cyclomatic complexity 35 of function (*TxGenAPI).makeTransaction() is high (> 15) (gocyclo)
    • Line 728: warning: cyclomatic complexity 22 of function NewTxMakeManger() is high (> 15) (gocyclo)
    • eth/tracers/api.go
    • Line 241: warning: cyclomatic complexity 28 of function (*API).traceChain() is high (> 15) (gocyclo)
    • Line 575: warning: cyclomatic complexity 21 of function (*API).standardTraceBlockToFile() is high (> 15) (gocyclo)
    • trie/proof_test.go
    • Line 532: warning: cyclomatic complexity 18 of function TestBadRangeProof() is high (> 15) (gocyclo)
    • Line 195: warning: cyclomatic complexity 17 of function TestRangeProofWithNonExistentProof() is high (> 15) (gocyclo)
    • Line 324: warning: cyclomatic complexity 16 of function TestOneElementRangeProof() is high (> 15) (gocyclo)
    • common/json/decode_test.go
    • Line 1790: warning: cyclomatic complexity 29 of function TestUnmarshalNulls() is high (> 15) (gocyclo)
    • Line 1091: warning: cyclomatic complexity 19 of function TestUnmarshal() is high (> 15) (gocyclo)
    • Line 1207: warning: cyclomatic complexity 17 of function TestNumberAccessors() is high (> 15) (gocyclo)
    • core/state/snapshot/generate.go
    • Line 317: warning: cyclomatic complexity 27 of function (*diskLayer).generateRange() is high (> 15) (gocyclo)
    • Line 559: warning: cyclomatic complexity 23 of function generateAccounts() is high (> 15) (gocyclo)
    • Line 170: warning: cyclomatic complexity 19 of function (*diskLayer).proveRange() is high (> 15) (gocyclo)
    • consensus/cbft/cbft.go
    • Line 1512: warning: cyclomatic complexity 19 of function (*Cbft).verifyConsensusMsg() is high (> 15) (gocyclo)
    • Line 1454: warning: cyclomatic complexity 18 of function (*Cbft).checkPrepareQC() is high (> 15) (gocyclo)
    • Line 490: warning: cyclomatic complexity 18 of function (*Cbft).receiveLoop() is high (> 15) (gocyclo)
    • core/state/statedb.go
    • Line 1244: warning: cyclomatic complexity 17 of function (*StateDB).Commit() is high (> 15) (gocyclo)
    • Line 917: warning: cyclomatic complexity 17 of function (*StateDB).Copy() is high (> 15) (gocyclo)
    • signer/core/signed_data.go
    • Line 895: warning: cyclomatic complexity 101 of function isPrimitiveTypeValid() is high (> 15) (gocyclo)
    • Line 572: warning: cyclomatic complexity 20 of function (*TypedData).EncodePrimitiveValue() is high (> 15) (gocyclo)
    • p2p/server.go
    • Line 752: warning: cyclomatic complexity 31 of function (*Server).run() is high (> 15) (gocyclo)
    • Line 907: warning: cyclomatic complexity 20 of function (*Server).postHandshakeChecks() is high (> 15) (gocyclo)
    • eth/protocols/snap/sync.go
    • Line 1767: warning: cyclomatic complexity 44 of function (*Syncer).processStorageResponse() is high (> 15) (gocyclo)
    • Line 1021: warning: cyclomatic complexity 24 of function (*Syncer).assignStorageTasks() is high (> 15) (gocyclo)
    • Line 534: warning: cyclomatic complexity 24 of function (*Syncer).Sync() is high (> 15) (gocyclo)
    • Line 2325: warning: cyclomatic complexity 23 of function (*Syncer).OnStorage() is high (> 15) (gocyclo)
    • Line 2116: warning: cyclomatic complexity 20 of function (*Syncer).OnAccounts() is high (> 15) (gocyclo)
    • Line 1268: warning: cyclomatic complexity 17 of function (*Syncer).assignBytecodeHealTasks() is high (> 15) (gocyclo)
    • Line 1158: warning: cyclomatic complexity 17 of function (*Syncer).assignTrienodeHealTasks() is high (> 15) (gocyclo)
    • Line 2044: warning: cyclomatic complexity 16 of function (*Syncer).forwardAccountTask() is high (> 15) (gocyclo)
    • Line 1370: warning: cyclomatic complexity 16 of function (*Syncer).revertRequests() is high (> 15) (gocyclo)
    • x/plugin/slashing_plugin_test.go
    • Line 591: warning: cyclomatic complexity 35 of function TestSlashingPlugin_ZeroProduceProcess() is high (> 15) (gocyclo)
    • Line 376: warning: cyclomatic complexity 17 of function TestSlashingPlugin_Slash() is high (> 15) (gocyclo)
    • x/gov/gov_test.go
    • Line 852: warning: cyclomatic complexity 16 of function TestGov_ClearProcessingProposals() is high (> 15) (gocyclo)
    • core/tx_pool.go
    • Line 755: warning: cyclomatic complexity 24 of function (*TxPool).add() is high (> 15) (gocyclo)
    • Line 1539: warning: cyclomatic complexity 23 of function (*TxPool).truncatePending() is high (> 15) (gocyclo)
    • Line 1345: warning: cyclomatic complexity 22 of function (*TxPool).reset() is high (> 15) (gocyclo)
    • Line 1453: warning: cyclomatic complexity 18 of function (*TxPool).promoteExecutables() is high (> 15) (gocyclo)
    • Line 391: warning: cyclomatic complexity 16 of function (*TxPool).loop() is high (> 15) (gocyclo)
    • x/plugin/staking_plugin_test.go
    • Line 461: warning: cyclomatic complexity 31 of function TestStakingPlugin_EndBlock() is high (> 15) (gocyclo)
    • Line 4118: warning: cyclomatic complexity 26 of function TestStakingPlugin_HistoryValidatorList() is high (> 15) (gocyclo)
    • Line 780: warning: cyclomatic complexity 26 of function TestStakingPlugin_Confirmed() is high (> 15) (gocyclo)
    • Line 117: warning: cyclomatic complexity 24 of function buildPrepareData() is high (> 15) (gocyclo)
    • Line 2591: warning: cyclomatic complexity 24 of function TestStakingPlugin_SlashCandidates() is high (> 15) (gocyclo)
    • Line 2382: warning: cyclomatic complexity 18 of function TestStakingPlugin_Election() is high (> 15) (gocyclo)
    • Line 3033: warning: cyclomatic complexity 16 of function TestStakingPlugin_ProposalPassedNotify() is high (> 15) (gocyclo)
    • Line 2198: warning: cyclomatic complexity 16 of function TestStakingPlugin_ElectNextVerifierList() is high (> 15) (gocyclo)
    • core/tx_pool_test.go
    • Line 579: warning: cyclomatic complexity 28 of function TestTransactionPostponing() is high (> 15) (gocyclo)
    • Line 1153: warning: cyclomatic complexity 24 of function TestTransactionPoolRepricing() is high (> 15) (gocyclo)
    • Line 1330: warning: cyclomatic complexity 20 of function TestTransactionPoolUnderpricing() is high (> 15) (gocyclo)
    • Line 462: warning: cyclomatic complexity 20 of function TestTransactionDropping() is high (> 15) (gocyclo)
    • Line 1637: warning: cyclomatic complexity 19 of function testTransactionJournaling() is high (> 15) (gocyclo)
    • Line 1495: warning: cyclomatic complexity 17 of function TestTransactionDeduplication() is high (> 15) (gocyclo)
    • Line 1558: warning: cyclomatic complexity 17 of function TestTransactionReplacement() is high (> 15) (gocyclo)
    • eth/api_test.go
    • Line 60: warning: cyclomatic complexity 16 of function TestAccountRange() is high (> 15) (gocyclo)
    • trie/sync.go
    • Line 366: warning: cyclomatic complexity 17 of function (*Sync).children() is high (> 15) (gocyclo)
    • common/sort/sort.go
    • Line 109: warning: cyclomatic complexity 22 of function doPivot() is high (> 15) (gocyclo)
    • Line 425: warning: cyclomatic complexity 18 of function symMerge() is high (> 15) (gocyclo)
    • log/format.go
    • Line 328: warning: cyclomatic complexity 21 of function formatLogfmtValue() is high (> 15) (gocyclo)
    • eth/protocols/eth/broadcast.go
    • Line 63: warning: cyclomatic complexity 17 of function (*Peer).broadcastTransactions() is high (> 15) (gocyclo)
    • Line 135: warning: cyclomatic complexity 16 of function (*Peer).announceTransactions() is high (> 15) (gocyclo)
    • consensus/cbft/sync_process.go
    • Line 39: warning: cyclomatic complexity 29 of function (*Cbft).fetchBlock() is high (> 15) (gocyclo)
    • Line 531: warning: cyclomatic complexity 17 of function (*Cbft).OnGetViewChange() is high (> 15) (gocyclo)
    • Line 304: warning: cyclomatic complexity 16 of function (*Cbft).OnGetQCBlockList() is high (> 15) (gocyclo)
    • x/plugin/gov_plugin.go
    • Line 155: warning: cyclomatic complexity 20 of function (*GovPlugin).EndBlock() is high (> 15) (gocyclo)
    • Line 70: warning: cyclomatic complexity 19 of function (*GovPlugin).BeginBlock() is high (> 15) (gocyclo)
    • Line 433: warning: cyclomatic complexity 18 of function tally() is high (> 15) (gocyclo)
    • Line 351: warning: cyclomatic complexity 17 of function tallyCancel() is high (> 15) (gocyclo)
    • core/blockchain.go
    • Line 1189: warning: cyclomatic complexity 55 of function (*BlockChain).InsertReceiptChain() is high (> 15) (gocyclo)
    • Line 1475: warning: cyclomatic complexity 36 of function (*BlockChain).WriteBlockWithState() is high (> 15) (gocyclo)
    • Line 1836: warning: cyclomatic complexity 32 of function (*BlockChain).reorg() is high (> 15) (gocyclo)
    • Line 531: warning: cyclomatic complexity 23 of function (*BlockChain).SetHeadBeyondRoot() is high (> 15) (gocyclo)
    • Line 256: warning: cyclomatic complexity 21 of function NewBlockChain() is high (> 15) (gocyclo)
    • Line 2022: warning: cyclomatic complexity 17 of function (*BlockChain).maintainTxIndex() is high (> 15) (gocyclo)
    • trie/proof.go
    • Line 224: warning: cyclomatic complexity 29 of function unsetInternal() is high (> 15) (gocyclo)
    • Line 476: warning: cyclomatic complexity 26 of function VerifyRangeProof() is high (> 15) (gocyclo)
    • Line 142: warning: cyclomatic complexity 16 of function proofToPath() is high (> 15) (gocyclo)
    • miner/worker.go
    • Line 348: warning: cyclomatic complexity 34 of function (*worker).newWorkLoop() is high (> 15) (gocyclo)
    • Line 949: warning: cyclomatic complexity 31 of function (*worker).commitNewWork() is high (> 15) (gocyclo)
    • Line 810: warning: cyclomatic complexity 25 of function (*worker).commitTransactionsWithHeader() is high (> 15) (gocyclo)
    • Line 642: warning: cyclomatic complexity 18 of function (*worker).resultLoop() is high (> 15) (gocyclo)
    • x/plugin/slashing_plugin.go
    • Line 187: warning: cyclomatic complexity 30 of function (*SlashingPlugin).zeroProduceProcess() is high (> 15) (gocyclo)
    • Line 521: warning: cyclomatic complexity 19 of function (*SlashingPlugin).Slash() is high (> 15) (gocyclo)
    • Line 106: warning: cyclomatic complexity 16 of function (*SlashingPlugin).BeginBlock() is high (> 15) (gocyclo)
    • core/state/statedb_test.go
    • Line 1026: warning: cyclomatic complexity 28 of function TestStateDBAccessList() is high (> 15) (gocyclo)
    • Line 877: warning: cyclomatic complexity 21 of function TestCopyCopyCommitCopy() is high (> 15) (gocyclo)
    • Line 111: warning: cyclomatic complexity 18 of function TestNewStateDBAndCopy() is high (> 15) (gocyclo)
    • Line 805: warning: cyclomatic complexity 17 of function TestCopyCommitCopy() is high (> 15) (gocyclo)
    • x/gov/gov.go
    • Line 179: warning: cyclomatic complexity 23 of function Vote() is high (> 15) (gocyclo)
    • Line 270: warning: cyclomatic complexity 18 of function DeclareVersion() is high (> 15) (gocyclo)
    • consensus/cbft/rules/safety_rules.go
    • Line 148: warning: cyclomatic complexity 41 of function (*baseSafetyRules).PrepareBlockRules() is high (> 15) (gocyclo)
    • Line 301: warning: cyclomatic complexity 18 of function (*baseSafetyRules).PrepareVoteRules() is high (> 15) (gocyclo)
    • trie/trie.go
    • Line 362: warning: cyclomatic complexity 24 of function (*Trie).delete() is high (> 15) (gocyclo)
    • Line 271: warning: cyclomatic complexity 18 of function (*Trie).insert() is high (> 15) (gocyclo)
    • Line 172: warning: cyclomatic complexity 16 of function (*Trie).tryGetNode() is high (> 15) (gocyclo)
    • build/ci.go
    • Line 188: warning: cyclomatic complexity 22 of function doInstall() is high (> 15) (gocyclo)
    • cmd/platon/snapshot.go
    • Line 335: warning: cyclomatic complexity 22 of function traverseRawState() is high (> 15) (gocyclo)
    • Line 245: warning: cyclomatic complexity 16 of function traverseState() is high (> 15) (gocyclo)
    • eth/downloader/downloader.go
    • Line 1219: warning: cyclomatic complexity 40 of function (*Downloader).fetchParts() is high (> 15) (gocyclo)
    • Line 1394: warning: cyclomatic complexity 38 of function (*Downloader).processHeaders() is high (> 15) (gocyclo)
    • Line 978: warning: cyclomatic complexity 28 of function (*Downloader).fetchHeaders() is high (> 15) (gocyclo)
    • Line 470: warning: cyclomatic complexity 21 of function (*Downloader).syncWithPeer() is high (> 15) (gocyclo)
    • Line 1609: warning: cyclomatic complexity 21 of function (*Downloader).processFastSyncContent() is high (> 15) (gocyclo)
    • Line 625: warning: cyclomatic complexity 18 of function (*Downloader).findOrigin() is high (> 15) (gocyclo)
    • Line 382: warning: cyclomatic complexity 17 of function (*Downloader).synchronise() is high (> 15) (gocyclo)
    • core/state/snapshot/iterator_test.go
    • Line 308: warning: cyclomatic complexity 17 of function TestAccountIteratorTraversalValues() is high (> 15) (gocyclo)
    • Line 402: warning: cyclomatic complexity 17 of function TestStorageIteratorTraversalValues() is high (> 15) (gocyclo)
    • rlp/encode.go
    • Line 135: warning: cyclomatic complexity 17 of function makeWriter() is high (> 15) (gocyclo)
    • p2p/enr/enr.go
    • Line 192: warning: cyclomatic complexity 16 of function decodeRecord() is high (> 15) (gocyclo)
    • core/vm/delegate_reward_contract_test.go
    • Line 281: warning: cyclomatic complexity 32 of function TestWithdrawDelegateRewardWithMultiNode() is high (> 15) (gocyclo)
    • Line 100: warning: cyclomatic complexity 26 of function TestWithdrawDelegateRewardWithReward() is high (> 15) (gocyclo)
    • core/snapshotdb/snapshotdb_test.go
    • Line 196: warning: cyclomatic complexity 28 of function TestSnapshotDB_Get() is high (> 15) (gocyclo)
    • Line 882: warning: cyclomatic complexity 24 of function TestSnapshotDB_Compaction222222() is high (> 15) (gocyclo)
    • x/plugin/reward_plugin_test.go
    • Line 553: warning: cyclomatic complexity 28 of function TestAllocatePackageBlock() is high (> 15) (gocyclo)
    • Line 444: warning: cyclomatic complexity 18 of function TestSaveRewardDelegateRewardPer() is high (> 15) (gocyclo)
    • Line 730: warning: cyclomatic complexity 17 of function TestRewardMgrPlugin_GetDelegateReward() is high (> 15) (gocyclo)
    • Line 180: warning: cyclomatic complexity 17 of function TestRewardMgrPlugin_EndBlock() is high (> 15) (gocyclo)
    • core/genesis.go
    • Line 147: warning: cyclomatic complexity 31 of function SetupGenesisBlock() is high (> 15) (gocyclo)
    • Line 394: warning: cyclomatic complexity 20 of function (*Genesis).ToBlock() is high (> 15) (gocyclo)
    • Line 314: warning: cyclomatic complexity 16 of function (*Genesis).InitGenesisAndSetEconomicConfig() is high (> 15) (gocyclo)
    • common/json/encode.go
    • Line 1307: warning: cyclomatic complexity 32 of function typeFields() is high (> 15) (gocyclo)
    • Line 431: warning: cyclomatic complexity 29 of function newTypeEncoder() is high (> 15) (gocyclo)
    • Line 747: warning: cyclomatic complexity 26 of function isValidNumber() is high (> 15) (gocyclo)
    • Line 1124: warning: cyclomatic complexity 18 of function (*encodeState).string() is high (> 15) (gocyclo)
    • Line 1196: warning: cyclomatic complexity 18 of function (*encodeState).stringBytes() is high (> 15) (gocyclo)
    • Line 670: warning: cyclomatic complexity 17 of function (floatEncoder).encode() is high (> 15) (gocyclo)
    • p2p/dial.go
    • Line 257: warning: cyclomatic complexity 29 of function (*dialScheduler).loop() is high (> 15) (gocyclo)
    • internal/ethapi/api.go
    • Line 883: warning: cyclomatic complexity 29 of function DoEstimateGas() is high (> 15) (gocyclo)
    • Line 1597: warning: cyclomatic complexity 17 of function (*SendTxArgs).setDefaults() is high (> 15) (gocyclo)

license100%

Checks whether your project has a LICENSE file.

No problems detected. Good job!


misspell100%

Misspell Finds commonly misspelled English words

No problems detected. Good job!