Showing 68 of 114 total issues
Function fixOutputs
has 5 return statements (exceeds 4 allowed). Open
func fixOutputs() error {
wg := sync.WaitGroup{}
spentClaimsChan := make(chan *model.Claim, 100)
errorsChan := make(chan error, runtime.NumCPU())
c := model.ClaimColumns
- Create a ticketCreate a ticket
Function reprocessUpdatedClaims
has a Cognitive Complexity of 22 (exceeds 20 allowed). Consider refactoring. Open
func reprocessUpdatedClaims(claimsChan chan *model.Claim, currentHeight uint64, processedClaims *int64) error {
const BatchSize = 5000
reprocessedNamesMap := make(map[string]bool, 500000)
claimsBatch := make(model.ClaimSlice, 0, BatchSize)
for {
- Read upRead up
- Create a ticketCreate a ticket
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function processTxSet
has 5 return statements (exceeds 4 allowed). Open
func processTxSet(txSet lbrycrd.RawMempoolVerboseResponse, lastBlock *model.Block, staleTxs model.TransactionSlice) (bool, error) {
currTxMap := make(map[string]*model.Transaction)
for _, tx := range staleTxs {
currTxMap[tx.Hash] = tx
}
- Create a ticketCreate a ticket
Function processClaimUpdateScript
has 5 return statements (exceeds 4 allowed). Open
func processClaimUpdateScript(script *[]byte, vout model.Output, tx model.Transaction, blockHeight uint64) (name string, claimID string, pubkeyscript []byte, err error) {
name, claimID, value, pubkeyscript, err := lbrycrd.ParseClaimUpdateScript(*script)
if err != nil {
err := errors.Prefix("Claim update processing error", err)
return name, claimID, pubkeyscript, err
- Create a ticketCreate a ticket
Function getFirstAddressFromVout
has 5 return statements (exceeds 4 allowed). Open
func getFirstAddressFromVout(vout lbrycrd.Vout) (scriptAddress string, err error) {
if vout.ScriptPubKey.Type == lbrycrd.NonStandard {
scriptAddress, err = getAddressFromNonStandardVout(vout.ScriptPubKey.Hex)
if errors.Is(err, lbrycrd.ErrNotClaimScript) {
logrus.Warning(err)
- Create a ticketCreate a ticket
Function CertificateSync
has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring. Open
func CertificateSync() {
if !certificateSyncRunning {
metrics.JobLoad.WithLabelValues("certificate_sync").Inc()
defer metrics.JobLoad.WithLabelValues("certificate_sync").Dec()
defer metrics.Job(time.Now(), "certificate_sync")
- Read upRead up
- Create a ticketCreate a ticket
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function ProcessVout
has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring. Open
func ProcessVout(jsonVout *lbrycrd.Vout, tx *m.Transaction, txDC *txDebitCredits, blockHeight uint64) error {
defer metrics.Processing(time.Now(), "vout")
vout := &m.Output{}
foundVout := ds.GetOutput(tx.Hash, uint(jsonVout.N))
if foundVout != nil {
- Read upRead up
- Create a ticketCreate a ticket
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function SyncClaimCntInChannel
has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring. Open
func SyncClaimCntInChannel() error {
latestBlock, err := model.Blocks(qm.Select(model.BlockColumns.Height), qm.OrderBy(model.BlockColumns.Height+" DESC")).OneG()
if err != nil {
return errors.Prefix(syncClaimsInChannel, err)
}
- Read upRead up
- Create a ticketCreate a ticket
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"