arttor/helmify

View on GitHub

Showing 51 of 51 total issues

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

func (p job) Process(appMeta helmify.AppMetadata, obj *unstructured.Unstructured) (bool, helmify.Template, error) {
    if obj.GroupVersionKind() != jobGVC {
        return false, nil, nil
    }
    meta, err := processor.ProcessObjMeta(appMeta, obj)
Severity: Minor
Found in pkg/processor/job/job.go - 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

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

func (p cron) Process(appMeta helmify.AppMetadata, obj *unstructured.Unstructured) (bool, helmify.Template, error) {
    if obj.GroupVersionKind() != cronGVC {
        return false, nil, nil
    }
    meta, err := processor.ProcessObjMeta(appMeta, obj)
Severity: Minor
Found in pkg/processor/job/cron.go - 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

Method crd.Process has a Cognitive Complexity of 27 (exceeds 20 allowed). Consider refactoring.
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: Minor
Found in pkg/processor/crd/crd.go - 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

Method deployment.Process has 13 return statements (exceeds 4 allowed).
Open

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

    Function processPodContainer has 55 lines of code (exceeds 50 allowed). Consider refactoring.
    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: Minor
    Found in pkg/processor/pod/pod.go - About 1 hr to fix

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

      func (p pvc) Process(appMeta helmify.AppMetadata, obj *unstructured.Unstructured) (bool, helmify.Template, error) {
          if obj.GroupVersionKind() != pvcGVC {
              return false, nil, nil
          }
          meta, err := processor.ProcessObjMeta(appMeta, obj)
      Severity: Major
      Found in pkg/processor/storage/pvc.go - About 1 hr to fix

        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

                        Similar blocks of code found in 2 locations. Consider refactoring.
                        Open

                            for key := range sec.Data {
                                keyCamelCase := strcase.ToLowerCamel(key)
                                if key == strings.ToUpper(key) {
                                    keyCamelCase = strcase.ToLowerCamel(strings.ToLower(key))
                                }
                        Severity: Minor
                        Found in pkg/processor/secret/secret.go and 1 other location - About 45 mins to fix
                        pkg/processor/secret/secret.go on lines 96..106

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 113.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Similar blocks of code found in 2 locations. Consider refactoring.
                        Open

                            for key := range sec.StringData {
                                keyCamelCase := strcase.ToLowerCamel(key)
                                if key == strings.ToUpper(key) {
                                    keyCamelCase = strcase.ToLowerCamel(strings.ToLower(key))
                                }
                        Severity: Minor
                        Found in pkg/processor/secret/secret.go and 1 other location - About 45 mins to fix
                        pkg/processor/secret/secret.go on lines 75..85

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 113.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        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
                                Severity
                                Category
                                Status
                                Source
                                Language