arttor/helmify

View on GitHub

Showing 41 of 51 total issues

Method daemonset.Process has 11 return statements (exceeds 4 allowed).
Open

func (d daemonset) Process(appMeta helmify.AppMetadata, obj *unstructured.Unstructured) (bool, helmify.Template, error) {
    if obj.GroupVersionKind() != daemonsetGVC {
        return false, nil, nil
    }
    dae := appsv1.DaemonSet{}
Severity: Major
Found in pkg/processor/daemonset/daemonset.go - About 1 hr to fix

    Method svc.Process has 52 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func (r svc) Process(appMeta helmify.AppMetadata, obj *unstructured.Unstructured) (bool, helmify.Template, error) {
        if obj.GroupVersionKind() != svcGVC {
            return false, nil, nil
        }
        service := corev1.Service{}
    Severity: Minor
    Found in pkg/processor/service/service.go - About 1 hr to fix

      Function Start has 51 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func Start(stdin io.Reader, config config.Config) error {
          err := config.Validate()
          if err != nil {
              return err
          }
      Severity: Minor
      Found in pkg/app/app.go - About 1 hr to fix

        Method crd.Process has 9 return statements (exceeds 4 allowed).
        Open

        func (c crd) Process(appMeta helmify.AppMetadata, obj *unstructured.Unstructured) (bool, helmify.Template, error) {
            if obj.GroupVersionKind() != crdGVC {
                return false, nil, nil
            }
            name, ok, err := unstructured.NestedString(obj.Object, "spec", "names", "singular")
        Severity: Major
        Found in pkg/processor/crd/crd.go - About 55 mins to fix

          Method secret.Process has 9 return statements (exceeds 4 allowed).
          Open

          func (d secret) Process(appMeta helmify.AppMetadata, obj *unstructured.Unstructured) (bool, helmify.Template, error) {
              if obj.GroupVersionKind() != configMapGVC {
                  return false, nil, nil
              }
              sec := corev1.Secret{}
          Severity: Major
          Found in pkg/processor/secret/secret.go - About 55 mins to fix

            Function ProcessSpec has 8 return statements (exceeds 4 allowed).
            Open

            func ProcessSpec(objName string, appMeta helmify.AppMetadata, spec corev1.PodSpec) (map[string]interface{}, helmify.Values, error) {
                values, err := processPodSpec(objName, appMeta, &spec)
                if err != nil {
                    return nil, nil, err
                }
            Severity: Major
            Found in pkg/processor/pod/pod.go - About 50 mins to fix

              Function processPodContainer has 8 return statements (exceeds 4 allowed).
              Open

              func processPodContainer(name string, appMeta helmify.AppMetadata, c corev1.Container, values *helmify.Values) (corev1.Container, error) {
                  index := strings.LastIndex(c.Image, ":")
                  if strings.Contains(c.Image, "@") && strings.Count(c.Image, ":") >= 2 {
                      last := strings.LastIndex(c.Image, ":")
                      index = strings.LastIndex(c.Image[:last], ":")
              Severity: Major
              Found in pkg/processor/pod/pod.go - About 50 mins to fix

                Method output.Create has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                func (o output) Create(chartDir, chartName string, crd bool, certManagerAsSubchart bool, certManagerVersion string, templates []helmify.Template, filenames []string) error {
                Severity: Minor
                Found in pkg/helm/chart.go - About 45 mins to fix

                  Method clusterRoleBinding.Process has 6 return statements (exceeds 4 allowed).
                  Open

                  func (r clusterRoleBinding) Process(appMeta helmify.AppMetadata, obj *unstructured.Unstructured) (bool, helmify.Template, error) {
                      if obj.GroupVersionKind() != clusterRoleBindingGVC {
                          return false, nil, nil
                      }
                  
                  
                  Severity: Major
                  Found in pkg/processor/rbac/clusterrolebinding.go - About 40 mins to fix

                    Method role.Process has 6 return statements (exceeds 4 allowed).
                    Open

                    func (r role) Process(appMeta helmify.AppMetadata, obj *unstructured.Unstructured) (bool, helmify.Template, error) {
                        var aggregationRule string
                    
                        if obj.GroupVersionKind() != clusterRoleGVC && obj.GroupVersionKind() != roleGVC {
                            return false, nil, nil
                    Severity: Major
                    Found in pkg/processor/rbac/role.go - About 40 mins to fix

                      Function processContainers has 6 return statements (exceeds 4 allowed).
                      Open

                      func processContainers(objName string, values helmify.Values, containerType string, containers []interface{}) ([]interface{}, helmify.Values, error) {
                          for i := range containers {
                              containerName := strcase.ToLowerCamel((containers[i].(map[string]interface{})["name"]).(string))
                              res, exists, err := unstructured.NestedMap(values, objName, containerName, "resources")
                              if err != nil {
                      Severity: Major
                      Found in pkg/processor/pod/pod.go - About 40 mins to fix

                        Method pdb.Process has 6 return statements (exceeds 4 allowed).
                        Open

                        func (r pdb) Process(appMeta helmify.AppMetadata, obj *unstructured.Unstructured) (bool, helmify.Template, error) {
                            if obj.GroupVersionKind() != pdbGVC {
                                return false, nil, nil
                            }
                            pdb := policyv1.PodDisruptionBudget{}
                        Severity: Major
                        Found in pkg/processor/poddisruptionbudget/pdb.go - About 40 mins to fix

                          Method cert.Process has 6 return statements (exceeds 4 allowed).
                          Open

                          func (c cert) Process(appMeta helmify.AppMetadata, obj *unstructured.Unstructured) (bool, helmify.Template, error) {
                              if obj.GroupVersionKind() != certGVC {
                                  return false, nil, nil
                              }
                              name := appMeta.TrimName(obj.GetName())
                          Severity: Major
                          Found in pkg/processor/webhook/cert.go - About 40 mins to fix

                            Method configMap.Process has 6 return statements (exceeds 4 allowed).
                            Open

                            func (d configMap) Process(appMeta helmify.AppMetadata, obj *unstructured.Unstructured) (bool, helmify.Template, error) {
                                if obj.GroupVersionKind() != configMapGVC {
                                    return false, nil, nil
                                }
                                var meta, immutable, binaryData, data string
                            Severity: Major
                            Found in pkg/processor/configmap/configmap.go - About 40 mins to fix

                              Method roleBinding.Process has 6 return statements (exceeds 4 allowed).
                              Open

                              func (r roleBinding) Process(appMeta helmify.AppMetadata, obj *unstructured.Unstructured) (bool, helmify.Template, error) {
                                  if obj.GroupVersionKind() != roleBindingGVC {
                                      return false, nil, nil
                                  }
                                  rb := rbacv1.RoleBinding{}
                              Severity: Major
                              Found in pkg/processor/rbac/rolebinding.go - About 40 mins to fix

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

                                func templateSpecVal(val any, values *helmify.Values, specMap map[string]interface{}, objName string, fieldName ...string) error {
                                Severity: Minor
                                Found in pkg/processor/job/job.go - About 35 mins to fix

                                  Method ingress.Process has 5 return statements (exceeds 4 allowed).
                                  Open

                                  func (r ingress) Process(appMeta helmify.AppMetadata, obj *unstructured.Unstructured) (bool, helmify.Template, error) {
                                      if obj.GroupVersionKind() != ingressGVC {
                                          return false, nil, nil
                                      }
                                      ing := networkingv1.Ingress{}
                                  Severity: Major
                                  Found in pkg/processor/service/ingress.go - About 35 mins to fix

                                    Method output.Create has 5 return statements (exceeds 4 allowed).
                                    Open

                                    func (o output) Create(chartDir, chartName string, crd bool, certManagerAsSubchart bool, certManagerVersion string, templates []helmify.Template, filenames []string) error {
                                        err := initChartDir(chartDir, chartName, crd, certManagerAsSubchart, certManagerVersion)
                                        if err != nil {
                                            return err
                                        }
                                    Severity: Major
                                    Found in pkg/helm/chart.go - About 35 mins to fix

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

                                      func overwriteTemplateFile(filename, chartDir string, crd bool, templates []helmify.Template) error {
                                          // pull in crd-dir setting and siphon crds into folder
                                          var subdir string
                                          if strings.Contains(filename, "crd") && crd {
                                              subdir = "crds"
                                      Severity: Major
                                      Found in pkg/helm/chart.go - About 35 mins to fix

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

                                        func (d secret) Process(appMeta helmify.AppMetadata, obj *unstructured.Unstructured) (bool, helmify.Template, error) {
                                            if obj.GroupVersionKind() != configMapGVC {
                                                return false, nil, nil
                                            }
                                            sec := corev1.Secret{}
                                        Severity: Minor
                                        Found in pkg/processor/secret/secret.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

                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language