portainer/portainer

View on GitHub

Showing 1,943 of 3,462 total issues

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

      renderSubRow={(row) => (
        <SubRow node={row.original} cellCount={row.getVisibleCells().length} />
      )}
app/react/kubernetes/applications/ListView/ApplicationsStacksDatatable/ApplicationsStacksDatatable.tsx on lines 69..71

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

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

    <DeleteButton
      confirmMessage="Are you sure you want to unauthorized the selected users or teams?"
      onConfirmed={() => onClick(items)}
      disabled={items.length === 0}
      data-cy="remove-access-button"
app/react/kubernetes/volumes/ListView/VolumesDatatable.tsx on lines 69..74

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

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

      <PrePullToggle
        onChange={(value) =>
          setValues((values) => ({ ...values, PrePullImage: value }))
        }
        value={values.PrePullImage}
app/react/portainer/templates/custom-templates/CreateView/EdgeSettingsFieldset.tsx on lines 73..78

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

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

  function handleChange(partialValue: Partial<GitFormModel>) {
    onChange(partialValue);
    setValue((value) => ({ ...value, ...partialValue }));
  }
Severity: Minor
Found in app/react/portainer/gitops/GitForm.tsx and 2 other locations - About 35 mins to fix
app/react/edge/edge-stacks/components/StaggerFieldset.tsx on lines 209..212
app/react/portainer/gitops/AuthFieldset/AuthFieldset.tsx on lines 142..145

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

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

  const containerInstances = {
    name: 'azure.containerinstances',
    url: '/containerinstances',
    views: {
      'content@': {
Severity: Minor
Found in app/azure/index.ts and 1 other location - About 35 mins to fix
app/azure/index.ts on lines 75..86

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

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

      <RetryDeployToggle
        onChange={(value) =>
          setValues((values) => ({ ...values, RetryDeploy: value }))
        }
        value={values.RetryDeploy}
app/react/portainer/templates/custom-templates/CreateView/EdgeSettingsFieldset.tsx on lines 66..71

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

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

export function CapabilitiesTab({
  values,
  onChange,
}: {
  values: Values;
app/react/components/form-components/InputList/InputList.stories.tsx on lines 87..115
app/react/docker/containers/CreateView/RestartPolicyTab/RestartPolicyTab.tsx on lines 6..27

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

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

  {
    id: 'kaas',
    value: 'kaas',
    label: 'Provision KaaS Cluster',
    description:
app/react/portainer/environments/wizard/EnvironmentTypeSelectView/environment-types.ts on lines 71..80

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

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

  {
    id: 'k8sInstall',
    value: 'k8sInstall',
    label: 'Create Kubernetes cluster',
    description: 'Create a Kubernetes cluster on existing infrastructure',
app/react/portainer/environments/wizard/EnvironmentTypeSelectView/environment-types.ts on lines 60..70

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

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

func NewHandler(bouncer security.BouncerService) *Handler {
    h := &Handler{
        Router: mux.NewRouter(),
    }
    h.Handle("/motd",
Severity: Major
Found in api/http/handler/motd/handler.go and 3 other locations - About 30 mins to fix
api/http/handler/ldap/handler.go on lines 24..33
api/http/handler/roles/handler.go on lines 20..28
api/http/handler/upload/handler.go on lines 20..27

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

func NewHandler(bouncer security.BouncerService) *Handler {
    h := &Handler{
        Router: mux.NewRouter(),
    }

Severity: Major
Found in api/http/handler/ldap/handler.go and 3 other locations - About 30 mins to fix
api/http/handler/motd/handler.go on lines 16..24
api/http/handler/roles/handler.go on lines 20..28
api/http/handler/upload/handler.go on lines 20..27

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

func NewHandler(bouncer security.BouncerService) *Handler {
    h := &Handler{
        Router: mux.NewRouter(),
    }
    h.Handle("/roles",
Severity: Major
Found in api/http/handler/roles/handler.go and 3 other locations - About 30 mins to fix
api/http/handler/ldap/handler.go on lines 24..33
api/http/handler/motd/handler.go on lines 16..24
api/http/handler/upload/handler.go on lines 20..27

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

func NewHandler(bouncer security.BouncerService) *Handler {
    h := &Handler{
        Router: mux.NewRouter(),
    }
    h.Handle("/upload/tls/{certificate:(?:ca|cert|key)}",
Severity: Major
Found in api/http/handler/upload/handler.go and 3 other locations - About 30 mins to fix
api/http/handler/ldap/handler.go on lines 24..33
api/http/handler/motd/handler.go on lines 16..24
api/http/handler/roles/handler.go on lines 20..28

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

func (m *Migrator) helmRepositoryURLToDB32() error {
    log.Info().Msg("setting default helm repository URL")

    settings, err := m.settingsService.Settings()
    if err != nil {
Severity: Minor
Found in api/datastore/migrator/migrate_dbversion31.go and 1 other location - About 30 mins to fix
api/datastore/migrator/migrate_dbversion31.go on lines 263..273

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

export class KubernetesStatefulSetCreatePayload {
  constructor() {
    Object.assign(this, JSON.parse(JSON.stringify(_KubernetesStatefulSetCreatePayload)));
  }
}
Severity: Major
Found in app/kubernetes/models/stateful-set/payloads.js and 34 other locations - About 30 mins to fix
app/kubernetes/endpoint/models.js on lines 14..18
app/kubernetes/endpoint/models.js on lines 25..29
app/kubernetes/horizontal-pod-auto-scaler/models.js on lines 19..23
app/kubernetes/models/application/formValues.js on lines 140..144
app/kubernetes/models/application/models/index.js on lines 37..41
app/kubernetes/models/application/payloads.js on lines 138..142
app/kubernetes/models/common/payloads.js on lines 11..15
app/kubernetes/models/config-map/models.js on lines 27..31
app/kubernetes/models/config-map/payloads.js on lines 25..29
app/kubernetes/models/configuration/formvalues.js on lines 32..36
app/kubernetes/models/configuration/models.js on lines 20..24
app/kubernetes/models/daemon-set/models.js on lines 21..25
app/kubernetes/models/daemon-set/payloads.js on lines 46..50
app/kubernetes/models/deployment/models.js on lines 22..26
app/kubernetes/models/deployment/payloads.js on lines 48..52
app/kubernetes/models/event/models.js on lines 12..16
app/kubernetes/models/namespace/payloads.js on lines 10..14
app/kubernetes/models/port/models.js on lines 30..34
app/kubernetes/models/resource-reservation/models.js on lines 9..13
app/kubernetes/models/secret/models.js on lines 18..22
app/kubernetes/models/secret/payloads.js on lines 29..33
app/kubernetes/models/service/models.js on lines 30..34
app/kubernetes/models/service/models.js on lines 69..73
app/kubernetes/models/service/payloads.js on lines 18..22
app/kubernetes/models/stack/models.js on lines 10..14
app/kubernetes/models/stateful-set/models.js on lines 24..28
app/kubernetes/models/storage-class/payload.js on lines 12..16
app/kubernetes/models/volume/payloads.js on lines 19..23
app/kubernetes/node/models.js on lines 58..62
app/kubernetes/node/payload.js on lines 15..19
app/kubernetes/node/payload.js on lines 27..31
app/kubernetes/pod/models/index.js on lines 39..43
app/kubernetes/pod/models/index.js on lines 62..66
app/kubernetes/pod/models/index.js on lines 77..81

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

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

export class KubernetesCommonMetadataPayload {
  constructor() {
    Object.assign(this, JSON.parse(JSON.stringify(_KubernetesCommonMetadataPayload)));
  }
}
Severity: Major
Found in app/kubernetes/models/common/payloads.js and 34 other locations - About 30 mins to fix
app/kubernetes/endpoint/models.js on lines 14..18
app/kubernetes/endpoint/models.js on lines 25..29
app/kubernetes/horizontal-pod-auto-scaler/models.js on lines 19..23
app/kubernetes/models/application/formValues.js on lines 140..144
app/kubernetes/models/application/models/index.js on lines 37..41
app/kubernetes/models/application/payloads.js on lines 138..142
app/kubernetes/models/config-map/models.js on lines 27..31
app/kubernetes/models/config-map/payloads.js on lines 25..29
app/kubernetes/models/configuration/formvalues.js on lines 32..36
app/kubernetes/models/configuration/models.js on lines 20..24
app/kubernetes/models/daemon-set/models.js on lines 21..25
app/kubernetes/models/daemon-set/payloads.js on lines 46..50
app/kubernetes/models/deployment/models.js on lines 22..26
app/kubernetes/models/deployment/payloads.js on lines 48..52
app/kubernetes/models/event/models.js on lines 12..16
app/kubernetes/models/namespace/payloads.js on lines 10..14
app/kubernetes/models/port/models.js on lines 30..34
app/kubernetes/models/resource-reservation/models.js on lines 9..13
app/kubernetes/models/secret/models.js on lines 18..22
app/kubernetes/models/secret/payloads.js on lines 29..33
app/kubernetes/models/service/models.js on lines 30..34
app/kubernetes/models/service/models.js on lines 69..73
app/kubernetes/models/service/payloads.js on lines 18..22
app/kubernetes/models/stack/models.js on lines 10..14
app/kubernetes/models/stateful-set/models.js on lines 24..28
app/kubernetes/models/stateful-set/payloads.js on lines 48..52
app/kubernetes/models/storage-class/payload.js on lines 12..16
app/kubernetes/models/volume/payloads.js on lines 19..23
app/kubernetes/node/models.js on lines 58..62
app/kubernetes/node/payload.js on lines 15..19
app/kubernetes/node/payload.js on lines 27..31
app/kubernetes/pod/models/index.js on lines 39..43
app/kubernetes/pod/models/index.js on lines 62..66
app/kubernetes/pod/models/index.js on lines 77..81

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

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

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

    function automaticUpdatesLabel(repositoryAutomaticUpdates, repositoryMechanism) {
      switch (repositoryAutomaticUpdates && repositoryMechanism) {
        case RepositoryMechanismTypes.INTERVAL:
          return 'polling';
        case RepositoryMechanismTypes.WEBHOOK:
Severity: Minor
Found in app/kubernetes/views/deploy/deployController.js and 1 other location - About 30 mins to fix
app/portainer/components/forms/kubernetes-redeploy-app-git-form/kubernetes-redeploy-app-git-form.controller.js on lines 104..113

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

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

export class KubernetesApplicationAutoScalerFormValue {
  constructor() {
    Object.assign(this, JSON.parse(JSON.stringify(_KubernetesApplicationAutoScalerFormValue)));
  }
}
Severity: Major
Found in app/kubernetes/models/application/formValues.js and 34 other locations - About 30 mins to fix
app/kubernetes/endpoint/models.js on lines 14..18
app/kubernetes/endpoint/models.js on lines 25..29
app/kubernetes/horizontal-pod-auto-scaler/models.js on lines 19..23
app/kubernetes/models/application/models/index.js on lines 37..41
app/kubernetes/models/application/payloads.js on lines 138..142
app/kubernetes/models/common/payloads.js on lines 11..15
app/kubernetes/models/config-map/models.js on lines 27..31
app/kubernetes/models/config-map/payloads.js on lines 25..29
app/kubernetes/models/configuration/formvalues.js on lines 32..36
app/kubernetes/models/configuration/models.js on lines 20..24
app/kubernetes/models/daemon-set/models.js on lines 21..25
app/kubernetes/models/daemon-set/payloads.js on lines 46..50
app/kubernetes/models/deployment/models.js on lines 22..26
app/kubernetes/models/deployment/payloads.js on lines 48..52
app/kubernetes/models/event/models.js on lines 12..16
app/kubernetes/models/namespace/payloads.js on lines 10..14
app/kubernetes/models/port/models.js on lines 30..34
app/kubernetes/models/resource-reservation/models.js on lines 9..13
app/kubernetes/models/secret/models.js on lines 18..22
app/kubernetes/models/secret/payloads.js on lines 29..33
app/kubernetes/models/service/models.js on lines 30..34
app/kubernetes/models/service/models.js on lines 69..73
app/kubernetes/models/service/payloads.js on lines 18..22
app/kubernetes/models/stack/models.js on lines 10..14
app/kubernetes/models/stateful-set/models.js on lines 24..28
app/kubernetes/models/stateful-set/payloads.js on lines 48..52
app/kubernetes/models/storage-class/payload.js on lines 12..16
app/kubernetes/models/volume/payloads.js on lines 19..23
app/kubernetes/node/models.js on lines 58..62
app/kubernetes/node/payload.js on lines 15..19
app/kubernetes/node/payload.js on lines 27..31
app/kubernetes/pod/models/index.js on lines 39..43
app/kubernetes/pod/models/index.js on lines 62..66
app/kubernetes/pod/models/index.js on lines 77..81

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

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

export class KubernetesApplicationPort {
  constructor() {
    Object.assign(this, JSON.parse(JSON.stringify(_KubernetesApplicationPort)));
  }
}
Severity: Major
Found in app/kubernetes/models/application/models/index.js and 34 other locations - About 30 mins to fix
app/kubernetes/endpoint/models.js on lines 14..18
app/kubernetes/endpoint/models.js on lines 25..29
app/kubernetes/horizontal-pod-auto-scaler/models.js on lines 19..23
app/kubernetes/models/application/formValues.js on lines 140..144
app/kubernetes/models/application/payloads.js on lines 138..142
app/kubernetes/models/common/payloads.js on lines 11..15
app/kubernetes/models/config-map/models.js on lines 27..31
app/kubernetes/models/config-map/payloads.js on lines 25..29
app/kubernetes/models/configuration/formvalues.js on lines 32..36
app/kubernetes/models/configuration/models.js on lines 20..24
app/kubernetes/models/daemon-set/models.js on lines 21..25
app/kubernetes/models/daemon-set/payloads.js on lines 46..50
app/kubernetes/models/deployment/models.js on lines 22..26
app/kubernetes/models/deployment/payloads.js on lines 48..52
app/kubernetes/models/event/models.js on lines 12..16
app/kubernetes/models/namespace/payloads.js on lines 10..14
app/kubernetes/models/port/models.js on lines 30..34
app/kubernetes/models/resource-reservation/models.js on lines 9..13
app/kubernetes/models/secret/models.js on lines 18..22
app/kubernetes/models/secret/payloads.js on lines 29..33
app/kubernetes/models/service/models.js on lines 30..34
app/kubernetes/models/service/models.js on lines 69..73
app/kubernetes/models/service/payloads.js on lines 18..22
app/kubernetes/models/stack/models.js on lines 10..14
app/kubernetes/models/stateful-set/models.js on lines 24..28
app/kubernetes/models/stateful-set/payloads.js on lines 48..52
app/kubernetes/models/storage-class/payload.js on lines 12..16
app/kubernetes/models/volume/payloads.js on lines 19..23
app/kubernetes/node/models.js on lines 58..62
app/kubernetes/node/payload.js on lines 15..19
app/kubernetes/node/payload.js on lines 27..31
app/kubernetes/pod/models/index.js on lines 39..43
app/kubernetes/pod/models/index.js on lines 62..66
app/kubernetes/pod/models/index.js on lines 77..81

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

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

export class KubernetesEndpoint {
  constructor() {
    Object.assign(this, JSON.parse(JSON.stringify(_KubernetesEndpoint)));
  }
}
Severity: Major
Found in app/kubernetes/endpoint/models.js and 34 other locations - About 30 mins to fix
app/kubernetes/endpoint/models.js on lines 25..29
app/kubernetes/horizontal-pod-auto-scaler/models.js on lines 19..23
app/kubernetes/models/application/formValues.js on lines 140..144
app/kubernetes/models/application/models/index.js on lines 37..41
app/kubernetes/models/application/payloads.js on lines 138..142
app/kubernetes/models/common/payloads.js on lines 11..15
app/kubernetes/models/config-map/models.js on lines 27..31
app/kubernetes/models/config-map/payloads.js on lines 25..29
app/kubernetes/models/configuration/formvalues.js on lines 32..36
app/kubernetes/models/configuration/models.js on lines 20..24
app/kubernetes/models/daemon-set/models.js on lines 21..25
app/kubernetes/models/daemon-set/payloads.js on lines 46..50
app/kubernetes/models/deployment/models.js on lines 22..26
app/kubernetes/models/deployment/payloads.js on lines 48..52
app/kubernetes/models/event/models.js on lines 12..16
app/kubernetes/models/namespace/payloads.js on lines 10..14
app/kubernetes/models/port/models.js on lines 30..34
app/kubernetes/models/resource-reservation/models.js on lines 9..13
app/kubernetes/models/secret/models.js on lines 18..22
app/kubernetes/models/secret/payloads.js on lines 29..33
app/kubernetes/models/service/models.js on lines 30..34
app/kubernetes/models/service/models.js on lines 69..73
app/kubernetes/models/service/payloads.js on lines 18..22
app/kubernetes/models/stack/models.js on lines 10..14
app/kubernetes/models/stateful-set/models.js on lines 24..28
app/kubernetes/models/stateful-set/payloads.js on lines 48..52
app/kubernetes/models/storage-class/payload.js on lines 12..16
app/kubernetes/models/volume/payloads.js on lines 19..23
app/kubernetes/node/models.js on lines 58..62
app/kubernetes/node/payload.js on lines 15..19
app/kubernetes/node/payload.js on lines 27..31
app/kubernetes/pod/models/index.js on lines 39..43
app/kubernetes/pod/models/index.js on lines 62..66
app/kubernetes/pod/models/index.js on lines 77..81

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

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