src/go/plugin/go.d/agent/jobmgr/dyncfg.go
File dyncfg.go
has 717 lines of code (exceeds 500 allowed). Consider refactoring. Open
Open
// SPDX-License-Identifier: GPL-3.0-or-later
package jobmgr
import (
Manager
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
Open
func (m *Manager) dyncfgModuleCreate(name string) {
id := dyncfgModID(name)
path := dyncfgPath
cmds := dyncfgModCmds()
typ := "template"
Method Manager.dyncfgConfigUpdate
has 73 lines of code (exceeds 50 allowed). Consider refactoring. Open
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)
Method Manager.dyncfgConfigEnable
has 69 lines of code (exceeds 50 allowed). Consider refactoring. Open
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)
Method Manager.dyncfgConfigTest
has 58 lines of code (exceeds 50 allowed). Consider refactoring. Open
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)
Method Manager.dyncfgConfigRestart
has 53 lines of code (exceeds 50 allowed). Consider refactoring. Open
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)
Method Manager.dyncfgConfigUpdate
has 9 return statements (exceeds 4 allowed). Open
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)
Method Manager.dyncfgConfigTest
has 8 return statements (exceeds 4 allowed). Open
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)
Function userConfigFromPayload
has 7 return statements (exceeds 4 allowed). Open
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())
}
Method Manager.dyncfgConfigEnable
has 7 return statements (exceeds 4 allowed). Open
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)
Method Manager.dyncfgConfigRestart
has 6 return statements (exceeds 4 allowed). Open
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)
Method Manager.dyncfgConfigAdd
has 6 return statements (exceeds 4 allowed). Open
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
Method Manager.dyncfgConfigGet
has 6 return statements (exceeds 4 allowed). Open
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)