firehol/netdata

View on GitHub

Showing 2,966 of 2,966 total issues

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

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

    // IMPORTANT:
    // all private functions should use 'that', instead of 'this'
Severity: Major
Found in src/web/gui/v1/dashboard.js and 1 other location - About 5 mos to fix
src/web/gui/src/dashboard.js/main.js on lines 943..3834

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

File dashboard.js has 7658 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// SPDX-License-Identifier: GPL-3.0-or-later

// DO NOT EDIT: This file is automatically generated from the source files in src/

// ----------------------------------------------------------------------------
Severity: Major
Found in src/web/gui/v1/dashboard.js - About 3 wks to fix

    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

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

    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

    File dashboard_info.js has 7041 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    // SPDX-License-Identifier: GPL-3.0-or-later
    
    // Codacy declarations
    /* global NETDATA */
    
    
    Severity: Major
    Found in src/web/gui/dashboard_info.js - About 2 wks to fix

      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

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

      NETDATA.alarms = {
          onclick: null,                  // the callback to handle the click - it will be called with the alarm log entry
          chart_div_offset: -50,          // give that space above the chart when scrolling to it
          chart_div_id_prefix: 'chart_',  // the chart DIV IDs have this prefix (they should be NETDATA.name2id(chart.id))
          chart_div_animation_duration: 0,// the duration of the animation while scrolling to a chart
      Severity: Major
      Found in src/web/gui/src/dashboard.js/alarms.js and 1 other location - About 2 wks to fix
      src/web/gui/v1/dashboard.js on lines 9468..9886

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

      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.alarms = {
          onclick: null,                  // the callback to handle the click - it will be called with the alarm log entry
          chart_div_offset: -50,          // give that space above the chart when scrolling to it
          chart_div_id_prefix: 'chart_',  // the chart DIV IDs have this prefix (they should be NETDATA.name2id(chart.id))
          chart_div_animation_duration: 0,// the duration of the animation while scrolling to a chart
      Severity: Major
      Found in src/web/gui/v1/dashboard.js and 1 other location - About 2 wks to fix
      src/web/gui/src/dashboard.js/alarms.js on lines 4..422

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

      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.chartLibraries = {
          "dygraph": {
              initialize: NETDATA.dygraphInitialize,
              create: NETDATA.dygraphChartCreate,
              update: NETDATA.dygraphChartUpdate,
      Severity: Major
      Found in src/web/gui/v1/dashboard.js and 1 other location - About 2 wks to fix
      src/web/gui/src/dashboard.js/charting.js on lines 4..482

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

      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.chartLibraries = {
          "dygraph": {
              initialize: NETDATA.dygraphInitialize,
              create: NETDATA.dygraphChartCreate,
              update: NETDATA.dygraphChartUpdate,
      Severity: Major
      Found in src/web/gui/src/dashboard.js/charting.js and 1 other location - About 2 wks to fix
      src/web/gui/v1/dashboard.js on lines 4355..4833

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

      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.gaugeChartCreate = function (state, data) {
          // let chart = $(state.element_chart);
      
          let value = data.result[0];
          let min = NETDATA.dataAttribute(state.element, 'gauge-min-value', null);
      Severity: Major
      Found in src/web/gui/v1/dashboard.js and 1 other location - About 2 wks to fix
      src/web/gui/src/dashboard.js/charting/gauge.js on lines 215..406

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

      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.gaugeChartCreate = function (state, data) {
          // let chart = $(state.element_chart);
      
          let value = data.result[0];
          let min = NETDATA.dataAttribute(state.element, 'gauge-min-value', null);
      Severity: Major
      Found in src/web/gui/src/dashboard.js/charting/gauge.js and 1 other location - About 2 wks to fix
      src/web/gui/v1/dashboard.js on lines 3416..3607

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

      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

      File charts.go has 4582 lines of code (exceeds 500 allowed). Consider refactoring.
      Open

      // SPDX-License-Identifier: GPL-3.0-or-later
      
      package windows
      
      import (
      Severity: Major
      Found in src/go/collectors/go.d.plugin/modules/windows/charts.go - About 1 wk to fix

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

        // Main JavaScript file for the Netdata GUI.
        
        // Codacy declarations
        /* global NETDATA */
        
        
        Severity: Major
        Found in src/web/gui/main.js - About 1 wk to fix

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

          NETDATA.d3pieChartCreate = function (state, data) {
          
              state.element_chart.id = 'd3pie-' + state.uuid;
              // console.log('id = ' + state.element_chart.id);
          
          
          Severity: Major
          Found in src/web/gui/src/dashboard.js/charting/d3pie.js and 1 other location - About 1 wk to fix
          src/web/gui/v1/dashboard.js on lines 4056..4229

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

          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.d3pieChartCreate = function (state, data) {
          
              state.element_chart.id = 'd3pie-' + state.uuid;
              // console.log('id = ' + state.element_chart.id);
          
          
          Severity: Major
          Found in src/web/gui/v1/dashboard.js and 1 other location - About 1 wk to fix
          src/web/gui/src/dashboard.js/charting/d3pie.js on lines 168..341

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

          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

          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

            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/v1/dashboard.js - About 1 wk to fix

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

              NETDATA.easypiechartChartCreate = function (state, data) {
                  let chart = $(state.element_chart);
              
                  let value = data.result[0];
                  let min = NETDATA.dataAttribute(state.element, 'easypiechart-min-value', null);
              Severity: Major
              Found in src/web/gui/v1/dashboard.js and 1 other location - About 1 wk to fix
              src/web/gui/src/dashboard.js/charting/easy-pie-chart.js on lines 167..281

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

              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

              Severity
              Category
              Status
              Source
              Language