portainer/portainer

View on GitHub

Showing 1,943 of 3,462 total issues

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

    const edgeJobs = {
      name: 'edge.jobs',
      url: '/jobs',
      views: {
        'content@': {
Severity: Major
Found in app/edge/__module.js and 39 other locations - About 35 mins to fix
app/docker/__module.js on lines 112..124
app/docker/__module.js on lines 148..159
app/docker/__module.js on lines 161..172
app/docker/__module.js on lines 510..521
app/docker/__module.js on lines 573..584
app/docker/__module.js on lines 586..597
app/docker/__module.js on lines 599..610
app/docker/__module.js on lines 612..623
app/edge/__module.js on lines 20..31
app/edge/__module.js on lines 53..64
app/edge/__module.js on lines 66..77
app/kubernetes/__module.js on lines 134..145
app/kubernetes/__module.js on lines 147..158
app/kubernetes/__module.js on lines 160..171
app/kubernetes/__module.js on lines 173..184
app/kubernetes/__module.js on lines 196..207
app/kubernetes/__module.js on lines 209..220
app/kubernetes/__module.js on lines 222..233
app/kubernetes/__module.js on lines 235..246
app/kubernetes/__module.js on lines 324..335
app/kubernetes/__module.js on lines 356..367
app/kubernetes/__module.js on lines 379..390
app/kubernetes/__module.js on lines 392..403
app/kubernetes/__module.js on lines 415..426
app/kubernetes/__module.js on lines 428..439
app/kubernetes/__module.js on lines 441..452
app/kubernetes/__module.js on lines 454..465
app/kubernetes/__module.js on lines 467..478
app/kubernetes/__module.js on lines 480..491
app/kubernetes/__module.js on lines 493..504
app/kubernetes/__module.js on lines 516..527
app/kubernetes/__module.js on lines 539..550
app/kubernetes/custom-templates/index.js on lines 12..24
app/portainer/__module.js on lines 176..187
app/portainer/__module.js on lines 214..225
app/portainer/__module.js on lines 317..328
app/portainer/__module.js on lines 367..378
app/portainer/__module.js on lines 380..391
app/portainer/__module.js on lines 421..432

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

    const ingressesCreate = {
      name: 'kubernetes.ingresses.create',
      url: '/add',
      views: {
        'content@': {
Severity: Major
Found in app/kubernetes/__module.js and 39 other locations - About 35 mins to fix
app/docker/__module.js on lines 112..124
app/docker/__module.js on lines 148..159
app/docker/__module.js on lines 161..172
app/docker/__module.js on lines 510..521
app/docker/__module.js on lines 573..584
app/docker/__module.js on lines 586..597
app/docker/__module.js on lines 599..610
app/docker/__module.js on lines 612..623
app/edge/__module.js on lines 20..31
app/edge/__module.js on lines 53..64
app/edge/__module.js on lines 66..77
app/edge/__module.js on lines 94..105
app/kubernetes/__module.js on lines 134..145
app/kubernetes/__module.js on lines 147..158
app/kubernetes/__module.js on lines 160..171
app/kubernetes/__module.js on lines 196..207
app/kubernetes/__module.js on lines 209..220
app/kubernetes/__module.js on lines 222..233
app/kubernetes/__module.js on lines 235..246
app/kubernetes/__module.js on lines 324..335
app/kubernetes/__module.js on lines 356..367
app/kubernetes/__module.js on lines 379..390
app/kubernetes/__module.js on lines 392..403
app/kubernetes/__module.js on lines 415..426
app/kubernetes/__module.js on lines 428..439
app/kubernetes/__module.js on lines 441..452
app/kubernetes/__module.js on lines 454..465
app/kubernetes/__module.js on lines 467..478
app/kubernetes/__module.js on lines 480..491
app/kubernetes/__module.js on lines 493..504
app/kubernetes/__module.js on lines 516..527
app/kubernetes/__module.js on lines 539..550
app/kubernetes/custom-templates/index.js on lines 12..24
app/portainer/__module.js on lines 176..187
app/portainer/__module.js on lines 214..225
app/portainer/__module.js on lines 317..328
app/portainer/__module.js on lines 367..378
app/portainer/__module.js on lines 380..391
app/portainer/__module.js on lines 421..432

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

    const namespaceCreation = {
      name: 'kubernetes.resourcePools.new',
      url: '/new',
      views: {
        'content@': {
Severity: Major
Found in app/kubernetes/__module.js and 39 other locations - About 35 mins to fix
app/docker/__module.js on lines 112..124
app/docker/__module.js on lines 148..159
app/docker/__module.js on lines 161..172
app/docker/__module.js on lines 510..521
app/docker/__module.js on lines 573..584
app/docker/__module.js on lines 586..597
app/docker/__module.js on lines 599..610
app/docker/__module.js on lines 612..623
app/edge/__module.js on lines 20..31
app/edge/__module.js on lines 53..64
app/edge/__module.js on lines 66..77
app/edge/__module.js on lines 94..105
app/kubernetes/__module.js on lines 134..145
app/kubernetes/__module.js on lines 147..158
app/kubernetes/__module.js on lines 160..171
app/kubernetes/__module.js on lines 173..184
app/kubernetes/__module.js on lines 196..207
app/kubernetes/__module.js on lines 209..220
app/kubernetes/__module.js on lines 222..233
app/kubernetes/__module.js on lines 235..246
app/kubernetes/__module.js on lines 324..335
app/kubernetes/__module.js on lines 356..367
app/kubernetes/__module.js on lines 379..390
app/kubernetes/__module.js on lines 392..403
app/kubernetes/__module.js on lines 415..426
app/kubernetes/__module.js on lines 428..439
app/kubernetes/__module.js on lines 441..452
app/kubernetes/__module.js on lines 467..478
app/kubernetes/__module.js on lines 480..491
app/kubernetes/__module.js on lines 493..504
app/kubernetes/__module.js on lines 516..527
app/kubernetes/__module.js on lines 539..550
app/kubernetes/custom-templates/index.js on lines 12..24
app/portainer/__module.js on lines 176..187
app/portainer/__module.js on lines 214..225
app/portainer/__module.js on lines 317..328
app/portainer/__module.js on lines 367..378
app/portainer/__module.js on lines 380..391
app/portainer/__module.js on lines 421..432

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

      const edgeAutoCreateScript = {
        name: 'portainer.endpoints.edgeAutoCreateScript',
        url: '/aeec',
        views: {
          'content@': {
Severity: Major
Found in app/portainer/__module.js and 39 other locations - About 35 mins to fix
app/docker/__module.js on lines 112..124
app/docker/__module.js on lines 148..159
app/docker/__module.js on lines 161..172
app/docker/__module.js on lines 510..521
app/docker/__module.js on lines 573..584
app/docker/__module.js on lines 586..597
app/docker/__module.js on lines 599..610
app/docker/__module.js on lines 612..623
app/edge/__module.js on lines 20..31
app/edge/__module.js on lines 53..64
app/edge/__module.js on lines 66..77
app/edge/__module.js on lines 94..105
app/kubernetes/__module.js on lines 134..145
app/kubernetes/__module.js on lines 147..158
app/kubernetes/__module.js on lines 160..171
app/kubernetes/__module.js on lines 173..184
app/kubernetes/__module.js on lines 196..207
app/kubernetes/__module.js on lines 209..220
app/kubernetes/__module.js on lines 222..233
app/kubernetes/__module.js on lines 235..246
app/kubernetes/__module.js on lines 324..335
app/kubernetes/__module.js on lines 356..367
app/kubernetes/__module.js on lines 379..390
app/kubernetes/__module.js on lines 392..403
app/kubernetes/__module.js on lines 415..426
app/kubernetes/__module.js on lines 428..439
app/kubernetes/__module.js on lines 441..452
app/kubernetes/__module.js on lines 454..465
app/kubernetes/__module.js on lines 467..478
app/kubernetes/__module.js on lines 480..491
app/kubernetes/__module.js on lines 493..504
app/kubernetes/__module.js on lines 516..527
app/kubernetes/__module.js on lines 539..550
app/kubernetes/custom-templates/index.js on lines 12..24
app/portainer/__module.js on lines 176..187
app/portainer/__module.js on lines 317..328
app/portainer/__module.js on lines 367..378
app/portainer/__module.js on lines 380..391
app/portainer/__module.js on lines 421..432

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

    $scope.addLogDriverOpt = function () {
      $scope.formValues.LogDriverOpts.push({ name: '', value: '' });
    };
Severity: Major
Found in app/docker/views/services/create/createServiceController.js and 7 other locations - About 35 mins to fix
app/docker/views/networks/create/createNetworkController.js on lines 63..68
app/docker/views/networks/create/createNetworkController.js on lines 74..79
app/docker/views/secrets/create/createSecretController.js on lines 34..36
app/docker/views/services/create/createServiceController.js on lines 196..198
app/docker/views/services/create/createServiceController.js on lines 204..206
app/docker/views/services/create/createServiceController.js on lines 212..214
app/docker/views/volumes/create/createVolumeController.js on lines 36..38

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

    const swarmFeaturesConfiguration = {
      name: 'docker.swarm.featuresConfiguration',
      url: '/feat-config',
      views: {
        'content@': {
Severity: Major
Found in app/docker/__module.js and 39 other locations - About 35 mins to fix
app/docker/__module.js on lines 112..124
app/docker/__module.js on lines 148..159
app/docker/__module.js on lines 161..172
app/docker/__module.js on lines 510..521
app/docker/__module.js on lines 573..584
app/docker/__module.js on lines 599..610
app/docker/__module.js on lines 612..623
app/edge/__module.js on lines 20..31
app/edge/__module.js on lines 53..64
app/edge/__module.js on lines 66..77
app/edge/__module.js on lines 94..105
app/kubernetes/__module.js on lines 134..145
app/kubernetes/__module.js on lines 147..158
app/kubernetes/__module.js on lines 160..171
app/kubernetes/__module.js on lines 173..184
app/kubernetes/__module.js on lines 196..207
app/kubernetes/__module.js on lines 209..220
app/kubernetes/__module.js on lines 222..233
app/kubernetes/__module.js on lines 235..246
app/kubernetes/__module.js on lines 324..335
app/kubernetes/__module.js on lines 356..367
app/kubernetes/__module.js on lines 379..390
app/kubernetes/__module.js on lines 392..403
app/kubernetes/__module.js on lines 415..426
app/kubernetes/__module.js on lines 428..439
app/kubernetes/__module.js on lines 441..452
app/kubernetes/__module.js on lines 454..465
app/kubernetes/__module.js on lines 467..478
app/kubernetes/__module.js on lines 480..491
app/kubernetes/__module.js on lines 493..504
app/kubernetes/__module.js on lines 516..527
app/kubernetes/__module.js on lines 539..550
app/kubernetes/custom-templates/index.js on lines 12..24
app/portainer/__module.js on lines 176..187
app/portainer/__module.js on lines 214..225
app/portainer/__module.js on lines 317..328
app/portainer/__module.js on lines 367..378
app/portainer/__module.js on lines 380..391
app/portainer/__module.js on lines 421..432

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

    const dockerRegistries = {
      name: 'docker.host.registries',
      url: '/registries',
      views: {
        'content@': {
Severity: Major
Found in app/docker/__module.js and 39 other locations - About 35 mins to fix
app/docker/__module.js on lines 112..124
app/docker/__module.js on lines 148..159
app/docker/__module.js on lines 161..172
app/docker/__module.js on lines 510..521
app/docker/__module.js on lines 573..584
app/docker/__module.js on lines 586..597
app/docker/__module.js on lines 612..623
app/edge/__module.js on lines 20..31
app/edge/__module.js on lines 53..64
app/edge/__module.js on lines 66..77
app/edge/__module.js on lines 94..105
app/kubernetes/__module.js on lines 134..145
app/kubernetes/__module.js on lines 147..158
app/kubernetes/__module.js on lines 160..171
app/kubernetes/__module.js on lines 173..184
app/kubernetes/__module.js on lines 196..207
app/kubernetes/__module.js on lines 209..220
app/kubernetes/__module.js on lines 222..233
app/kubernetes/__module.js on lines 235..246
app/kubernetes/__module.js on lines 324..335
app/kubernetes/__module.js on lines 356..367
app/kubernetes/__module.js on lines 379..390
app/kubernetes/__module.js on lines 392..403
app/kubernetes/__module.js on lines 415..426
app/kubernetes/__module.js on lines 428..439
app/kubernetes/__module.js on lines 441..452
app/kubernetes/__module.js on lines 454..465
app/kubernetes/__module.js on lines 467..478
app/kubernetes/__module.js on lines 480..491
app/kubernetes/__module.js on lines 493..504
app/kubernetes/__module.js on lines 516..527
app/kubernetes/__module.js on lines 539..550
app/kubernetes/custom-templates/index.js on lines 12..24
app/portainer/__module.js on lines 176..187
app/portainer/__module.js on lines 214..225
app/portainer/__module.js on lines 317..328
app/portainer/__module.js on lines 367..378
app/portainer/__module.js on lines 380..391
app/portainer/__module.js on lines 421..432

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

    const swarmRegistries = {
      name: 'docker.swarm.registries',
      url: '/registries',
      views: {
        'content@': {
Severity: Major
Found in app/docker/__module.js and 39 other locations - About 35 mins to fix
app/docker/__module.js on lines 112..124
app/docker/__module.js on lines 148..159
app/docker/__module.js on lines 161..172
app/docker/__module.js on lines 510..521
app/docker/__module.js on lines 573..584
app/docker/__module.js on lines 586..597
app/docker/__module.js on lines 599..610
app/edge/__module.js on lines 20..31
app/edge/__module.js on lines 53..64
app/edge/__module.js on lines 66..77
app/edge/__module.js on lines 94..105
app/kubernetes/__module.js on lines 134..145
app/kubernetes/__module.js on lines 147..158
app/kubernetes/__module.js on lines 160..171
app/kubernetes/__module.js on lines 173..184
app/kubernetes/__module.js on lines 196..207
app/kubernetes/__module.js on lines 209..220
app/kubernetes/__module.js on lines 222..233
app/kubernetes/__module.js on lines 235..246
app/kubernetes/__module.js on lines 324..335
app/kubernetes/__module.js on lines 356..367
app/kubernetes/__module.js on lines 379..390
app/kubernetes/__module.js on lines 392..403
app/kubernetes/__module.js on lines 415..426
app/kubernetes/__module.js on lines 428..439
app/kubernetes/__module.js on lines 441..452
app/kubernetes/__module.js on lines 454..465
app/kubernetes/__module.js on lines 467..478
app/kubernetes/__module.js on lines 480..491
app/kubernetes/__module.js on lines 493..504
app/kubernetes/__module.js on lines 516..527
app/kubernetes/__module.js on lines 539..550
app/kubernetes/custom-templates/index.js on lines 12..24
app/portainer/__module.js on lines 176..187
app/portainer/__module.js on lines 214..225
app/portainer/__module.js on lines 317..328
app/portainer/__module.js on lines 367..378
app/portainer/__module.js on lines 380..391
app/portainer/__module.js on lines 421..432

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

    const deploy = {
      name: 'kubernetes.deploy',
      url: '/deploy?templateId&referrer&tab&buildMethod&chartName',
      views: {
        'content@': {
Severity: Major
Found in app/kubernetes/__module.js and 39 other locations - About 35 mins to fix
app/docker/__module.js on lines 112..124
app/docker/__module.js on lines 148..159
app/docker/__module.js on lines 161..172
app/docker/__module.js on lines 510..521
app/docker/__module.js on lines 573..584
app/docker/__module.js on lines 586..597
app/docker/__module.js on lines 599..610
app/docker/__module.js on lines 612..623
app/edge/__module.js on lines 20..31
app/edge/__module.js on lines 53..64
app/edge/__module.js on lines 66..77
app/edge/__module.js on lines 94..105
app/kubernetes/__module.js on lines 134..145
app/kubernetes/__module.js on lines 147..158
app/kubernetes/__module.js on lines 160..171
app/kubernetes/__module.js on lines 173..184
app/kubernetes/__module.js on lines 196..207
app/kubernetes/__module.js on lines 209..220
app/kubernetes/__module.js on lines 222..233
app/kubernetes/__module.js on lines 235..246
app/kubernetes/__module.js on lines 324..335
app/kubernetes/__module.js on lines 356..367
app/kubernetes/__module.js on lines 379..390
app/kubernetes/__module.js on lines 392..403
app/kubernetes/__module.js on lines 415..426
app/kubernetes/__module.js on lines 441..452
app/kubernetes/__module.js on lines 454..465
app/kubernetes/__module.js on lines 467..478
app/kubernetes/__module.js on lines 480..491
app/kubernetes/__module.js on lines 493..504
app/kubernetes/__module.js on lines 516..527
app/kubernetes/__module.js on lines 539..550
app/kubernetes/custom-templates/index.js on lines 12..24
app/portainer/__module.js on lines 176..187
app/portainer/__module.js on lines 214..225
app/portainer/__module.js on lines 317..328
app/portainer/__module.js on lines 367..378
app/portainer/__module.js on lines 380..391
app/portainer/__module.js on lines 421..432

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

    const resourcePoolAccess = {
      name: 'kubernetes.resourcePools.resourcePool.access',
      url: '/access',
      views: {
        'content@': {
Severity: Major
Found in app/kubernetes/__module.js and 39 other locations - About 35 mins to fix
app/docker/__module.js on lines 112..124
app/docker/__module.js on lines 148..159
app/docker/__module.js on lines 161..172
app/docker/__module.js on lines 510..521
app/docker/__module.js on lines 573..584
app/docker/__module.js on lines 586..597
app/docker/__module.js on lines 599..610
app/docker/__module.js on lines 612..623
app/edge/__module.js on lines 20..31
app/edge/__module.js on lines 53..64
app/edge/__module.js on lines 66..77
app/edge/__module.js on lines 94..105
app/kubernetes/__module.js on lines 134..145
app/kubernetes/__module.js on lines 147..158
app/kubernetes/__module.js on lines 160..171
app/kubernetes/__module.js on lines 173..184
app/kubernetes/__module.js on lines 196..207
app/kubernetes/__module.js on lines 209..220
app/kubernetes/__module.js on lines 222..233
app/kubernetes/__module.js on lines 235..246
app/kubernetes/__module.js on lines 324..335
app/kubernetes/__module.js on lines 356..367
app/kubernetes/__module.js on lines 379..390
app/kubernetes/__module.js on lines 392..403
app/kubernetes/__module.js on lines 415..426
app/kubernetes/__module.js on lines 428..439
app/kubernetes/__module.js on lines 441..452
app/kubernetes/__module.js on lines 454..465
app/kubernetes/__module.js on lines 467..478
app/kubernetes/__module.js on lines 493..504
app/kubernetes/__module.js on lines 516..527
app/kubernetes/__module.js on lines 539..550
app/kubernetes/custom-templates/index.js on lines 12..24
app/portainer/__module.js on lines 176..187
app/portainer/__module.js on lines 214..225
app/portainer/__module.js on lines 317..328
app/portainer/__module.js on lines 367..378
app/portainer/__module.js on lines 380..391
app/portainer/__module.js on lines 421..432

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

      var endpoints = {
        name: 'portainer.endpoints',
        url: '/endpoints',
        views: {
          'content@': {
Severity: Major
Found in app/portainer/__module.js and 39 other locations - About 35 mins to fix
app/docker/__module.js on lines 112..124
app/docker/__module.js on lines 148..159
app/docker/__module.js on lines 161..172
app/docker/__module.js on lines 510..521
app/docker/__module.js on lines 573..584
app/docker/__module.js on lines 586..597
app/docker/__module.js on lines 599..610
app/docker/__module.js on lines 612..623
app/edge/__module.js on lines 20..31
app/edge/__module.js on lines 53..64
app/edge/__module.js on lines 66..77
app/edge/__module.js on lines 94..105
app/kubernetes/__module.js on lines 134..145
app/kubernetes/__module.js on lines 147..158
app/kubernetes/__module.js on lines 160..171
app/kubernetes/__module.js on lines 173..184
app/kubernetes/__module.js on lines 196..207
app/kubernetes/__module.js on lines 209..220
app/kubernetes/__module.js on lines 222..233
app/kubernetes/__module.js on lines 235..246
app/kubernetes/__module.js on lines 324..335
app/kubernetes/__module.js on lines 356..367
app/kubernetes/__module.js on lines 379..390
app/kubernetes/__module.js on lines 392..403
app/kubernetes/__module.js on lines 415..426
app/kubernetes/__module.js on lines 428..439
app/kubernetes/__module.js on lines 441..452
app/kubernetes/__module.js on lines 454..465
app/kubernetes/__module.js on lines 467..478
app/kubernetes/__module.js on lines 480..491
app/kubernetes/__module.js on lines 493..504
app/kubernetes/__module.js on lines 516..527
app/kubernetes/__module.js on lines 539..550
app/kubernetes/custom-templates/index.js on lines 12..24
app/portainer/__module.js on lines 214..225
app/portainer/__module.js on lines 317..328
app/portainer/__module.js on lines 367..378
app/portainer/__module.js on lines 380..391
app/portainer/__module.js on lines 421..432

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

    $scope.addDriverOption = function () {
      $scope.formValues.DriverOptions.push({
        name: '',
        value: '',
      });
Severity: Major
Found in app/docker/views/networks/create/createNetworkController.js and 7 other locations - About 35 mins to fix
app/docker/views/networks/create/createNetworkController.js on lines 74..79
app/docker/views/secrets/create/createSecretController.js on lines 34..36
app/docker/views/services/create/createServiceController.js on lines 196..198
app/docker/views/services/create/createServiceController.js on lines 204..206
app/docker/views/services/create/createServiceController.js on lines 212..214
app/docker/views/services/create/createServiceController.js on lines 220..222
app/docker/views/volumes/create/createVolumeController.js on lines 36..38

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

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

  onRegistriesChange(registries) {
    return this.$scope.$evalAsync(() => {
      this.formValues.Registries = registries;
    });
  }
app/kubernetes/views/resource-pools/edit/resourcePoolController.js on lines 79..83

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

        if (nodes[n].CPUs && nodes[n].CPUs > maxCpus) {
          maxCpus = nodes[n].CPUs;
        }
Severity: Minor
Found in app/docker/views/services/create/createServiceController.js and 1 other location - About 35 mins to fix
app/docker/views/services/create/createServiceController.js on lines 588..590

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

  bindings: {
    description: '@',
    cpuReservation: '<',
    cpuUsage: '<',
    cpuLimit: '<',
app/portainer/components/form-components/web-editor-form/index.js on lines 7..16

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

  bindings: {
    identifier: '@',
    placeholder: '@',
    yml: '<',
    value: '<',
app/kubernetes/components/resource-reservation/resourceReservation.js on lines 4..13

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

    if (this.cpuLimit) {
      this.cpuReservationPercent = Math.round((this.cpuReservation / this.cpuLimit) * 100);
    }
app/kubernetes/components/resource-reservation/resourceReservationController.js on lines 8..10

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

    if (this.memoryLimit) {
      this.memoryReservationPercent = Math.round((this.memoryReservation / this.memoryLimit) * 100);
    }
app/kubernetes/components/resource-reservation/resourceReservationController.js on lines 5..7

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 _KubernetesApplicationEnvConfigMapPayload = Object.freeze({
  name: '',
  valueFrom: {
    configMapKeyRef: {
      name: '',
Severity: Minor
Found in app/kubernetes/models/application/payloads.js and 1 other location - About 35 mins to fix
app/kubernetes/models/application/payloads.js on lines 128..136

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<GitAuthModel>) {
    onChange(partialValue);
    setValue((value) => ({ ...value, ...partialValue }));
  }
Severity: Minor
Found in app/react/portainer/gitops/AuthFieldset/AuthFieldset.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/GitForm.tsx on lines 136..139

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

Severity
Category
Status
Source
Language