firehol/netdata

View on GitHub

Showing 1,088 of 2,665 total issues

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

    def check_event(self, *choices):
        # Check the type of the next event.
        if self.current_event is None:
            if self.state:
                self.current_event = self.state()
Severity: Minor
Found in src/collectors/python.d.plugin/python_modules/pyyaml3/parser.py - About 1 hr to fix

Cognitive Complexity

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

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

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

Further reading

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

    def _error_catcher(self):
        """
        Catch low-level python exceptions, instead re-raising urllib3
        variants, so that low-level exceptions are not leaked in the
        high-level api.
Severity: Minor
Found in src/collectors/python.d.plugin/python_modules/urllib3/response.py - About 1 hr to fix

Cognitive Complexity

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

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

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

Further reading

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

    def _merge_pool_kwargs(self, override):
        """
        Merge a dictionary of override values for self.connection_pool_kw.

        This does not modify self.connection_pool_kw and returns a new dict.

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 11 (exceeds 5 allowed). Consider refactoring.
Open

        def select(self, timeout=None):
            ready = []
            fd_events = _syscall_wrapper(self._wrap_poll, True, timeout=timeout)
            for fd, event_mask in fd_events:
                events = 0

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 ssl_wrap_socket has 10 arguments (exceeds 4 allowed). Consider refactoring.
Open

def ssl_wrap_socket(sock, keyfile=None, certfile=None, cert_reqs=None,
Severity: Major
Found in src/collectors/python.d.plugin/python_modules/urllib3/util/ssl_.py - About 1 hr to fix

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

        def _build_manager(self, **header_kw):
            header, proxy_header = self.__make_headers(**header_kw)
            if header is None or proxy_header is None:
                return None
            proxy_url = header_kw.get('proxy_url') or self.proxy_url

    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 parseBBUInfo has 56 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func parseBBUInfo(bs []byte) (map[string]*megaBBU, error) {
        bbus := make(map[string]*megaBBU)
    
        var section string
        var bbu *megaBBU
    Severity: Minor
    Found in src/go/plugin/go.d/modules/megacli/collect_bbu.go - About 1 hr to fix

      Method Vnodes.readConfDir has 56 lines of code (exceeds 50 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 1 hr to fix

        Method Postgres.doDBQueryStatUserTables has 56 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func (p *Postgres) doDBQueryStatUserTables(db *sql.DB) error {
            q := queryStatUserTables()
        
            var dbname, schema, name string
            return p.doDBQuery(db, q, func(column, value string, _ bool) {
        Severity: Minor
        Found in src/go/plugin/go.d/modules/postgres/do_query_tables.go - About 1 hr to fix

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

              init: function () {
                  if (netdataRegistry !== true) {
                      return;
                  }
          
          
          Severity: Minor
          Found in src/web/gui/src/dashboard.js/registry.js - About 1 hr to fix

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

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

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

                  init: function () {
                      if (netdataRegistry !== true) {
                          return;
                      }
              
              
              Severity: Minor
              Found in src/web/gui/v1/dashboard.js - About 1 hr to fix

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

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

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

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

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

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

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

                      function getControlPoints(p0, p1, p2, opt_alpha, opt_allowFalseExtrema) {
                        var alpha = (opt_alpha !== undefined) ? opt_alpha : 1/3;  // 0=no smoothing, 1=crazy smoothing
                        var allowFalseExtrema = opt_allowFalseExtrema || false;
                      
                        if (!p2) {
                      Severity: Minor
                      Found in src/web/gui/v1/lib/dygraph-smooth-plotter-c91c859.js - About 1 hr to fix

                        Method Scanner.Scan has 55 lines of code (exceeds 50 allowed). Consider refactoring.
                        Open

                        func (sc *Scanner) Scan() ([]*Chip, error) {
                            paths, err := sc.detectDevicePaths()
                            if err != nil {
                                return nil, err
                            }
                        Severity: Minor
                        Found in src/go/plugin/go.d/modules/sensors/lmsensors/scanner.go - About 1 hr to fix

                          Method KubeProxy.collectSyncProxyRulesLatency has 55 lines of code (exceeds 50 allowed). Consider refactoring.
                          Open

                          func (kp *KubeProxy) collectSyncProxyRulesLatency(raw prometheus.Series, mx *metrics) {
                              metricName := "kubeproxy_sync_proxy_rules_latency_microseconds_bucket"
                              latency := &mx.SyncProxyRules.Latency
                          
                              for _, metric := range raw.FindByName(metricName) {
                          Severity: Minor
                          Found in src/go/plugin/go.d/modules/k8s_kubeproxy/collect.go - About 1 hr to fix

                            Function loadCookieJar has 55 lines of code (exceeds 50 allowed). Consider refactoring.
                            Open

                            func loadCookieJar(path string) (http.CookieJar, error) {
                                file, err := os.Open(path)
                                if err != nil {
                                    return nil, err
                                }
                            Severity: Minor
                            Found in src/go/plugin/go.d/modules/httpcheck/cookiejar.go - About 1 hr to fix

                              Function notifyAll has 30 lines of code (exceeds 25 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 1 hr to fix
                                Severity
                                Category
                                Status
                                Source
                                Language