cyberark/secrets-provider-for-k8s

View on GitHub
e2e/k8s_utils.go

Summary

Maintainability
B
5 hrs
Test Coverage

Function RunCommandInSecretsProviderPod has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

func RunCommandInSecretsProviderPod(client klient.Client, labelSelector string, container string, command []string, stdout *bytes.Buffer, stderr *bytes.Buffer) error {
Severity: Minor
Found in e2e/k8s_utils.go - About 45 mins to fix

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

    func ScaleDeployment(client klient.Client, deploymentName string, namespace string, labelSelector string, replicas int32) error {
        mergePatch, err := json.Marshal(map[string]interface{}{
            "spec": map[string]interface{}{
                "replicas": replicas,
            },
    Severity: Major
    Found in e2e/k8s_utils.go - About 40 mins to fix

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

      func ScaleDeployment(client klient.Client, deploymentName string, namespace string, labelSelector string, replicas int32) error {
      Severity: Minor
      Found in e2e/k8s_utils.go - About 35 mins to fix

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

        func GetSecret(client klient.Client, secretName string) (*corev1.Secret, error) {
            var secret corev1.Secret
            err := client.Resources().Get(context.TODO(), secretName, SecretsProviderNamespace(), &secret)
            if err != nil {
                return &secret, err
        Severity: Major
        Found in e2e/k8s_utils.go and 4 other locations - About 35 mins to fix
        e2e/k8s_utils.go on lines 125..132
        e2e/k8s_utils.go on lines 146..153
        e2e/k8s_utils.go on lines 176..183
        e2e/k8s_utils.go on lines 227..234

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

        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 5 locations. Consider refactoring.
        Open

        func GetConfigMap(client klient.Client, configMapName string) (*corev1.ConfigMap, error) {
            var configMap corev1.ConfigMap
            err := client.Resources().Get(context.TODO(), configMapName, SecretsProviderNamespace(), &configMap)
            if err != nil {
                return &configMap, err
        Severity: Major
        Found in e2e/k8s_utils.go and 4 other locations - About 35 mins to fix
        e2e/k8s_utils.go on lines 125..132
        e2e/k8s_utils.go on lines 146..153
        e2e/k8s_utils.go on lines 155..162
        e2e/k8s_utils.go on lines 176..183

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

        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 5 locations. Consider refactoring.
        Open

        func GetDeployment(client klient.Client, deploymentName string) (*appsv1.Deployment, error) {
            var deployment appsv1.Deployment
            err := client.Resources().Get(context.TODO(), deploymentName, SecretsProviderNamespace(), &deployment)
            if err != nil {
                return &deployment, err
        Severity: Major
        Found in e2e/k8s_utils.go and 4 other locations - About 35 mins to fix
        e2e/k8s_utils.go on lines 146..153
        e2e/k8s_utils.go on lines 155..162
        e2e/k8s_utils.go on lines 176..183
        e2e/k8s_utils.go on lines 227..234

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

        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 5 locations. Consider refactoring.
        Open

        func GetJob(client klient.Client, jobName string) (*batchv1.Job, error) {
            var job batchv1.Job
            err := client.Resources().Get(context.TODO(), jobName, SecretsProviderNamespace(), &job)
            if err != nil {
                return &job, err
        Severity: Major
        Found in e2e/k8s_utils.go and 4 other locations - About 35 mins to fix
        e2e/k8s_utils.go on lines 125..132
        e2e/k8s_utils.go on lines 155..162
        e2e/k8s_utils.go on lines 176..183
        e2e/k8s_utils.go on lines 227..234

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

        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 5 locations. Consider refactoring.
        Open

        func GetServiceAccount(client klient.Client, saName string) (*corev1.ServiceAccount, error) {
            var sa corev1.ServiceAccount
            err := client.Resources().Get(context.TODO(), saName, SecretsProviderNamespace(), &sa)
            if err != nil {
                return &sa, err
        Severity: Major
        Found in e2e/k8s_utils.go and 4 other locations - About 35 mins to fix
        e2e/k8s_utils.go on lines 125..132
        e2e/k8s_utils.go on lines 146..153
        e2e/k8s_utils.go on lines 155..162
        e2e/k8s_utils.go on lines 227..234

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

        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

        There are no issues that match your filters.

        Category
        Status