arttor/helmify

View on GitHub

Showing 51 of 51 total issues

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

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

                func overwriteValuesFile(chartDir string, values helmify.Values, certManagerAsSubchart bool) error {
                    if certManagerAsSubchart {
                        _, err := values.Add(true, "certmanager", "installCRDs")
                        if err != nil {
                            return fmt.Errorf("%w: unable to add cert-manager.installCRDs", err)
                Severity: Major
                Found in pkg/helm/chart.go - About 35 mins to fix

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

                      for _, v := range pod.Volumes {
                          if v.ConfigMap != nil {
                              v.ConfigMap.Name = appMeta.TemplatedName(v.ConfigMap.Name)
                          }
                          if v.Secret != nil {
                  Severity: Minor
                  Found in pkg/processor/pod/pod.go and 1 other location - About 30 mins to fix
                  pkg/processor/pod/pod.go on lines 195..202

                  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 100.

                  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 _, e := range c.EnvFrom {
                          if e.SecretRef != nil {
                              e.SecretRef.Name = appMeta.TemplatedName(e.SecretRef.Name)
                          }
                          if e.ConfigMapRef != nil {
                  Severity: Minor
                  Found in pkg/processor/pod/pod.go and 1 other location - About 30 mins to fix
                  pkg/processor/pod/pod.go on lines 151..158

                  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 100.

                  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

                  Severity
                  Category
                  Status
                  Source
                  Language