firehol/netdata

View on GitHub

Showing 1,088 of 2,665 total issues

Function saveSnapshotModalInit has 61 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function saveSnapshotModalInit() {
    $('#saveSnapshotModalProgressSection').hide();
    $('#saveSnapshotResolutionRadio').show();
    saveSnapshotModalLog('info', 'Select resolution and click <b>Save</b>');
    $('#saveSnapshotExport').removeClass('disabled');
Severity: Major
Found in src/web/gui/main.js - About 2 hrs to fix

    Method Vnodes.readConfDir has a Cognitive Complexity of 33 (exceeds 20 allowed). Consider refactoring.
    Open

    func (vn *Vnodes) readConfDir() {
        _ = filepath.WalkDir(vn.confDir, func(path string, d fs.DirEntry, err error) error {
            if err != nil {
                vn.Warning(err)
                return nil
    Severity: Minor
    Found in src/go/plugin/go.d/agent/vnodes/vnodes.go - About 2 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Method WebLog.collectCustomFields has a Cognitive Complexity of 33 (exceeds 20 allowed). Consider refactoring.
    Open

    func (w *WebLog) collectCustomFields() {
        if !w.line.hasCustomFields() {
            return
        }
    
    
    Severity: Minor
    Found in src/go/plugin/go.d/modules/weblog/collect.go - About 2 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function getFixed has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

        getFixed: function (min, max) {
            let key = max;
            if (min === max) {
                if (typeof this.formattersFixed[key] === 'undefined') {
                    this.formattersFixed[key] = {
    Severity: Minor
    Found in src/web/gui/src/dashboard.js/utils.js - About 2 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function notifyAll has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

        notifyAll: function () {
            // console.log('FETCHING ALARM LOG');
            NETDATA.alarms.get_log(NETDATA.alarms.last_notification_id, function (data) {
                // console.log('ALARM LOG FETCHED');
    
    
    Severity: Minor
    Found in src/web/gui/src/dashboard.js/alarms.js - About 2 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function get_all_packages has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_all_packages(self):
            page = 1
            all_pkg_list = []
            while True:
                url = f"{self.base_url}/packages.json?page={page}"
    Severity: Minor
    Found in .github/scripts/netdata-pkgcloud-cleanup.py - About 2 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function represent_data has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

        def represent_data(self, data):
            if self.ignore_aliases(data):
                self.alias_key = None
            else:
                self.alias_key = id(data)
    Severity: Minor
    Found in src/collectors/python.d.plugin/python_modules/pyyaml3/representer.py - About 2 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function process_directives has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

        def process_directives(self):
            self.yaml_version = None
            self.tag_handles = {}
            while self.check_token(DirectiveToken):
                token = self.get_token()
    Severity: Minor
    Found in src/collectors/python.d.plugin/python_modules/pyyaml3/parser.py - About 2 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function select has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

            def select(self, timeout=None):
                if timeout is not None:
                    if timeout <= 0:
                        timeout = 0.0
                    else:

    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 select has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

            def select(self, timeout=None):
                if timeout is not None:
                    timeout = max(timeout, 0)
    
                max_events = len(self._fd_to_key) * 2

    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

    Method Varnish.collectStatistics has 85 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func (v *Varnish) collectStatistics(mx map[string]int64, bs []byte) error {
        seenBackends, seenStorages := make(map[string]bool), make(map[string]bool)
    
        sc := bufio.NewScanner(bytes.NewReader(bs))
    
    
    Severity: Major
    Found in src/go/plugin/go.d/modules/varnish/collect.go - About 2 hrs to fix

      Method Windows.collectNetFrameworkCLRMemory has 85 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func (w *Windows) collectNetFrameworkCLRMemory(mx map[string]int64, pms prometheus.Series) {
          seen := make(map[string]bool)
      
          for _, pm := range pms.FindByName(metricNetFrameworkCLRMemoryAllocatedBytesTotal) {
              if name := cleanProcessName(pm.Labels.Get("process")); name != "" {
      Severity: Major
      Found in src/go/plugin/go.d/modules/windows/collect_netframework.go - About 2 hrs to fix

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

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

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

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

            Function __init__ has 19 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def __init__(self, host, port=None,

              Function update_options_modal has 59 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  var update_options_modal = function () {
                      // console.log('update_options_modal');
              
                      var sync_option = function (option) {
                          var self = $('#' + option);
              Severity: Major
              Found in src/web/gui/main.js - About 2 hrs to fix

                Postgres has 22 methods (exceeds 20 allowed). Consider refactoring.
                Open

                func (p *Postgres) addWALFilesCharts() {
                    charts := walFilesCharts.Copy()
                
                    if err := p.Charts().Add(*charts...); err != nil {
                        p.Warning(err)
                Severity: Minor
                Found in src/go/plugin/go.d/modules/postgres/charts.go - About 2 hrs to fix

                  Job has 22 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                  type Job struct {
                      pluginName string
                      name       string
                      moduleName string
                      fullName   string
                  Severity: Minor
                  Found in src/go/plugin/go.d/agent/module/job.go - About 2 hrs to fix

                    File logline.go has 512 lines of code (exceeds 500 allowed). Consider refactoring.
                    Open

                    // SPDX-License-Identifier: GPL-3.0-or-later
                    
                    package weblog
                    
                    import (
                    Severity: Minor
                    Found in src/go/plugin/go.d/modules/weblog/logline.go - About 2 hrs to fix

                      Method WebLog.createCharts has 82 lines of code (exceeds 50 allowed). Consider refactoring.
                      Open

                      func (w *WebLog) createCharts(line *logLine) error {
                          if line.empty() {
                              return errors.New("empty line")
                          }
                          w.charts = nil
                      Severity: Major
                      Found in src/go/plugin/go.d/modules/weblog/charts.go - About 2 hrs to fix
                        Severity
                        Category
                        Status
                        Source
                        Language