netdata/netdata

View on GitHub
src/web/gui/src/dashboard.js/charting/dygraph.js

Summary

Maintainability
F
2 mos
Test Coverage

Function dygraphChartCreate has a Cognitive Complexity of 205 (exceeds 5 allowed). Consider refactoring.
Open

NETDATA.dygraphChartCreate = function (state, data) {
    if (NETDATA.options.debug.dygraph || state.debug) {
        state.log('dygraphChartCreate()');
    }

Severity: Minor
Found in src/web/gui/src/dashboard.js/charting/dygraph.js - About 4 days 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 dygraphChartCreate has 556 lines of code (exceeds 25 allowed). Consider refactoring.
Open

NETDATA.dygraphChartCreate = function (state, data) {
    if (NETDATA.options.debug.dygraph || state.debug) {
        state.log('dygraphChartCreate()');
    }

Severity: Major
Found in src/web/gui/src/dashboard.js/charting/dygraph.js - About 2 days to fix

    File dygraph.js has 762 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    // dygraph
    
    // Codacy declarations
    /* global smoothPlotter */
    /* global Dygraph */
    Severity: Major
    Found in src/web/gui/src/dashboard.js/charting/dygraph.js - About 1 day to fix

      Function dygraphChartUpdate has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
      Open

      NETDATA.dygraphChartUpdate = function (state, data) {
          let dygraph = state.tmp.dygraph_instance;
      
          if (typeof dygraph === 'undefined') {
              return NETDATA.dygraphChartCreate(state, data);
      Severity: Minor
      Found in src/web/gui/src/dashboard.js/charting/dygraph.js - About 5 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 dygraphChartUpdate has 80 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      NETDATA.dygraphChartUpdate = function (state, data) {
          let dygraph = state.tmp.dygraph_instance;
      
          if (typeof dygraph === 'undefined') {
              return NETDATA.dygraphChartCreate(state, data);
      Severity: Major
      Found in src/web/gui/src/dashboard.js/charting/dygraph.js - About 3 hrs to fix

        Function wheel has 71 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                    wheel: function (event, dygraph, context) {
                        void(context);
        
                        if (NETDATA.options.debug.dygraph || state.debug) {
                            state.log('interactionModel.wheel()');
        Severity: Major
        Found in src/web/gui/src/dashboard.js/charting/dygraph.js - About 2 hrs to fix

          Function mousedown has 49 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                      mousedown: function (event, dygraph, context) {
                          if (NETDATA.options.debug.dygraph || state.debug) {
                              state.log('interactionModel.mousedown()');
                          }
          
          
          Severity: Minor
          Found in src/web/gui/src/dashboard.js/charting/dygraph.js - About 1 hr to fix

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

                        mouseup: function (event, dygraph, context) {
                            state.tmp.dygraph_mouse_down = false;
            
                            if (NETDATA.options.debug.dygraph || state.debug) {
                                state.log('interactionModel.mouseup()');
            Severity: Minor
            Found in src/web/gui/src/dashboard.js/charting/dygraph.js - About 1 hr to fix

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

              NETDATA.dygraphGetSeriesStyle = function(dygraphOptions) {
                  const seriesStyleStr = dygraphOptions.perSeriesStyle;
                  let formattedStyles = {};
              
                  if (seriesStyleStr === '') {
              Severity: Minor
              Found in src/web/gui/src/dashboard.js/charting/dygraph.js - About 1 hr to fix

                Function underlayCallback has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        underlayCallback: function (canvas, area, g) {
                            // the chart is about to be drawn
                
                            // update history_tip_element
                            if (state.tmp.dygraph_history_tip_element) {
                Severity: Minor
                Found in src/web/gui/src/dashboard.js/charting/dygraph.js - About 1 hr to fix

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

                              touchend: function (event, dygraph, context) {
                                  state.tmp.dygraph_mouse_down = false;
                  
                                  if (NETDATA.options.debug.dygraph || state.debug) {
                                      state.log('interactionModel.touchend()');
                  Severity: Minor
                  Found in src/web/gui/src/dashboard.js/charting/dygraph.js - About 1 hr to fix

                    Function axisLabelFormatter has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                                    axisLabelFormatter: function (y) {
                    
                                        // unfortunately, we have to call this every single time
                                        state.legendFormatValueDecimalsFromMinMax(
                                            this.axes_[0].extremeRange[0],
                    Severity: Minor
                    Found in src/web/gui/src/dashboard.js/charting/dygraph.js - About 1 hr to fix

                      Function dygraphInitialize has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      NETDATA.dygraphInitialize = function (callback) {
                          if (typeof netdataNoDygraphs === 'undefined' || !netdataNoDygraphs) {
                              $.ajax({
                                  url: NETDATA.dygraph_js,
                                  cache: true,
                      Severity: Minor
                      Found in src/web/gui/src/dashboard.js/charting/dygraph.js - About 1 hr to fix

                        Consider simplifying this complex logical expression.
                        Open

                                                    if (typeof this.plugins_[len].plugin.ylabel_div_ !== 'undefined'
                                                        && this.plugins_[len].plugin.ylabel_div_ !== null
                                                        && typeof this.plugins_[len].plugin.ylabel_div_.children !== 'undefined'
                                                        && this.plugins_[len].plugin.ylabel_div_.children !== null
                                                        && typeof this.plugins_[len].plugin.ylabel_div_.children[0].children !== 'undefined'
                        Severity: Major
                        Found in src/web/gui/src/dashboard.js/charting/dygraph.js - About 40 mins to fix

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

                                  highlightCallback: function (event, x, points, row, seriesName) {
                          Severity: Minor
                          Found in src/web/gui/src/dashboard.js/charting/dygraph.js - About 35 mins to fix

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

                            NETDATA.dygraphGetSeriesStyle = function(dygraphOptions) {
                                const seriesStyleStr = dygraphOptions.perSeriesStyle;
                                let formattedStyles = {};
                            
                                if (seriesStyleStr === '') {
                            Severity: Minor
                            Found in src/web/gui/src/dashboard.js/charting/dygraph.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

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

                                    interactionModel: {
                                        mousedown: function (event, dygraph, context) {
                                            if (NETDATA.options.debug.dygraph || state.debug) {
                                                state.log('interactionModel.mousedown()');
                                            }
                            Severity: Major
                            Found in src/web/gui/src/dashboard.js/charting/dygraph.js and 1 other location - About 3 wks to fix
                            src/web/gui/v1/dashboard.js on lines 2436..2834

                            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 3565.

                            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.dygraphChartUpdate = function (state, data) {
                                let dygraph = state.tmp.dygraph_instance;
                            
                                if (typeof dygraph === 'undefined') {
                                    return NETDATA.dygraphChartCreate(state, data);
                            Severity: Major
                            Found in src/web/gui/src/dashboard.js/charting/dygraph.js and 1 other location - About 1 wk to fix
                            src/web/gui/v1/dashboard.js on lines 2005..2114

                            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 1315.

                            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

                                    axes: {
                                        x: {
                                            pixelsPerLabel: NETDATA.dataAttribute(state.element, 'dygraph-xpixelsperlabel', 50),
                                            ticker: Dygraph.dateTicker,
                                            axisLabelWidth: NETDATA.dataAttribute(state.element, 'dygraph-xaxislabelwidth', 60),
                            Severity: Major
                            Found in src/web/gui/src/dashboard.js/charting/dygraph.js and 1 other location - About 3 days to fix
                            src/web/gui/v1/dashboard.js on lines 2219..2274

                            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 663.

                            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

                                    underlayCallback: function (canvas, area, g) {
                                        // the chart is about to be drawn
                            
                                        // update history_tip_element
                                        if (state.tmp.dygraph_history_tip_element) {
                            Severity: Major
                            Found in src/web/gui/src/dashboard.js/charting/dygraph.js and 1 other location - About 2 days to fix
                            src/web/gui/v1/dashboard.js on lines 2387..2435

                            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 403.

                            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.dygraphInitialize = function (callback) {
                                if (typeof netdataNoDygraphs === 'undefined' || !netdataNoDygraphs) {
                                    $.ajax({
                                        url: NETDATA.dygraph_js,
                                        cache: true,
                            Severity: Major
                            Found in src/web/gui/src/dashboard.js/charting/dygraph.js and 1 other location - About 1 day to fix
                            src/web/gui/v1/dashboard.js on lines 1975..2003

                            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 280.

                            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

                                    drawCallback: function (dygraph, is_initial) {
                            
                                        // the user has panned the chart and this is called to re-draw the chart
                                        // 1. refresh this chart by adding data to it
                                        // 2. notify all the other charts about the update they need
                            Severity: Major
                            Found in src/web/gui/src/dashboard.js/charting/dygraph.js and 1 other location - About 1 day to fix
                            src/web/gui/v1/dashboard.js on lines 2303..2331

                            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 249.

                            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

                                if (NETDATA.chartLibraries.dygraph.isSparkline(state)) {
                                    state.tmp.dygraph_options.drawGrid = false;
                                    state.tmp.dygraph_options.drawAxis = false;
                                    state.tmp.dygraph_options.title = undefined;
                                    state.tmp.dygraph_options.ylabel = undefined;
                            Severity: Major
                            Found in src/web/gui/src/dashboard.js/charting/dygraph.js and 1 other location - About 1 day to fix
                            src/web/gui/v1/dashboard.js on lines 2843..2856

                            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 235.

                            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

                                if (state.tmp.dygraph_options.valueRange[0] === null && state.tmp.dygraph_options.valueRange[1] === null) {
                                    if (typeof state.tmp.dygraph_instance.axes_[0].extremeRange !== 'undefined') {
                                        state.tmp.__commonMin = NETDATA.dataAttribute(state.element, 'common-min', null);
                                        state.tmp.__commonMax = NETDATA.dataAttribute(state.element, 'common-max', null);
                                    } else {
                            Severity: Major
                            Found in src/web/gui/src/dashboard.js/charting/dygraph.js and 1 other location - About 1 day to fix
                            src/web/gui/v1/dashboard.js on lines 2898..2911

                            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 223.

                            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

                                    legendFormatter: function (data) {
                                        if (state.tmp.dygraph_mouse_down) {
                                            return;
                                        }
                            
                            
                            Severity: Major
                            Found in src/web/gui/src/dashboard.js/charting/dygraph.js and 1 other location - About 7 hrs to fix
                            src/web/gui/v1/dashboard.js on lines 2275..2302

                            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 185.

                            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.dygraphToolboxPanAndZoom = function (state, after, before) {
                                if (after < state.netdata_first) {
                                    after = state.netdata_first;
                                }
                            
                            
                            Severity: Major
                            Found in src/web/gui/src/dashboard.js/charting/dygraph.js and 1 other location - About 6 hrs to fix
                            src/web/gui/v1/dashboard.js on lines 1913..1930

                            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 173.

                            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.dygraphSmoothInitialize = function (callback) {
                                $.ajax({
                                    url: NETDATA.dygraph_smooth_js,
                                    cache: true,
                                    dataType: "script",
                            Severity: Major
                            Found in src/web/gui/src/dashboard.js/charting/dygraph.js and 1 other location - About 6 hrs to fix
                            src/web/gui/v1/dashboard.js on lines 1954..1973

                            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 162.

                            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

                                    zoomCallback: function (minDate, maxDate, yRanges) {
                            
                                        // the user has selected a range on the chart
                                        // 1. refresh this chart by adding data to it
                                        // 2. notify all the other charts about the update they need
                            Severity: Major
                            Found in src/web/gui/src/dashboard.js/charting/dygraph.js and 1 other location - About 5 hrs to fix
                            src/web/gui/v1/dashboard.js on lines 2332..2352

                            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 149.

                            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.dygraphSetSelection = function (state, t) {
                                if (typeof state.tmp.dygraph_instance !== 'undefined') {
                                    let r = state.calculateRowForTime(t);
                                    if (r !== -1) {
                                        state.tmp.dygraph_instance.setSelection(r);
                            Severity: Major
                            Found in src/web/gui/src/dashboard.js/charting/dygraph.js and 1 other location - About 4 hrs to fix
                            src/web/gui/v1/dashboard.js on lines 1932..1945

                            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 124.

                            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

                                if (NETDATA.chartLibraries.dygraph.isLogScale(state)) {
                                    if (Array.isArray(state.tmp.dygraph_options.valueRange) && state.tmp.dygraph_options.valueRange[0] <= 0) {
                                        state.tmp.dygraph_options.valueRange[0] = null;
                                    }
                                }
                            Severity: Major
                            Found in src/web/gui/src/dashboard.js/charting/dygraph.js and 1 other location - About 3 hrs to fix
                            src/web/gui/v1/dashboard.js on lines 2837..2841

                            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 97.

                            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

                                    unhighlightCallback: function (event) {
                                        void(event);
                            
                                        if (state.tmp.dygraph_mouse_down) {
                                            return;
                            Severity: Major
                            Found in src/web/gui/src/dashboard.js/charting/dygraph.js and 1 other location - About 2 hrs to fix
                            src/web/gui/v1/dashboard.js on lines 2373..2386

                            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 94.

                            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

                                if (netdataSnapshotData !== null && NETDATA.globalPanAndZoom.isActive() && NETDATA.globalPanAndZoom.isMaster(state) === false) {
                                    // pan and zoom on snapshots
                                    state.tmp.dygraph_options.dateWindow = [NETDATA.globalPanAndZoom.force_after_ms, NETDATA.globalPanAndZoom.force_before_ms];
                                    //state.tmp.dygraph_options.isZoomedIgnoreProgrammaticZoom = true;
                                }
                            Severity: Major
                            Found in src/web/gui/src/dashboard.js/charting/dygraph.js and 1 other location - About 2 hrs to fix
                            src/web/gui/v1/dashboard.js on lines 2869..2873

                            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 88.

                            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

                                    highlightCallback: function (event, x, points, row, seriesName) {
                                        void(seriesName);
                            
                                        state.pauseChart();
                            
                            
                            Severity: Major
                            Found in src/web/gui/src/dashboard.js/charting/dygraph.js and 1 other location - About 2 hrs to fix
                            src/web/gui/v1/dashboard.js on lines 2353..2372

                            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

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

                                if (smooth) {
                                    state.tmp.dygraph_smooth_eligible = true;
                            
                                    if (NETDATA.options.current.smooth_plot) {
                                        state.tmp.dygraph_options.plotter = smoothPlotter;
                            Severity: Major
                            Found in src/web/gui/src/dashboard.js/charting/dygraph.js and 1 other location - About 2 hrs to fix
                            src/web/gui/v1/dashboard.js on lines 2858..2867

                            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 79.

                            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 smooth = NETDATA.dygraph.smooth
                                    ? (NETDATA.dataAttributeBoolean(state.element, 'dygraph-smooth', (state.tmp.dygraph_chart_type === 'line' && NETDATA.chartLibraries.dygraph.isSparkline(state) === false)))
                                    : false;
                            Severity: Major
                            Found in src/web/gui/src/dashboard.js/charting/dygraph.js and 1 other location - About 1 hr to fix
                            src/web/gui/v1/dashboard.js on lines 2131..2133

                            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

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

                                    fillAlpha: NETDATA.dataAttribute(state.element, 'dygraph-fillalpha',
                                        ((state.tmp.dygraph_chart_type === 'stacked')
                                            ? NETDATA.options.current.color_fill_opacity_stacked
                                            : NETDATA.options.current.color_fill_opacity_area)
                                    ),
                            Severity: Major
                            Found in src/web/gui/src/dashboard.js/charting/dygraph.js and 1 other location - About 1 hr to fix
                            src/web/gui/v1/dashboard.js on lines 2193..2197

                            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 61.

                            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.dygraphClearSelection = function (state) {
                                if (typeof state.tmp.dygraph_instance !== 'undefined') {
                                    state.tmp.dygraph_instance.clearSelection();
                                }
                                return true;
                            Severity: Major
                            Found in src/web/gui/src/dashboard.js/charting/dygraph.js and 1 other location - About 1 hr to fix
                            src/web/gui/v1/dashboard.js on lines 1947..1952

                            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 59.

                            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

                                if (state.tmp.dygraph_chart_type === 'stacked' && NETDATA.chartLibraries.dygraph.isLogScale(state)) {
                                    state.tmp.dygraph_chart_type = 'area';
                                }
                            Severity: Minor
                            Found in src/web/gui/src/dashboard.js/charting/dygraph.js and 1 other location - About 55 mins to fix
                            src/web/gui/v1/dashboard.js on lines 2125..2127

                            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 54.

                            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

                                    strokeWidth: NETDATA.dataAttribute(state.element, 'dygraph-strokewidth', ((state.tmp.dygraph_chart_type === 'stacked') ? 0.1 : ((smooth === true) ? 1.5 : 0.7))),
                            Severity: Minor
                            Found in src/web/gui/src/dashboard.js/charting/dygraph.js and 1 other location - About 45 mins to fix
                            src/web/gui/v1/dashboard.js on lines 2170..2170

                            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 50.

                            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

                                    fillGraph: NETDATA.dataAttribute(state.element, 'dygraph-fillgraph', (state.tmp.dygraph_chart_type === 'area' || state.tmp.dygraph_chart_type === 'stacked')),
                            Severity: Minor
                            Found in src/web/gui/src/dashboard.js/charting/dygraph.js and 1 other location - About 35 mins to fix
                            src/web/gui/v1/dashboard.js on lines 2192..2192

                            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 47.

                            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

                                if (state.tmp.dygraph_chart_type === 'stacked' && data.dimensions === 1) {
                                    state.tmp.dygraph_chart_type = 'area';
                                }
                            Severity: Minor
                            Found in src/web/gui/src/dashboard.js/charting/dygraph.js and 1 other location - About 35 mins to fix
                            src/web/gui/v1/dashboard.js on lines 2122..2124

                            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 46.

                            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