netdata/netdata

View on GitHub
src/web/gui/src/dashboard.js/main.js

Summary

Maintainability
F
9 mos
Test Coverage

Function chartState has a Cognitive Complexity of 904 (exceeds 5 allowed). Consider refactoring.
Open

let chartState = function (element) {
    this.element = element;

    // IMPORTANT:
    // all private functions should use 'that', instead of 'this'
Severity: Minor
Found in src/web/gui/src/dashboard.js/main.js - About 2 wks 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

Function chartState has 2125 lines of code (exceeds 25 allowed). Consider refactoring.
Open

let chartState = function (element) {
    this.element = element;

    // IMPORTANT:
    // all private functions should use 'that', instead of 'this'
Severity: Major
Found in src/web/gui/src/dashboard.js/main.js - About 1 wk to fix

    File main.js has 3119 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    
    // *** src/dashboard.js/main.js
    
    // Codacy declarations
    /* global clipboard */
    Severity: Major
    Found in src/web/gui/src/dashboard.js/main.js - About 1 wk to fix

      Function legendUpdateDOM has 387 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          this.legendUpdateDOM = function () {
              let needed = false, dim, keys, len;
      
              // check that the legend DOM is up to date for the downloaded dimensions
              if (typeof this.element_legend_childs.series !== 'object' || this.element_legend_childs.series === null) {
      Severity: Major
      Found in src/web/gui/src/dashboard.js/main.js - About 1 day to fix

        Function updateChart has 132 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            this.updateChart = function (callback) {
                if (this.debug) {
                    this.log('updateChart()');
                }
        
        
        Severity: Major
        Found in src/web/gui/src/dashboard.js/main.js - About 5 hrs to fix

          Function chartRefresher has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
          Open

          NETDATA.chartRefresher = function () {
              // console.log('chartRefresher() begin ' + (Date.now() - NETDATA.chartRefresherLastRun).toString() + ' ms since last run');
          
              if (NETDATA.options.page_is_visible === false
                  && NETDATA.options.current.stop_updates_when_focus_is_lost
          Severity: Minor
          Found in src/web/gui/src/dashboard.js/main.js - About 4 hrs 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

          Function updateChartWithData has 109 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              this.updateChartWithData = function (data) {
                  if (this.debug) {
                      this.log('updateChartWithData() called.');
                  }
          
          
          Severity: Major
          Found in src/web/gui/src/dashboard.js/main.js - About 4 hrs to fix

            Function canBeAutoRefreshed has 94 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                this.canBeAutoRefreshed = function () {
                    if (!this.enabled) {
                        if (this.debug) {
                            this.log('canBeAutoRefreshed() -> not enabled');
                        }
            Severity: Major
            Found in src/web/gui/src/dashboard.js/main.js - About 3 hrs to fix

              Function chartRefresher has 92 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              NETDATA.chartRefresher = function () {
                  // console.log('chartRefresher() begin ' + (Date.now() - NETDATA.chartRefresherLastRun).toString() + ' ms since last run');
              
                  if (NETDATA.options.page_is_visible === false
                      && NETDATA.options.current.stop_updates_when_focus_is_lost
              Severity: Major
              Found in src/web/gui/src/dashboard.js/main.js - About 3 hrs to fix

                Function lateInitialization has 90 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    const lateInitialization = () => {
                        if (typeof this.host !== 'undefined') {
                            return;
                        }
                
                
                Severity: Major
                Found in src/web/gui/src/dashboard.js/main.js - About 3 hrs to fix

                  Function resizeHandler has 86 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      this.resizeHandler = function (e) {
                          e.preventDefault();
                  
                          if (typeof this.event_resize === 'undefined'
                              || this.event_resize.chart_original_w === 'undefined'
                  Severity: Major
                  Found in src/web/gui/src/dashboard.js/main.js - About 3 hrs to fix

                    Function setHandler has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                    Open

                    dimensionStatus.prototype.setHandler = function () {
                        if (!this.enabled) {
                            return;
                        }
                    
                    
                    Severity: Minor
                    Found in src/web/gui/src/dashboard.js/main.js - About 3 hrs 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

                    Function handler has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                    Open

                        handler: function (entries, observer) {
                            entries.forEach(function (entry) {
                                let state = NETDATA.chartState(entry.target);
                    
                                let idx;
                    Severity: Minor
                    Found in src/web/gui/src/dashboard.js/main.js - About 3 hrs 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

                    Function init has 66 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        init: function (timezone) {
                            //console.log('init with timezone: ' + timezone);
                    
                            // detect browser timezone
                            try {
                    Severity: Major
                    Found in src/web/gui/src/dashboard.js/main.js - About 2 hrs to fix

                      Function chartRefresherNoParallel has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                      Open

                      NETDATA.chartRefresherNoParallel = function (index, callback) {
                          let targets = NETDATA.intersectionObserver.targets();
                      
                          if (NETDATA.options.debug.main_loop) {
                              console.log('NETDATA.chartRefresherNoParallel(' + index + ')');
                      Severity: Minor
                      Found in src/web/gui/src/dashboard.js/main.js - About 2 hrs 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

                      Function chartURL has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          this.chartURL = function () {
                              let after, before, points_multiplier = 1;
                              if (NETDATA.globalPanAndZoom.isActive()) {
                                  if (this.current.force_before_ms !== null && this.current.force_after_ms !== null) {
                                      this.tm.pan_and_zoom_seq = 0;
                      Severity: Major
                      Found in src/web/gui/src/dashboard.js/main.js - About 2 hrs to fix

                        Function updateChartPanOrZoom has 60 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            this.updateChartPanOrZoom = function (after, before, callback) {
                                let logme = 'updateChartPanOrZoom(' + after + ', ' + before + '): ';
                                let ret = true;
                        
                                NETDATA.globalPanAndZoom.delay();
                        Severity: Major
                        Found in src/web/gui/src/dashboard.js/main.js - About 2 hrs to fix

                          Function legendFormatValueDecimalsFromMinMax has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              this.legendFormatValueDecimalsFromMinMax = function (min, max) {
                                  if (min === _legendFormatValueChartDecimalsLastMin && max === _legendFormatValueChartDecimalsLastMax) {
                                      return;
                                  }
                          
                          
                          Severity: Major
                          Found in src/web/gui/src/dashboard.js/main.js - About 2 hrs to fix

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

                                this.hideChart = function () {
                                    // hide it, if it is not already hidden
                                    if (isHidden()) {
                                        return;
                                    }
                            Severity: Minor
                            Found in src/web/gui/src/dashboard.js/main.js - About 1 hr to fix

                              Function start has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              NETDATA.start = function () {
                                  // this should be called only once
                              
                                  if (NETDATA.started) {
                                      console.log('netdata is already started');
                              Severity: Minor
                              Found in src/web/gui/src/dashboard.js/main.js - About 1 hr to fix

                                Function chartRefresherNoParallel has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                NETDATA.chartRefresherNoParallel = function (index, callback) {
                                    let targets = NETDATA.intersectionObserver.targets();
                                
                                    if (NETDATA.options.debug.main_loop) {
                                        console.log('NETDATA.chartRefresherNoParallel(' + index + ')');
                                Severity: Minor
                                Found in src/web/gui/src/dashboard.js/main.js - About 1 hr to fix

                                  Function getSnapshotData has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      this.getSnapshotData = function (key) {
                                          if (this.debug) {
                                              this.log('updating from snapshot: ' + key);
                                          }
                                  
                                  
                                  Severity: Minor
                                  Found in src/web/gui/src/dashboard.js/main.js - About 1 hr to fix

                                    Function getChart has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        this.getChart = function (callback) {
                                            this.chart = NETDATA.chartRegistry.get(this.host, this.id);
                                            if (this.chart) {
                                                this.__defaultsFromDownloadedChart(this.chart);
                                    
                                    
                                    Severity: Minor
                                    Found in src/web/gui/src/dashboard.js/main.js - About 1 hr to fix

                                      Function unhideChart has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                          this.unhideChart = function () {
                                              if (!isHidden()) {
                                                  return;
                                              }
                                      
                                      
                                      Severity: Minor
                                      Found in src/web/gui/src/dashboard.js/main.js - About 1 hr to fix

                                        Function legendFormatValue has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                                        Open

                                            this.legendFormatValue = function (value) {
                                                if (typeof value !== 'number') {
                                                    return '-';
                                                }
                                        
                                        
                                        Severity: Minor
                                        Found in src/web/gui/src/dashboard.js/main.js - About 1 hr to fix

                                          Function genLabel has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                                          Open

                                                  const genLabel = function (state, parent, dim, name, count) {
                                                      let color = state.__chartDimensionColor(name);
                                          
                                                      let user_element = null;
                                                      let user_id = NETDATA.dataAttribute(state.element, 'show-value-of-' + name.toLowerCase() + '-at', null);
                                          Severity: Minor
                                          Found in src/web/gui/src/dashboard.js/main.js - About 1 hr to fix

                                            Function handler has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                                            Open

                                                handler: function (entries, observer) {
                                                    entries.forEach(function (entry) {
                                                        let state = NETDATA.chartState(entry.target);
                                            
                                                        let idx;
                                            Severity: Minor
                                            Found in src/web/gui/src/dashboard.js/main.js - About 1 hr to fix

                                              Function onscrollUpdater has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                                              Open

                                              NETDATA.onscrollUpdater = function () {
                                                  NETDATA.globalSelectionSync.stop();
                                              
                                                  if (NETDATA.options.abort_ajax_on_scroll) {
                                                      NETDATA.abortAllRefreshes();
                                              Severity: Minor
                                              Found in src/web/gui/src/dashboard.js/main.js - About 1 hr 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

                                              Function setHandler has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                                              Open

                                              dimensionStatus.prototype.setHandler = function () {
                                                  if (!this.enabled) {
                                                      return;
                                                  }
                                              
                                              
                                              Severity: Minor
                                              Found in src/web/gui/src/dashboard.js/main.js - About 1 hr to fix

                                                Function legendShowLatestValues has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                                                Open

                                                    this.legendShowLatestValues = function () {
                                                        if (this.chart === null) {
                                                            return;
                                                        }
                                                        if (this.selected) {
                                                Severity: Minor
                                                Found in src/web/gui/src/dashboard.js/main.js - About 1 hr to fix

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

                                                      this.resetChart = function (dontClearMaster, dontUpdate) {
                                                          if (this.debug) {
                                                              this.log('resetChart(' + dontClearMaster + ', ' + dontUpdate + ') called');
                                                          }
                                                  
                                                  
                                                  Severity: Minor
                                                  Found in src/web/gui/src/dashboard.js/main.js - About 1 hr to fix

                                                    Function runtimeInit has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                                    Open

                                                        const runtimeInit = () => {
                                                            this.paused = false;                        // boolean - is the chart paused for any reason?
                                                            this.selected = false;                      // boolean - is the chart shown a selection?
                                                    
                                                            this.chart_created = false;                 // boolean - is the library.create() been called?
                                                    Severity: Minor
                                                    Found in src/web/gui/src/dashboard.js/main.js - About 1 hr to fix

                                                      Function start has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                                      Open

                                                      NETDATA.start = function () {
                                                          // this should be called only once
                                                      
                                                          if (NETDATA.started) {
                                                              console.log('netdata is already started');
                                                      Severity: Minor
                                                      Found in src/web/gui/src/dashboard.js/main.js - About 55 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

                                                      Function sync has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                                      Open

                                                          sync: function (state, t) {
                                                              // if (NETDATA.options.current.sync_selection === true) {
                                                              if (NETDATA.options.current.sync_selection) {
                                                                  // if (NETDATA.options.debug.globalSelectionSync === true)
                                                                  if (NETDATA.options.debug.globalSelectionSync) {
                                                      Severity: Minor
                                                      Found in src/web/gui/src/dashboard.js/main.js - About 55 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

                                                      Function setOptions has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                                      Open

                                                      dimensionStatus.prototype.setOptions = function (name_div, value_div, color) {
                                                          this.color = color;
                                                      
                                                          if (this.name_div !== name_div) {
                                                              this.name_div = name_div;
                                                      Severity: Minor
                                                      Found in src/web/gui/src/dashboard.js/main.js - About 45 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

                                                      Function setup has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                                      Open

                                                          setup: function () {
                                                              if (this.isActive()) {
                                                                  if (this.state === null) {
                                                                      this.state = NETDATA.options.targets[0];
                                                                  }
                                                      Severity: Minor
                                                      Found in src/web/gui/src/dashboard.js/main.js - About 45 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

                                                      Function setMaster has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                                      Open

                                                          setMaster: function (state, after, before) {
                                                              this.delay();
                                                      
                                                              if (!NETDATA.options.current.sync_pan_and_zoom) {
                                                                  return;
                                                      Severity: Minor
                                                      Found in src/web/gui/src/dashboard.js/main.js - About 45 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

                                                      Function genLabel has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                      Open

                                                              const genLabel = function (state, parent, dim, name, count) {
                                                      Severity: Minor
                                                      Found in src/web/gui/src/dashboard.js/main.js - About 35 mins to fix

                                                        Function init has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                        Open

                                                            init: function (state, after, before, view_after, view_before) {
                                                        Severity: Minor
                                                        Found in src/web/gui/src/dashboard.js/main.js - About 35 mins to fix

                                                          Function set has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                          Open

                                                              set: function (state, after, before, view_after, view_before) {
                                                          Severity: Minor
                                                          Found in src/web/gui/src/dashboard.js/main.js - About 35 mins to fix

                                                            Function dimensionStatus has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                            Open

                                                            let dimensionStatus = function (parent, label, name_div, value_div, color) {
                                                            Severity: Minor
                                                            Found in src/web/gui/src/dashboard.js/main.js - About 35 mins to fix

                                                              Function selected2BooleanArray has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                              Open

                                                              dimensionsVisibility.prototype.selected2BooleanArray = function (array) {
                                                                  let ret = [];
                                                                  this.selected_count = 0;
                                                                  this.unselected_count = 0;
                                                              
                                                              
                                                              Severity: Minor
                                                              Found in src/web/gui/src/dashboard.js/main.js - About 35 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

                                                              Function setMaster has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                              Open

                                                                  setMaster: function (state) {
                                                                      if (!this.enabled()) {
                                                                          this.stop();
                                                                          return;
                                                                      }
                                                              Severity: Minor
                                                              Found in src/web/gui/src/dashboard.js/main.js - About 35 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

                                                              Avoid too many return statements within this function.
                                                              Open

                                                                          return true;
                                                              Severity: Major
                                                              Found in src/web/gui/src/dashboard.js/main.js - About 30 mins to fix

                                                                Avoid too many return statements within this function.
                                                                Open

                                                                                return false;
                                                                Severity: Major
                                                                Found in src/web/gui/src/dashboard.js/main.js - About 30 mins to fix

                                                                  Avoid too many return statements within this function.
                                                                  Open

                                                                          return;
                                                                  Severity: Major
                                                                  Found in src/web/gui/src/dashboard.js/main.js - About 30 mins to fix

                                                                    Avoid too many return statements within this function.
                                                                    Open

                                                                                return true;
                                                                    Severity: Major
                                                                    Found in src/web/gui/src/dashboard.js/main.js - About 30 mins to fix

                                                                      Avoid too many return statements within this function.
                                                                      Open

                                                                                  return false;
                                                                      Severity: Major
                                                                      Found in src/web/gui/src/dashboard.js/main.js - About 30 mins to fix

                                                                        Avoid too many return statements within this function.
                                                                        Open

                                                                                return data;
                                                                        Severity: Major
                                                                        Found in src/web/gui/src/dashboard.js/main.js - About 30 mins to fix

                                                                          Avoid too many return statements within this function.
                                                                          Open

                                                                                      return true;
                                                                          Severity: Major
                                                                          Found in src/web/gui/src/dashboard.js/main.js - About 30 mins to fix

                                                                            Avoid too many return statements within this function.
                                                                            Open

                                                                                    return;
                                                                            Severity: Major
                                                                            Found in src/web/gui/src/dashboard.js/main.js - About 30 mins to fix

                                                                              Avoid too many return statements within this function.
                                                                              Open

                                                                                          return;
                                                                              Severity: Major
                                                                              Found in src/web/gui/src/dashboard.js/main.js - About 30 mins to fix

                                                                                Avoid too many return statements within this function.
                                                                                Open

                                                                                                return;
                                                                                Severity: Major
                                                                                Found in src/web/gui/src/dashboard.js/main.js - About 30 mins to fix

                                                                                  Avoid too many return statements within this function.
                                                                                  Open

                                                                                              return false;
                                                                                  Severity: Major
                                                                                  Found in src/web/gui/src/dashboard.js/main.js - About 30 mins to fix

                                                                                    Avoid too many return statements within this function.
                                                                                    Open

                                                                                                    return true;
                                                                                    Severity: Major
                                                                                    Found in src/web/gui/src/dashboard.js/main.js - About 30 mins to fix

                                                                                      Avoid too many return statements within this function.
                                                                                      Open

                                                                                                  return false;
                                                                                      Severity: Major
                                                                                      Found in src/web/gui/src/dashboard.js/main.js - About 30 mins to fix

                                                                                        Avoid too many return statements within this function.
                                                                                        Open

                                                                                                    return null;
                                                                                        Severity: Major
                                                                                        Found in src/web/gui/src/dashboard.js/main.js - About 30 mins to fix

                                                                                          Avoid too many return statements within this function.
                                                                                          Open

                                                                                                          return this.library.initialize(function () {
                                                                                                              return that.updateChart(callback);
                                                                                                          });
                                                                                          Severity: Major
                                                                                          Found in src/web/gui/src/dashboard.js/main.js - About 30 mins to fix

                                                                                            Avoid too many return statements within this function.
                                                                                            Open

                                                                                                        return false;
                                                                                            Severity: Major
                                                                                            Found in src/web/gui/src/dashboard.js/main.js - About 30 mins to fix

                                                                                              Avoid too many return statements within this function.
                                                                                              Open

                                                                                                              return callback(false, 'cannot be rendered');
                                                                                              Severity: Major
                                                                                              Found in src/web/gui/src/dashboard.js/main.js - About 30 mins to fix

                                                                                                Avoid too many return statements within this function.
                                                                                                Open

                                                                                                        return;
                                                                                                Severity: Major
                                                                                                Found in src/web/gui/src/dashboard.js/main.js - About 30 mins to fix

                                                                                                  Avoid too many return statements within this function.
                                                                                                  Open

                                                                                                                      return;
                                                                                                  Severity: Major
                                                                                                  Found in src/web/gui/src/dashboard.js/main.js - About 30 mins to fix

                                                                                                    Avoid too many return statements within this function.
                                                                                                    Open

                                                                                                                return this.getChart(function () {
                                                                                                                    return that.updateChart(callback);
                                                                                                                });
                                                                                                    Severity: Major
                                                                                                    Found in src/web/gui/src/dashboard.js/main.js - About 30 mins to fix

                                                                                                      Avoid too many return statements within this function.
                                                                                                      Open

                                                                                                                          return callback(false, 'library not available');
                                                                                                      Severity: Major
                                                                                                      Found in src/web/gui/src/dashboard.js/main.js - About 30 mins to fix

                                                                                                        Avoid too many return statements within this function.
                                                                                                        Open

                                                                                                                return false;
                                                                                                        Severity: Major
                                                                                                        Found in src/web/gui/src/dashboard.js/main.js - About 30 mins to fix

                                                                                                          Avoid too many return statements within this function.
                                                                                                          Open

                                                                                                                      return;
                                                                                                          Severity: Major
                                                                                                          Found in src/web/gui/src/dashboard.js/main.js - About 30 mins to fix

                                                                                                            Avoid too many return statements within this function.
                                                                                                            Open

                                                                                                                        return false;
                                                                                                            Severity: Major
                                                                                                            Found in src/web/gui/src/dashboard.js/main.js - About 30 mins to fix

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

                                                                                                              NETDATA.abortAllRefreshes = function () {
                                                                                                                  let targets = NETDATA.options.targets;
                                                                                                                  let len = targets.length;
                                                                                                              
                                                                                                                  while (len--) {
                                                                                                              Severity: Minor
                                                                                                              Found in src/web/gui/src/dashboard.js/main.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

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

                                                                                                                  delay: function (ms) {
                                                                                                                      if (NETDATA.options.current.sync_selection) {
                                                                                                                          // if (NETDATA.options.debug.globalSelectionSync === true) {
                                                                                                                          if (NETDATA.options.debug.globalSelectionSync) {
                                                                                                                              console.log('globalSelectionSync.delay()');
                                                                                                              Severity: Minor
                                                                                                              Found in src/web/gui/src/dashboard.js/main.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

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

                                                                                                              NETDATA._loadjQuery = function (callback) {
                                                                                                                  if (typeof jQuery === 'undefined') {
                                                                                                                      if (NETDATA.options.debug.main_loop) {
                                                                                                                          console.log('loading ' + NETDATA.jQuery);
                                                                                                                      }
                                                                                                              Severity: Minor
                                                                                                              Found in src/web/gui/src/dashboard.js/main.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

                                                                                                              Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                              Open

                                                                                                              let chartState = function (element) {
                                                                                                                  this.element = element;
                                                                                                              
                                                                                                                  // IMPORTANT:
                                                                                                                  // all private functions should use 'that', instead of 'this'
                                                                                                              Severity: Major
                                                                                                              Found in src/web/gui/src/dashboard.js/main.js and 1 other location - About 5 mos to fix
                                                                                                              src/web/gui/v1/dashboard.js on lines 6129..9019

                                                                                                              Duplicated Code

                                                                                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                              Tuning

                                                                                                              This issue has a mass of 24742.

                                                                                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                              Refactorings

                                                                                                              Further Reading

                                                                                                              Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                              Open

                                                                                                              NETDATA.globalSelectionSync = {
                                                                                                                  state: null,
                                                                                                                  dontSyncBefore: 0,
                                                                                                                  last_t: 0,
                                                                                                                  slaves: [],
                                                                                                              Severity: Major
                                                                                                              Found in src/web/gui/src/dashboard.js/main.js and 1 other location - About 6 days to fix
                                                                                                              src/web/gui/v1/dashboard.js on lines 5855..6006

                                                                                                              Duplicated Code

                                                                                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                              Tuning

                                                                                                              This issue has a mass of 1135.

                                                                                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                              Refactorings

                                                                                                              Further Reading

                                                                                                              Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                              Open

                                                                                                              NETDATA.intersectionObserver = {
                                                                                                                  observer: null,
                                                                                                                  visible_targets: [],
                                                                                                              
                                                                                                                  options: {
                                                                                                              Severity: Major
                                                                                                              Found in src/web/gui/src/dashboard.js/main.js and 1 other location - About 5 days to fix
                                                                                                              src/web/gui/v1/dashboard.js on lines 6008..6123

                                                                                                              Duplicated Code

                                                                                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                              Tuning

                                                                                                              This issue has a mass of 916.

                                                                                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                              Refactorings

                                                                                                              Further Reading

                                                                                                              Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                              Open

                                                                                                              NETDATA.chartRefresher = function () {
                                                                                                                  // console.log('chartRefresher() begin ' + (Date.now() - NETDATA.chartRefresherLastRun).toString() + ' ms since last run');
                                                                                                              
                                                                                                                  if (NETDATA.options.page_is_visible === false
                                                                                                                      && NETDATA.options.current.stop_updates_when_focus_is_lost
                                                                                                              Severity: Major
                                                                                                              Found in src/web/gui/src/dashboard.js/main.js and 1 other location - About 5 days to fix
                                                                                                              src/web/gui/v1/dashboard.js on lines 9213..9349

                                                                                                              Duplicated Code

                                                                                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                              Tuning

                                                                                                              This issue has a mass of 878.

                                                                                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                              Refactorings

                                                                                                              Further Reading

                                                                                                              Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                              Open

                                                                                                              NETDATA.globalPanAndZoom = {
                                                                                                                  seq: 0,                 // timestamp ms
                                                                                                                                          // every time a chart is panned or zoomed
                                                                                                                                          // we set the timestamp here
                                                                                                                                          // then we use it as a sequence number
                                                                                                              Severity: Major
                                                                                                              Found in src/web/gui/src/dashboard.js/main.js and 1 other location - About 5 days to fix
                                                                                                              src/web/gui/v1/dashboard.js on lines 5318..5430

                                                                                                              Duplicated Code

                                                                                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                              Tuning

                                                                                                              This issue has a mass of 845.

                                                                                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                              Refactorings

                                                                                                              Further Reading

                                                                                                              Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                              Open

                                                                                                              NETDATA.globalChartUnderlay = {
                                                                                                                  callback: null,         // what to call when a highlighted range is setup
                                                                                                                  after: null,            // highlight after this time
                                                                                                                  before: null,           // highlight before this time
                                                                                                                  view_after: null,       // the charts after_ms viewport when the highlight was setup
                                                                                                              Severity: Major
                                                                                                              Found in src/web/gui/src/dashboard.js/main.js and 1 other location - About 4 days to fix
                                                                                                              src/web/gui/v1/dashboard.js on lines 5435..5518

                                                                                                              Duplicated Code

                                                                                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                              Tuning

                                                                                                              This issue has a mass of 824.

                                                                                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                              Refactorings

                                                                                                              Further Reading

                                                                                                              Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                              Open

                                                                                                              NETDATA.dateTime = {
                                                                                                                  using_timezone: false,
                                                                                                              
                                                                                                                  // these are the old netdata functions
                                                                                                                  // we fallback to these, if the new ones fail
                                                                                                              Severity: Major
                                                                                                              Found in src/web/gui/src/dashboard.js/main.js and 1 other location - About 4 days to fix
                                                                                                              src/web/gui/v1/dashboard.js on lines 5736..5849

                                                                                                              Duplicated Code

                                                                                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                              Tuning

                                                                                                              This issue has a mass of 777.

                                                                                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                              Refactorings

                                                                                                              Further Reading

                                                                                                              Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                              Open

                                                                                                              NETDATA.start = function () {
                                                                                                                  // this should be called only once
                                                                                                              
                                                                                                                  if (NETDATA.started) {
                                                                                                                      console.log('netdata is already started');
                                                                                                              Severity: Major
                                                                                                              Found in src/web/gui/src/dashboard.js/main.js and 1 other location - About 3 days to fix
                                                                                                              src/web/gui/v1/dashboard.js on lines 9388..9450

                                                                                                              Duplicated Code

                                                                                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                              Tuning

                                                                                                              This issue has a mass of 521.

                                                                                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                              Refactorings

                                                                                                              Further Reading

                                                                                                              Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                              Open

                                                                                                              NETDATA.chartRefresherNoParallel = function (index, callback) {
                                                                                                                  let targets = NETDATA.intersectionObserver.targets();
                                                                                                              
                                                                                                                  if (NETDATA.options.debug.main_loop) {
                                                                                                                      console.log('NETDATA.chartRefresherNoParallel(' + index + ')');
                                                                                                              Severity: Major
                                                                                                              Found in src/web/gui/src/dashboard.js/main.js and 1 other location - About 2 days to fix
                                                                                                              src/web/gui/v1/dashboard.js on lines 9142..9192

                                                                                                              Duplicated Code

                                                                                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                              Tuning

                                                                                                              This issue has a mass of 445.

                                                                                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                              Refactorings

                                                                                                              Further Reading

                                                                                                              Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                              Open

                                                                                                              dimensionStatus.prototype.setHandler = function () {
                                                                                                                  if (!this.enabled) {
                                                                                                                      return;
                                                                                                                  }
                                                                                                              
                                                                                                              
                                                                                                              Severity: Major
                                                                                                              Found in src/web/gui/src/dashboard.js/main.js and 1 other location - About 1 day to fix
                                                                                                              src/web/gui/v1/dashboard.js on lines 5573..5616

                                                                                                              Duplicated Code

                                                                                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                              Tuning

                                                                                                              This issue has a mass of 326.

                                                                                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                              Refactorings

                                                                                                              Further Reading

                                                                                                              Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                              Open

                                                                                                              NETDATA.parseDom = function (callback) {
                                                                                                                  //console.log('parseDom()');
                                                                                                              
                                                                                                                  NETDATA.options.last_page_scroll = Date.now();
                                                                                                                  NETDATA.options.updated_dom = false;
                                                                                                              Severity: Major
                                                                                                              Found in src/web/gui/src/dashboard.js/main.js and 1 other location - About 1 day to fix
                                                                                                              src/web/gui/v1/dashboard.js on lines 9351..9384

                                                                                                              Duplicated Code

                                                                                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                              Tuning

                                                                                                              This issue has a mass of 301.

                                                                                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                              Refactorings

                                                                                                              Further Reading

                                                                                                              Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                              Open

                                                                                                              dimensionStatus.prototype.setOptions = function (name_div, value_div, color) {
                                                                                                                  this.color = color;
                                                                                                              
                                                                                                                  if (this.name_div !== name_div) {
                                                                                                                      this.name_div = name_div;
                                                                                                              Severity: Major
                                                                                                              Found in src/web/gui/src/dashboard.js/main.js and 1 other location - About 1 day to fix
                                                                                                              src/web/gui/v1/dashboard.js on lines 5544..5571

                                                                                                              Duplicated Code

                                                                                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                              Tuning

                                                                                                              This issue has a mass of 289.

                                                                                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                              Refactorings

                                                                                                              Further Reading

                                                                                                              Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                              Open

                                                                                                              NETDATA._loadjQuery = function (callback) {
                                                                                                                  if (typeof jQuery === 'undefined') {
                                                                                                                      if (NETDATA.options.debug.main_loop) {
                                                                                                                          console.log('loading ' + NETDATA.jQuery);
                                                                                                                      }
                                                                                                              Severity: Major
                                                                                                              Found in src/web/gui/src/dashboard.js/main.js and 1 other location - About 1 day to fix
                                                                                                              src/web/gui/v1/dashboard.js on lines 9066..9095

                                                                                                              Duplicated Code

                                                                                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                              Tuning

                                                                                                              This issue has a mass of 265.

                                                                                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                              Refactorings

                                                                                                              Further Reading

                                                                                                              Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                              Open

                                                                                                              dimensionsVisibility.prototype.selected2BooleanArray = function (array) {
                                                                                                                  let ret = [];
                                                                                                                  this.selected_count = 0;
                                                                                                                  this.unselected_count = 0;
                                                                                                              
                                                                                                              
                                                                                                              Severity: Major
                                                                                                              Found in src/web/gui/src/dashboard.js/main.js and 1 other location - About 1 day to fix
                                                                                                              src/web/gui/v1/dashboard.js on lines 5705..5731

                                                                                                              Duplicated Code

                                                                                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                              Tuning

                                                                                                              This issue has a mass of 229.

                                                                                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                              Refactorings

                                                                                                              Further Reading

                                                                                                              Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                              Open

                                                                                                              NETDATA.onscrollUpdater = function () {
                                                                                                                  NETDATA.globalSelectionSync.stop();
                                                                                                              
                                                                                                                  if (NETDATA.options.abort_ajax_on_scroll) {
                                                                                                                      NETDATA.abortAllRefreshes();
                                                                                                              Severity: Major
                                                                                                              Found in src/web/gui/src/dashboard.js/main.js and 1 other location - About 7 hrs to fix
                                                                                                              src/web/gui/v1/dashboard.js on lines 5238..5264

                                                                                                              Duplicated Code

                                                                                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                              Tuning

                                                                                                              This issue has a mass of 182.

                                                                                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                              Refactorings

                                                                                                              Further Reading

                                                                                                              Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                              Open

                                                                                                              NETDATA.globalReset = function () {
                                                                                                                  NETDATA.intersectionObserver.globalReset();
                                                                                                                  NETDATA.globalSelectionSync.globalReset();
                                                                                                                  NETDATA.globalPanAndZoom.globalReset();
                                                                                                                  NETDATA.chartRegistry.globalReset();
                                                                                                              Severity: Major
                                                                                                              Found in src/web/gui/src/dashboard.js/main.js and 1 other location - About 6 hrs to fix
                                                                                                              src/web/gui/v1/dashboard.js on lines 9452..9464

                                                                                                              Duplicated Code

                                                                                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                              Tuning

                                                                                                              This issue has a mass of 163.

                                                                                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                              Refactorings

                                                                                                              Further Reading

                                                                                                              Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                              Open

                                                                                                              NETDATA.supportsPassiveEvents = function () {
                                                                                                                  if (NETDATA.options.passive_events === null) {
                                                                                                                      let supportsPassive = false;
                                                                                                                      try {
                                                                                                                          let opts = Object.defineProperty({}, 'passive', {
                                                                                                              Severity: Major
                                                                                                              Found in src/web/gui/src/dashboard.js/main.js and 1 other location - About 5 hrs to fix
                                                                                                              src/web/gui/v1/dashboard.js on lines 5285..5304

                                                                                                              Duplicated Code

                                                                                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                              Tuning

                                                                                                              This issue has a mass of 146.

                                                                                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                              Refactorings

                                                                                                              Further Reading

                                                                                                              Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                              Open

                                                                                                              NETDATA.resetAllCharts = function (state) {
                                                                                                                  // first clear the global selection sync
                                                                                                                  // to make sure no chart is in selected state
                                                                                                                  NETDATA.globalSelectionSync.stop();
                                                                                                              
                                                                                                              
                                                                                                              Severity: Major
                                                                                                              Found in src/web/gui/src/dashboard.js/main.js and 1 other location - About 5 hrs to fix
                                                                                                              src/web/gui/v1/dashboard.js on lines 9021..9047

                                                                                                              Duplicated Code

                                                                                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                              Tuning

                                                                                                              This issue has a mass of 138.

                                                                                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                              Refactorings

                                                                                                              Further Reading

                                                                                                              Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                              Open

                                                                                                              NETDATA.onscroll = function () {
                                                                                                                  //console.log('onscroll() begin');
                                                                                                              
                                                                                                                  NETDATA.onscrollStartDelay();
                                                                                                                  NETDATA.chartRefresherReschedule();
                                                                                                              Severity: Major
                                                                                                              Found in src/web/gui/src/dashboard.js/main.js and 1 other location - About 5 hrs to fix
                                                                                                              src/web/gui/v1/dashboard.js on lines 5268..5283

                                                                                                              Duplicated Code

                                                                                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                              Tuning

                                                                                                              This issue has a mass of 136.

                                                                                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                              Refactorings

                                                                                                              Further Reading

                                                                                                              Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                              Open

                                                                                                              NETDATA.abortAllRefreshes = function () {
                                                                                                                  let targets = NETDATA.options.targets;
                                                                                                                  let len = targets.length;
                                                                                                              
                                                                                                                  while (len--) {
                                                                                                              Severity: Major
                                                                                                              Found in src/web/gui/src/dashboard.js/main.js and 1 other location - About 5 hrs to fix
                                                                                                              src/web/gui/v1/dashboard.js on lines 5208..5221

                                                                                                              Duplicated Code

                                                                                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                              Tuning

                                                                                                              This issue has a mass of 135.

                                                                                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                              Refactorings

                                                                                                              Further Reading

                                                                                                              Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                              Open

                                                                                                              let dimensionStatus = function (parent, label, name_div, value_div, color) {
                                                                                                                  this.enabled = false;
                                                                                                                  this.parent = parent;
                                                                                                                  this.label = label;
                                                                                                                  this.name_div = null;
                                                                                                              Severity: Major
                                                                                                              Found in src/web/gui/src/dashboard.js/main.js and 1 other location - About 4 hrs to fix
                                                                                                              src/web/gui/v1/dashboard.js on lines 5526..5536

                                                                                                              Duplicated Code

                                                                                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                              Tuning

                                                                                                              This issue has a mass of 132.

                                                                                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                              Refactorings

                                                                                                              Further Reading

                                                                                                              Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                              Open

                                                                                                              dimensionsVisibility.prototype.dimensionAdd = function (label, name_div, value_div, color) {
                                                                                                                  if (typeof this.dimensions[label] === 'undefined') {
                                                                                                                      this.len++;
                                                                                                                      this.dimensions[label] = new dimensionStatus(this, label, name_div, value_div, color);
                                                                                                                  } else {
                                                                                                              Severity: Major
                                                                                                              Found in src/web/gui/src/dashboard.js/main.js and 1 other location - About 3 hrs to fix
                                                                                                              src/web/gui/v1/dashboard.js on lines 5653..5662

                                                                                                              Duplicated Code

                                                                                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                              Tuning

                                                                                                              This issue has a mass of 113.

                                                                                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                              Refactorings

                                                                                                              Further Reading

                                                                                                              Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                              Open

                                                                                                              NETDATA._loadCSS = function (filename) {
                                                                                                                  // don't use jQuery here
                                                                                                                  // styles are loaded before jQuery
                                                                                                                  // to eliminate showing an unstyled page to the user
                                                                                                              
                                                                                                              
                                                                                                              Severity: Major
                                                                                                              Found in src/web/gui/src/dashboard.js/main.js and 1 other location - About 3 hrs to fix
                                                                                                              src/web/gui/v1/dashboard.js on lines 9097..9110

                                                                                                              Duplicated Code

                                                                                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                              Tuning

                                                                                                              This issue has a mass of 111.

                                                                                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                              Refactorings

                                                                                                              Further Reading

                                                                                                              Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                              Open

                                                                                                              NETDATA.chartRefresherReschedule = function () {
                                                                                                                  if (NETDATA.options.current.async_on_scroll) {
                                                                                                                      if (NETDATA.chartRefresherTimeoutId) {
                                                                                                                          NETDATA.timeout.clear(NETDATA.chartRefresherTimeoutId);
                                                                                                                      }
                                                                                                              Severity: Major
                                                                                                              Found in src/web/gui/src/dashboard.js/main.js and 1 other location - About 3 hrs to fix
                                                                                                              src/web/gui/v1/dashboard.js on lines 9203..9211

                                                                                                              Duplicated Code

                                                                                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                              Tuning

                                                                                                              This issue has a mass of 107.

                                                                                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                              Refactorings

                                                                                                              Further Reading

                                                                                                              Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                              Open

                                                                                                              dimensionsVisibility.prototype.countSelected = function () {
                                                                                                                  let selected = 0;
                                                                                                                  let keys = Object.keys(this.dimensions);
                                                                                                                  let len = keys.length;
                                                                                                                  while (len--) {
                                                                                                              Severity: Major
                                                                                                              Found in src/web/gui/src/dashboard.js/main.js and 1 other location - About 3 hrs to fix
                                                                                                              src/web/gui/v1/dashboard.js on lines 5684..5695

                                                                                                              Duplicated Code

                                                                                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                              Tuning

                                                                                                              This issue has a mass of 100.

                                                                                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                              Refactorings

                                                                                                              Further Reading

                                                                                                              Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                              Open

                                                                                                              NETDATA.chartState = function (element) {
                                                                                                                  let self = $(element);
                                                                                                              
                                                                                                                  let state = self.data('netdata-state-object') || null;
                                                                                                                  if (state === null) {
                                                                                                              Severity: Major
                                                                                                              Found in src/web/gui/src/dashboard.js/main.js and 1 other location - About 2 hrs to fix
                                                                                                              src/web/gui/v1/dashboard.js on lines 9050..9059

                                                                                                              Duplicated Code

                                                                                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                              Tuning

                                                                                                              This issue has a mass of 91.

                                                                                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                              Refactorings

                                                                                                              Further Reading

                                                                                                              Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                              Open

                                                                                                              NETDATA.onscrollStartDelay = function () {
                                                                                                                  NETDATA.options.last_page_scroll = Date.now();
                                                                                                              
                                                                                                                  NETDATA.options.on_scroll_refresher_stop_until =
                                                                                                                      NETDATA.options.last_page_scroll
                                                                                                              Severity: Major
                                                                                                              Found in src/web/gui/src/dashboard.js/main.js and 1 other location - About 2 hrs to fix
                                                                                                              src/web/gui/v1/dashboard.js on lines 5223..5229

                                                                                                              Duplicated Code

                                                                                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                              Tuning

                                                                                                              This issue has a mass of 83.

                                                                                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                              Refactorings

                                                                                                              Further Reading

                                                                                                              Similar blocks of code found in 6 locations. Consider refactoring.
                                                                                                              Open

                                                                                                              dimensionsVisibility.prototype.selectAll = function () {
                                                                                                                  let keys = Object.keys(this.dimensions);
                                                                                                                  let len = keys.length;
                                                                                                                  while (len--) {
                                                                                                                      this.dimensions[keys[len]].select();
                                                                                                              Severity: Major
                                                                                                              Found in src/web/gui/src/dashboard.js/main.js and 5 other locations - About 2 hrs to fix
                                                                                                              src/web/gui/src/dashboard.js/main.js on lines 482..488
                                                                                                              src/web/gui/src/dashboard.js/main.js on lines 511..517
                                                                                                              src/web/gui/v1/dashboard.js on lines 5668..5674
                                                                                                              src/web/gui/v1/dashboard.js on lines 5676..5682
                                                                                                              src/web/gui/v1/dashboard.js on lines 5697..5703

                                                                                                              Duplicated Code

                                                                                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                              Tuning

                                                                                                              This issue has a mass of 81.

                                                                                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                              Refactorings

                                                                                                              Further Reading

                                                                                                              Similar blocks of code found in 6 locations. Consider refactoring.
                                                                                                              Open

                                                                                                              dimensionsVisibility.prototype.invalidateAll = function () {
                                                                                                                  let keys = Object.keys(this.dimensions);
                                                                                                                  let len = keys.length;
                                                                                                                  while (len--) {
                                                                                                                      this.dimensions[keys[len]].invalidate();
                                                                                                              Severity: Major
                                                                                                              Found in src/web/gui/src/dashboard.js/main.js and 5 other locations - About 2 hrs to fix
                                                                                                              src/web/gui/src/dashboard.js/main.js on lines 490..496
                                                                                                              src/web/gui/src/dashboard.js/main.js on lines 511..517
                                                                                                              src/web/gui/v1/dashboard.js on lines 5668..5674
                                                                                                              src/web/gui/v1/dashboard.js on lines 5676..5682
                                                                                                              src/web/gui/v1/dashboard.js on lines 5697..5703

                                                                                                              Duplicated Code

                                                                                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                              Tuning

                                                                                                              This issue has a mass of 81.

                                                                                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                              Refactorings

                                                                                                              Further Reading

                                                                                                              Similar blocks of code found in 6 locations. Consider refactoring.
                                                                                                              Open

                                                                                                              dimensionsVisibility.prototype.selectNone = function () {
                                                                                                                  let keys = Object.keys(this.dimensions);
                                                                                                                  let len = keys.length;
                                                                                                                  while (len--) {
                                                                                                                      this.dimensions[keys[len]].unselect();
                                                                                                              Severity: Major
                                                                                                              Found in src/web/gui/src/dashboard.js/main.js and 5 other locations - About 2 hrs to fix
                                                                                                              src/web/gui/src/dashboard.js/main.js on lines 482..488
                                                                                                              src/web/gui/src/dashboard.js/main.js on lines 490..496
                                                                                                              src/web/gui/v1/dashboard.js on lines 5668..5674
                                                                                                              src/web/gui/v1/dashboard.js on lines 5676..5682
                                                                                                              src/web/gui/v1/dashboard.js on lines 5697..5703

                                                                                                              Duplicated Code

                                                                                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                              Tuning

                                                                                                              This issue has a mass of 81.

                                                                                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                              Refactorings

                                                                                                              Further Reading

                                                                                                              Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                              Open

                                                                                                              NETDATA.onresize = function () {
                                                                                                                  NETDATA.options.last_page_resize = Date.now();
                                                                                                                  NETDATA.onscroll();
                                                                                                              
                                                                                                                  if (typeof NETDATA.onresizeCallback === 'function') {
                                                                                                              Severity: Major
                                                                                                              Found in src/web/gui/src/dashboard.js/main.js and 1 other location - About 2 hrs to fix
                                                                                                              src/web/gui/v1/dashboard.js on lines 5199..5206

                                                                                                              Duplicated Code

                                                                                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                              Tuning

                                                                                                              This issue has a mass of 75.

                                                                                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                              Refactorings

                                                                                                              Further Reading

                                                                                                              Similar blocks of code found in 4 locations. Consider refactoring.
                                                                                                              Open

                                                                                                              dimensionStatus.prototype.select = function () {
                                                                                                                  if (!this.enabled) {
                                                                                                                      return;
                                                                                                                  }
                                                                                                              
                                                                                                              
                                                                                                              Severity: Major
                                                                                                              Found in src/web/gui/src/dashboard.js/main.js and 3 other locations - About 2 hrs to fix
                                                                                                              src/web/gui/src/dashboard.js/main.js on lines 442..450
                                                                                                              src/web/gui/v1/dashboard.js on lines 5618..5626
                                                                                                              src/web/gui/v1/dashboard.js on lines 5628..5636

                                                                                                              Duplicated Code

                                                                                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                              Tuning

                                                                                                              This issue has a mass of 75.

                                                                                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                              Refactorings

                                                                                                              Further Reading

                                                                                                              Similar blocks of code found in 4 locations. Consider refactoring.
                                                                                                              Open

                                                                                                              dimensionStatus.prototype.unselect = function () {
                                                                                                                  if (!this.enabled) {
                                                                                                                      return;
                                                                                                                  }
                                                                                                              
                                                                                                              
                                                                                                              Severity: Major
                                                                                                              Found in src/web/gui/src/dashboard.js/main.js and 3 other locations - About 2 hrs to fix
                                                                                                              src/web/gui/src/dashboard.js/main.js on lines 432..440
                                                                                                              src/web/gui/v1/dashboard.js on lines 5618..5626
                                                                                                              src/web/gui/v1/dashboard.js on lines 5628..5636

                                                                                                              Duplicated Code

                                                                                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                              Tuning

                                                                                                              This issue has a mass of 75.

                                                                                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                              Refactorings

                                                                                                              Further Reading

                                                                                                              Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                              Open

                                                                                                              NETDATA.onscrollEndDelay = function () {
                                                                                                                  NETDATA.options.on_scroll_refresher_stop_until =
                                                                                                                      Date.now()
                                                                                                                      + (NETDATA.options.current.async_on_scroll ? NETDATA.options.current.onscroll_worker_duration_threshold : 0);
                                                                                                              };
                                                                                                              Severity: Major
                                                                                                              Found in src/web/gui/src/dashboard.js/main.js and 1 other location - About 1 hr to fix
                                                                                                              src/web/gui/v1/dashboard.js on lines 5231..5235

                                                                                                              Duplicated Code

                                                                                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                              Tuning

                                                                                                              This issue has a mass of 72.

                                                                                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                              Refactorings

                                                                                                              Further Reading

                                                                                                              Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                              Open

                                                                                                              let dimensionsVisibility = function (state) {
                                                                                                                  this.state = state;
                                                                                                                  this.len = 0;
                                                                                                                  this.dimensions = {};
                                                                                                                  this.selected_count = 0;
                                                                                                              Severity: Major
                                                                                                              Found in src/web/gui/src/dashboard.js/main.js and 1 other location - About 1 hr to fix
                                                                                                              src/web/gui/v1/dashboard.js on lines 5645..5651

                                                                                                              Duplicated Code

                                                                                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                              Tuning

                                                                                                              This issue has a mass of 71.

                                                                                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                              Refactorings

                                                                                                              Further Reading

                                                                                                              Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                              Open

                                                                                                              NETDATA.pause = function (callback) {
                                                                                                                  if (typeof callback === 'function') {
                                                                                                                      if (NETDATA.options.pause) {
                                                                                                                          return callback();
                                                                                                                      } else {
                                                                                                              Severity: Major
                                                                                                              Found in src/web/gui/src/dashboard.js/main.js and 1 other location - About 1 hr to fix
                                                                                                              src/web/gui/v1/dashboard.js on lines 9122..9130

                                                                                                              Duplicated Code

                                                                                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                              Tuning

                                                                                                              This issue has a mass of 70.

                                                                                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                              Refactorings

                                                                                                              Further Reading

                                                                                                              Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                              Open

                                                                                                              NETDATA.unpause = function () {
                                                                                                                  NETDATA.options.pauseCallback = null;
                                                                                                                  NETDATA.options.updated_dom = true;
                                                                                                                  NETDATA.options.pause = false;
                                                                                                              };
                                                                                                              Severity: Major
                                                                                                              Found in src/web/gui/src/dashboard.js/main.js and 1 other location - About 1 hr to fix
                                                                                                              src/web/gui/v1/dashboard.js on lines 9132..9136

                                                                                                              Duplicated Code

                                                                                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                              Tuning

                                                                                                              This issue has a mass of 65.

                                                                                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                              Refactorings

                                                                                                              Further Reading

                                                                                                              Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                              Open

                                                                                                              dimensionStatus.prototype.invalidate = function () {
                                                                                                                  this.name_div = null;
                                                                                                                  this.value_div = null;
                                                                                                                  this.enabled = false;
                                                                                                              };
                                                                                                              Severity: Minor
                                                                                                              Found in src/web/gui/src/dashboard.js/main.js and 1 other location - About 55 mins to fix
                                                                                                              src/web/gui/v1/dashboard.js on lines 5538..5542

                                                                                                              Duplicated Code

                                                                                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                              Tuning

                                                                                                              This issue has a mass of 53.

                                                                                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                              Refactorings

                                                                                                              Further Reading

                                                                                                              There are no issues that match your filters.

                                                                                                              Category
                                                                                                              Status