lbryio/chainquery

View on GitHub
daemon/jobs/claimtriesync.go

Summary

Maintainability
B
6 hrs
Test Coverage

File claimtriesync.go has 511 lines of code (exceeds 500 allowed). Consider refactoring.
Open

package jobs

import (
    "database/sql"
    "encoding/json"
Severity: Minor
Found in daemon/jobs/claimtriesync.go - About 2 hrs to fix

Function getUpdatedClaims has 63 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func getUpdatedClaims(jobStatus *model.JobStatus) (model.ClaimSlice, error) {
    prevNamesLength := 0
    // CLAIMS THAT HAVE SUPPORTS THAT WERE MODIFIED [SELECT support.supported_claim_id FROM support WHERE support.modified_at >= '2019-11-03 19:48:58';]
    s := model.SupportColumns
    supports, err := model.Supports(qm.Select(s.SupportedClaimID), model.SupportWhere.ModifiedAt.GTE(jobStatus.LastSync)).AllG()
Severity: Minor
Found in daemon/jobs/claimtriesync.go - About 1 hr to fix

Function ClaimTrieSync has 59 lines of code (exceeds 50 allowed). Consider refactoring.
Wontfix

func ClaimTrieSync() {
    metrics.JobLoad.WithLabelValues("claimtrie_sync").Inc()
    defer metrics.JobLoad.WithLabelValues("claimtrie_sync").Dec()
    defer metrics.Job(time.Now(), "claimtrie_sync")
    //defer util.TimeTrack(time.Now(), "ClaimTrieSync", "always")
Severity: Minor
Found in daemon/jobs/claimtriesync.go - About 1 hr to fix

Function ClaimTrieSync has 7 return statements (exceeds 4 allowed).
Open

func ClaimTrieSync() {
    metrics.JobLoad.WithLabelValues("claimtrie_sync").Inc()
    defer metrics.JobLoad.WithLabelValues("claimtrie_sync").Dec()
    defer metrics.Job(time.Now(), "claimtrie_sync")
    //defer util.TimeTrack(time.Now(), "ClaimTrieSync", "always")
Severity: Major
Found in daemon/jobs/claimtriesync.go - About 45 mins to fix

Function getUpdatedClaims has 6 return statements (exceeds 4 allowed).
Open

func getUpdatedClaims(jobStatus *model.JobStatus) (model.ClaimSlice, error) {
    prevNamesLength := 0
    // CLAIMS THAT HAVE SUPPORTS THAT WERE MODIFIED [SELECT support.supported_claim_id FROM support WHERE support.modified_at >= '2019-11-03 19:48:58';]
    s := model.SupportColumns
    supports, err := model.Supports(qm.Select(s.SupportedClaimID), model.SupportWhere.ModifiedAt.GTE(jobStatus.LastSync)).AllG()
Severity: Major
Found in daemon/jobs/claimtriesync.go - About 40 mins to fix

Function GetIsExpiredAtHeight has 5 return statements (exceeds 4 allowed).
Open

func GetIsExpiredAtHeight(height, blockHeight uint) bool {
    if height == 0 {
        return false
    }
    if height >= expirationHardForkHeight {
Severity: Major
Found in daemon/jobs/claimtriesync.go - About 35 mins to fix

Function updateSpentClaims has 5 return statements (exceeds 4 allowed).
Open

func updateSpentClaims() error {

    //Claims without updates
    claims, err := getSpentClaimsToUpdate(false)
    if err != nil {
Severity: Major
Found in daemon/jobs/claimtriesync.go - About 35 mins to fix

There are no issues that match your filters.

Category
Status