firehol/netdata

View on GitHub

Showing 1,088 of 2,665 total issues

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

    def __init__(self, user, pw, authurl, *args, **kwargs):

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

        def makefile(self, mode="r", buffering=None, *args, **kwargs):

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

          def wrap_socket(self, sock, server_side=False,

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

            def validate_charts(self, chart, data, algorithm='absolute', multiplier=1, divisor=1):
        Severity: Minor
        Found in src/collectors/python.d.plugin/zscores/zscores.chart.py - About 35 mins to fix

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

              def request(self, method, url, fields=None, headers=None, **urlopen_kw):
          Severity: Minor
          Found in src/collectors/python.d.plugin/python_modules/urllib3/request.py - About 35 mins to fix

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

                def __init__(self, name, old_mod, new_mod, old_attr=None, new_attr=None):
            Severity: Minor
            Found in src/collectors/python.d.plugin/python_modules/urllib3/packages/six.py - About 35 mins to fix

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

              def _verify_callback(cnx, x509, err_no, err_depth, return_code):

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

                    def __init__(self, proxy_url, num_pools=10, headers=None,
                Severity: Minor
                Found in src/collectors/python.d.plugin/python_modules/urllib3/poolmanager.py - About 35 mins to fix

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

                      def _do_request(self, url=None, manager=None, retries=1, redirect=True, **kwargs):

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

                        def wrap_socket(self, sock, server_side=False,

                      Function getSystemdVersion has 5 return statements (exceeds 4 allowed).
                      Open

                      func getSystemdVersion() int {
                          var reVersion = regexp.MustCompile(`[0-9][0-9][0-9]`)
                      
                          conn, err := dbus.NewWithContext(context.Background())
                          if err != nil {
                      Severity: Major
                      Found in src/go/plugin/go.d/agent/hostinfo/hostinfo_linux.go - About 35 mins to fix

                        Method Job.updateChart has a Cognitive Complexity of 22 (exceeds 20 allowed). Consider refactoring.
                        Open

                        func (j *Job) updateChart(chart *Chart, collected map[string]int64, sinceLastRun int) bool {
                            if chart.ignore {
                                dims := chart.Dims[:0]
                                for _, dim := range chart.Dims {
                                    if !dim.remove {
                        Severity: Minor
                        Found in src/go/plugin/go.d/agent/module/job.go - 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

                        Method Prometheus.collect has 5 return statements (exceeds 4 allowed).
                        Open

                        func (p *Prometheus) collect() (map[string]int64, error) {
                            mfs, err := p.prom.Scrape()
                            if err != nil {
                                return nil, err
                            }
                        Severity: Major
                        Found in src/go/plugin/go.d/modules/prometheus/collect.go - About 35 mins to fix

                          Method Manager.registerDiscoverers has 5 return statements (exceeds 4 allowed).
                          Open

                          func (m *Manager) registerDiscoverers(cfg Config) error {
                              if len(cfg.File.Read) > 0 || len(cfg.File.Watch) > 0 {
                                  cfg.File.Registry = cfg.Registry
                                  d, err := file.NewDiscovery(cfg.File)
                                  if err != nil {
                          Severity: Major
                          Found in src/go/plugin/go.d/agent/discovery/manager.go - About 35 mins to fix

                            Method CoreDNS.Init has 5 return statements (exceeds 4 allowed).
                            Open

                            func (cd *CoreDNS) Init() error {
                                if err := cd.validateConfig(); err != nil {
                                    cd.Errorf("config validation: %v", err)
                                    return err
                                }
                            Severity: Major
                            Found in src/go/plugin/go.d/modules/coredns/coredns.go - About 35 mins to fix

                              Method Discoverer.discoverLocalListeners has 5 return statements (exceeds 4 allowed).
                              Open

                              func (d *Discoverer) discoverLocalListeners(ctx context.Context, in chan<- []model.TargetGroup) error {
                                  bs, err := d.ll.discover(ctx)
                                  if err != nil {
                                      if errors.Is(err, context.DeadlineExceeded) {
                                          // there is no point in continuing pointless attempts/use cpu

                                Method OracleDB.validateDSN has 5 return statements (exceeds 4 allowed).
                                Open

                                func (o *OracleDB) validateDSN() (string, error) {
                                    if o.DSN == "" {
                                        return "", errors.New("dsn required but not set")
                                    }
                                    if _, err := goora.ParseConfig(o.DSN); err != nil {
                                Severity: Major
                                Found in src/go/plugin/go.d/modules/oracledb/init.go - About 35 mins to fix

                                  Method SNMP.collect has 5 return statements (exceeds 4 allowed).
                                  Open

                                  func (s *SNMP) collect() (map[string]int64, error) {
                                      if s.sysInfo == nil {
                                          si, err := s.getSysInfo()
                                          if err != nil {
                                              return nil, err
                                  Severity: Major
                                  Found in src/go/plugin/go.d/modules/snmp/collect.go - About 35 mins to fix

                                    Method Prometheus.Init has 5 return statements (exceeds 4 allowed).
                                    Open

                                    func (p *Prometheus) Init() error {
                                        if err := p.validateConfig(); err != nil {
                                            p.Errorf("validating config: %v", err)
                                            return err
                                        }
                                    Severity: Major
                                    Found in src/go/plugin/go.d/modules/prometheus/prometheus.go - About 35 mins to fix

                                      Method Dovecot.collectExportGlobal has 5 return statements (exceeds 4 allowed).
                                      Open

                                      func (d *Dovecot) collectExportGlobal(mx map[string]int64, resp []byte) error {
                                          sc := bufio.NewScanner(bytes.NewReader(resp))
                                      
                                          if !sc.Scan() {
                                              return errors.New("failed to read fields line from export global response")
                                      Severity: Major
                                      Found in src/go/plugin/go.d/modules/dovecot/collect.go - About 35 mins to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language