firehol/netdata

View on GitHub
src/go/collectors/go.d.plugin/agent/jobmgr/dyncfg.go

Summary

Maintainability
D
2 days
Test Coverage

File dyncfg.go has 693 lines of code (exceeds 500 allowed). Consider refactoring.
Open

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

package jobmgr

import (
Severity: Minor
Found in src/go/collectors/go.d.plugin/agent/jobmgr/dyncfg.go - About 6 hrs to fix

    Manager has 21 methods (exceeds 20 allowed). Consider refactoring.
    Open

    func (m *Manager) dyncfgModuleCreate(name string) {
        id := dyncfgModID(name)
        path := dyncfgPath
        cmds := dyncfgModCmds()
        typ := "template"
    Severity: Minor
    Found in src/go/collectors/go.d.plugin/agent/jobmgr/dyncfg.go - About 2 hrs to fix

      Method Manager.dyncfgConfigUpdate has 73 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func (m *Manager) dyncfgConfigUpdate(fn functions.Function) {
          id := fn.Args[0]
          mn, jn, ok := extractModuleJobName(id)
          if !ok {
              m.Warningf("dyncfg: update: could not extract module from id (%s)", id)
      Severity: Minor
      Found in src/go/collectors/go.d.plugin/agent/jobmgr/dyncfg.go - About 1 hr to fix

        Method Manager.dyncfgConfigEnable has 69 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func (m *Manager) dyncfgConfigEnable(fn functions.Function) {
            id := fn.Args[0]
            mn, jn, ok := extractModuleJobName(id)
            if !ok {
                m.Warningf("dyncfg: enable: could not extract module and job from id (%s)", id)
        Severity: Minor
        Found in src/go/collectors/go.d.plugin/agent/jobmgr/dyncfg.go - About 1 hr to fix

          Method Manager.dyncfgConfigTest has 53 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func (m *Manager) dyncfgConfigTest(fn functions.Function) {
              id := fn.Args[0]
              mn, ok := extractModuleName(id)
              if !ok {
                  m.Warningf("dyncfg: test: could not extract module and job from id (%s)", id)
          Severity: Minor
          Found in src/go/collectors/go.d.plugin/agent/jobmgr/dyncfg.go - About 1 hr to fix

            Method Manager.dyncfgConfigRestart has 53 lines of code (exceeds 50 allowed). Consider refactoring.
            Open

            func (m *Manager) dyncfgConfigRestart(fn functions.Function) {
                id := fn.Args[0]
                mn, jn, ok := extractModuleJobName(id)
                if !ok {
                    m.Warningf("dyncfg: restart: could not extract module from id (%s)", id)
            Severity: Minor
            Found in src/go/collectors/go.d.plugin/agent/jobmgr/dyncfg.go - About 1 hr to fix

              Method Manager.dyncfgConfigUpdate has 9 return statements (exceeds 4 allowed).
              Open

              func (m *Manager) dyncfgConfigUpdate(fn functions.Function) {
                  id := fn.Args[0]
                  mn, jn, ok := extractModuleJobName(id)
                  if !ok {
                      m.Warningf("dyncfg: update: could not extract module from id (%s)", id)
              Severity: Major
              Found in src/go/collectors/go.d.plugin/agent/jobmgr/dyncfg.go - About 55 mins to fix

                Method Manager.dyncfgConfigTest has 7 return statements (exceeds 4 allowed).
                Open

                func (m *Manager) dyncfgConfigTest(fn functions.Function) {
                    id := fn.Args[0]
                    mn, ok := extractModuleName(id)
                    if !ok {
                        m.Warningf("dyncfg: test: could not extract module and job from id (%s)", id)
                Severity: Major
                Found in src/go/collectors/go.d.plugin/agent/jobmgr/dyncfg.go - About 45 mins to fix

                  Method Manager.dyncfgConfigEnable has 7 return statements (exceeds 4 allowed).
                  Open

                  func (m *Manager) dyncfgConfigEnable(fn functions.Function) {
                      id := fn.Args[0]
                      mn, jn, ok := extractModuleJobName(id)
                      if !ok {
                          m.Warningf("dyncfg: enable: could not extract module and job from id (%s)", id)
                  Severity: Major
                  Found in src/go/collectors/go.d.plugin/agent/jobmgr/dyncfg.go - About 45 mins to fix

                    Function userConfigFromPayload has 7 return statements (exceeds 4 allowed).
                    Open

                    func userConfigFromPayload(cfg any, jobName string, fn functions.Function) ([]byte, error) {
                        if v := reflect.ValueOf(cfg); v.Kind() != reflect.Ptr || v.IsNil() {
                            return nil, fmt.Errorf("invalid config: expected a pointer to a struct, got a %s", v.Type())
                        }
                    
                    
                    Severity: Major
                    Found in src/go/collectors/go.d.plugin/agent/jobmgr/dyncfg.go - About 45 mins to fix

                      Method Manager.dyncfgConfigRestart has 6 return statements (exceeds 4 allowed).
                      Open

                      func (m *Manager) dyncfgConfigRestart(fn functions.Function) {
                          id := fn.Args[0]
                          mn, jn, ok := extractModuleJobName(id)
                          if !ok {
                              m.Warningf("dyncfg: restart: could not extract module from id (%s)", id)
                      Severity: Major
                      Found in src/go/collectors/go.d.plugin/agent/jobmgr/dyncfg.go - About 40 mins to fix

                        Method Manager.dyncfgConfigGet has 6 return statements (exceeds 4 allowed).
                        Open

                        func (m *Manager) dyncfgConfigGet(fn functions.Function) {
                            id := fn.Args[0]
                            mn, jn, ok := extractModuleJobName(id)
                            if !ok {
                                m.Warningf("dyncfg: get: could not extract module and job from id (%s)", id)
                        Severity: Major
                        Found in src/go/collectors/go.d.plugin/agent/jobmgr/dyncfg.go - About 40 mins to fix

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

                          func (m *Manager) dyncfgConfigAdd(fn functions.Function) {
                              if len(fn.Args) < 3 {
                                  m.Warningf("dyncfg: add: missing required arguments, want 3 got %d", len(fn.Args))
                                  m.dyncfgRespf(fn, 400, "Missing required arguments. Need at least 3, but got %d.", len(fn.Args))
                                  return
                          Severity: Major
                          Found in src/go/collectors/go.d.plugin/agent/jobmgr/dyncfg.go - About 35 mins to fix

                            There are no issues that match your filters.

                            Category
                            Status