firehol/netdata

View on GitHub

Showing 1,088 of 2,665 total issues

File collect.go has 511 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/collect.go - About 2 hrs to fix

    Function parseIwStationStatistics has a Cognitive Complexity of 32 (exceeds 20 allowed). Consider refactoring.
    Open

    func parseIwStationStatistics(resp []byte) (*stationStats, error) {
        var stats stationStats
    
        sc := bufio.NewScanner(bytes.NewReader(resp))
    
    
    Severity: Minor
    Found in src/go/plugin/go.d/modules/ap/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 resetOptions has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

    NETDATA.resetOptions = function () {
        let keys = Object.keys(NETDATA.localStorage.default);
        let len = keys.length;
    
        while (len--) {
    Severity: Minor
    Found in src/web/gui/src/dashboard.js/localstorage.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 easypiechartChartCreate has a Cognitive Complexity of 17 (exceeds 5 allowed). 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: Minor
    Found in src/web/gui/src/dashboard.js/charting/easy-pie-chart.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 update_netdata_badges has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

    function update_netdata_badges() {
        netdata_loops++;
        netdata_is_live = false;
    
        var updated = 0;
    Severity: Minor
    Found in src/web/gui/v1/refresh-badges.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 versionsMatch has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

    function versionsMatch(v1, v2) {
        if (v1 == v2) {
            return true;
        } else {
            let s1 = v1.split('.');
    Severity: Minor
    Found in src/web/gui/main.js - About 2 hrs to fix

    Cognitive Complexity

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

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

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

    Further reading

    Function mergeAgents has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

    function mergeAgents(cloud, local) {
        let dirty = false;
    
        const union = new Map();
    
    
    Severity: Minor
    Found in src/web/gui/main.js - About 2 hrs to fix

    Cognitive Complexity

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

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

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

    Further reading

    Function fetch_value has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        def fetch_value(self):
    
            # Do we determine a simple key?
            if self.flow_level in self.possible_simple_keys:
    
    
    Severity: Minor
    Found in src/collectors/python.d.plugin/python_modules/pyyaml3/scanner.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 check_resolver_prefix has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        def check_resolver_prefix(self, depth, path, kind,
                current_node, current_index):
            node_check, index_check = path[depth-1]
            if isinstance(node_check, str):
                if current_node.tag != node_check:
    Severity: Minor
    Found in src/collectors/python.d.plugin/python_modules/pyyaml3/resolver.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_object has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        def represent_object(self, data):
            # We use __reduce__ API to save the data. data.__reduce__ returns
            # a tuple of length 2-5:
            #   (function, args, state, listitems, dictitems)
    
    
    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 update has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        def update(self, length):
            if self.raw_buffer is None:
                return
            self.buffer = self.buffer[self.pointer:]
            self.pointer = 0
    Severity: Minor
    Found in src/collectors/python.d.plugin/python_modules/pyyaml3/reader.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 resolve has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        def resolve(self, kind, value, implicit):
            if kind is ScalarNode and implicit[0]:
                if value == '':
                    resolvers = self.yaml_implicit_resolvers.get('', [])
                else:
    Severity: Minor
    Found in src/collectors/python.d.plugin/python_modules/pyyaml3/resolver.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 read_chunked has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        def read_chunked(self, amt=None, decode_content=None):
            """
            Similar to :meth:`HTTPResponse.read`, but with an additional
            parameter: ``decode_content``.
    
    
    Severity: Minor
    Found in src/collectors/python.d.plugin/python_modules/urllib3/response.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 _parse_config has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        def _parse_config(self):
            """
            Parse configuration data
            :return: boolean
            """

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

        def _connect(self):
            """
            Recreate socket and connect to it since sockets cannot be reused after closing
            Available configurations are IPv6, IPv4 or UNIX socket
            :return:

    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

    File connection.py has 260 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    # SPDX-License-Identifier: MIT
    from __future__ import absolute_import
    import datetime
    import logging
    import os
    Severity: Minor
    Found in src/collectors/python.d.plugin/python_modules/urllib3/connection.py - About 2 hrs to fix

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

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

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

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

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

          function renderStreamedHosts(options) {
              let html = `<div class="info-item">Databases streamed to this agent</div>`;
          
              var base = document.location.origin.toString() +
                document.location.pathname.toString()
          Severity: Major
          Found in src/web/gui/main.js - About 2 hrs to fix

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

            function printPage() {
                var print_is_rendering = true;
            
                $('#printModal').on('hide.bs.modal', function (e) {
                    if (print_is_rendering === true) {
            Severity: Major
            Found in src/web/gui/main.js - About 2 hrs to fix
              Severity
              Category
              Status
              Source
              Language