private-dreamnet/dreamtime

View on GitHub
src/modules/updater/base.js

Summary

Maintainability
C
1 day
Test Coverage

File base.js has 345 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// DreamTime.
// Copyright (C) DreamNet. All rights reserved.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License 3.0 as published by
Severity: Minor
Found in src/modules/updater/base.js - About 4 hrs to fix

    BaseUpdater has 32 functions (exceeds 20 allowed). Consider refactoring.
    Open

    export class BaseUpdater {
      /**
       * @type {boolean}
       */
      enabled = false
    Severity: Minor
    Found in src/modules/updater/base.js - About 4 hrs to fix

      Function _downloadFrom has 47 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        _downloadFrom(url) {
          this.consola.info(`Downloading update from: ${url}`)
      
          if (this.downloadMethod === DMETHOD.IPFS) {
            consola.track('DOWNLOAD_IPFS', url)
      Severity: Minor
      Found in src/modules/updater/base.js - About 1 hr to fix

        Function setup has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          async setup() {
            this.enabled = false
        
            if (!system.online) {
              this.error = new Warning('There is no Internet connection. Please make sure you are connected before starting.')
        Severity: Minor
        Found in src/modules/updater/base.js - About 1 hr to fix

          Function _getDownloadUrls has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

            _getDownloadUrls() {
              let urls
              let asset
          
              try {
          Severity: Minor
          Found in src/modules/updater/base.js - About 25 mins to fix

          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

          There are no issues that match your filters.

          Category
          Status