portainer/portainer

View on GitHub

Showing 459 of 463 total issues

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

angular.module('portainer.docker')
.factory('ConfigService', ['$q', 'Config', function ConfigServiceFactory($q, Config) {
  'use strict';
  var service = {};

Severity: Major
Found in app/docker/services/configService.js and 1 other location - About 2 days to fix
app/docker/services/secretService.js on lines 3..63

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

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

angular.module('portainer.docker')
.factory('SecretService', ['$q', 'Secret', function SecretServiceFactory($q, Secret) {
  'use strict';
  var service = {};

Severity: Major
Found in app/docker/services/secretService.js and 1 other location - About 2 days to fix
app/docker/services/configService.js on lines 3..63

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

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

File portainer.go has 962 lines of code (exceeds 300 allowed). Consider refactoring.
Open

package portainer

import "time"

type (
Severity: Major
Found in api/portainer.go - About 2 days to fix

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

      $scope.update = function() {
        var profile = $scope.profile;
    
        if (!$scope.state.LimitIOPS) {
          delete profile.MinIOPS;
    app/integrations/storidge/views/profiles/create/createProfileController.js on lines 43..85

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 369.

    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

      $scope.create = function () {
        var profile = $scope.model;
    
        if (!$scope.state.LimitIOPS) {
          delete profile.MinIOPS;
    app/integrations/storidge/views/profiles/edit/profileController.js on lines 47..89

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

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

      this.$onInit = function() {
        this.setDefaults();
        this.prepareTableFromDataset();
    
        this.state.orderBy = this.orderBy;
    app/docker/components/datatables/images-datatable/imagesDatatableController.js on lines 38..70
    app/docker/components/datatables/networks-datatable/networksDatatableController.js on lines 24..55
    app/docker/components/datatables/service-tasks-datatable/serviceTasksDatatableController.js on lines 60..91
    app/docker/components/datatables/tasks-datatable/tasksDatatableController.js on lines 15..46
    app/docker/components/datatables/volumes-datatable/volumesDatatableController.js on lines 38..69
    app/integrations/storidge/components/drives-datatable/storidgeDrivesDatatableController.js on lines 10..41
    app/integrations/storidge/components/nodes-datatable/storidgeNodesDatatableController.js on lines 24..55
    app/portainer/components/access-datatable/accessDatatableController.js on lines 14..45
    app/portainer/components/datatables/schedules-datatable/schedulesDatatableController.js on lines 14..45
    app/portainer/components/forms/registry-form-gitlab/gitlab-projects-datatable/gitlabProjectsDatatableController.js on lines 15..46

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

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

          this.$onInit = function() {
            this.setDefaults();
            this.prepareTableFromDataset();
    
            this.state.orderBy = this.orderBy;
    app/docker/components/datatables/images-datatable/imagesDatatableController.js on lines 38..70
    app/docker/components/datatables/service-tasks-datatable/serviceTasksDatatableController.js on lines 60..91
    app/docker/components/datatables/tasks-datatable/tasksDatatableController.js on lines 15..46
    app/docker/components/datatables/volumes-datatable/volumesDatatableController.js on lines 38..69
    app/integrations/storidge/components/drives-datatable/storidgeDrivesDatatableController.js on lines 10..41
    app/integrations/storidge/components/nodes-datatable/storidgeNodesDatatableController.js on lines 24..55
    app/portainer/components/access-datatable/accessDatatableController.js on lines 14..45
    app/portainer/components/datatables/schedules-datatable/schedulesDatatableController.js on lines 14..45
    app/portainer/components/datatables/stacks-datatable/stacksDatatableController.js on lines 14..45
    app/portainer/components/forms/registry-form-gitlab/gitlab-projects-datatable/gitlabProjectsDatatableController.js on lines 15..46

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

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

          this.$onInit = function() {
            this.setDefaults();
            this.prepareTableFromDataset();
    
            this.state.orderBy = this.orderBy;
    app/docker/components/datatables/images-datatable/imagesDatatableController.js on lines 38..70
    app/docker/components/datatables/networks-datatable/networksDatatableController.js on lines 24..55
    app/docker/components/datatables/tasks-datatable/tasksDatatableController.js on lines 15..46
    app/docker/components/datatables/volumes-datatable/volumesDatatableController.js on lines 38..69
    app/integrations/storidge/components/drives-datatable/storidgeDrivesDatatableController.js on lines 10..41
    app/integrations/storidge/components/nodes-datatable/storidgeNodesDatatableController.js on lines 24..55
    app/portainer/components/access-datatable/accessDatatableController.js on lines 14..45
    app/portainer/components/datatables/schedules-datatable/schedulesDatatableController.js on lines 14..45
    app/portainer/components/datatables/stacks-datatable/stacksDatatableController.js on lines 14..45
    app/portainer/components/forms/registry-form-gitlab/gitlab-projects-datatable/gitlabProjectsDatatableController.js on lines 15..46

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

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

          this.$onInit = function() {
            this.setDefaults();
            this.prepareTableFromDataset();
    
            this.state.orderBy = this.orderBy;
    app/docker/components/datatables/images-datatable/imagesDatatableController.js on lines 38..70
    app/docker/components/datatables/networks-datatable/networksDatatableController.js on lines 24..55
    app/docker/components/datatables/service-tasks-datatable/serviceTasksDatatableController.js on lines 60..91
    app/docker/components/datatables/tasks-datatable/tasksDatatableController.js on lines 15..46
    app/docker/components/datatables/volumes-datatable/volumesDatatableController.js on lines 38..69
    app/integrations/storidge/components/drives-datatable/storidgeDrivesDatatableController.js on lines 10..41
    app/integrations/storidge/components/nodes-datatable/storidgeNodesDatatableController.js on lines 24..55
    app/portainer/components/access-datatable/accessDatatableController.js on lines 14..45
    app/portainer/components/datatables/stacks-datatable/stacksDatatableController.js on lines 14..45
    app/portainer/components/forms/registry-form-gitlab/gitlab-projects-datatable/gitlabProjectsDatatableController.js on lines 15..46

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

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

      this.$onInit = function() {
        this.setDefaults();
        this.prepareTableFromDataset();
    
        this.state.orderBy = this.orderBy;
    app/docker/components/datatables/images-datatable/imagesDatatableController.js on lines 38..70
    app/docker/components/datatables/networks-datatable/networksDatatableController.js on lines 24..55
    app/docker/components/datatables/service-tasks-datatable/serviceTasksDatatableController.js on lines 60..91
    app/docker/components/datatables/volumes-datatable/volumesDatatableController.js on lines 38..69
    app/integrations/storidge/components/drives-datatable/storidgeDrivesDatatableController.js on lines 10..41
    app/integrations/storidge/components/nodes-datatable/storidgeNodesDatatableController.js on lines 24..55
    app/portainer/components/access-datatable/accessDatatableController.js on lines 14..45
    app/portainer/components/datatables/schedules-datatable/schedulesDatatableController.js on lines 14..45
    app/portainer/components/datatables/stacks-datatable/stacksDatatableController.js on lines 14..45
    app/portainer/components/forms/registry-form-gitlab/gitlab-projects-datatable/gitlabProjectsDatatableController.js on lines 15..46

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

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

          this.$onInit = function() {
            this.setDefaults();
            this.prepareTableFromDataset();
        
            this.state.orderBy = this.orderBy;
    app/docker/components/datatables/images-datatable/imagesDatatableController.js on lines 38..70
    app/docker/components/datatables/networks-datatable/networksDatatableController.js on lines 24..55
    app/docker/components/datatables/service-tasks-datatable/serviceTasksDatatableController.js on lines 60..91
    app/docker/components/datatables/tasks-datatable/tasksDatatableController.js on lines 15..46
    app/docker/components/datatables/volumes-datatable/volumesDatatableController.js on lines 38..69
    app/integrations/storidge/components/drives-datatable/storidgeDrivesDatatableController.js on lines 10..41
    app/integrations/storidge/components/nodes-datatable/storidgeNodesDatatableController.js on lines 24..55
    app/portainer/components/access-datatable/accessDatatableController.js on lines 14..45
    app/portainer/components/datatables/schedules-datatable/schedulesDatatableController.js on lines 14..45
    app/portainer/components/datatables/stacks-datatable/stacksDatatableController.js on lines 14..45

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

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

          this.$onInit = function() {
            this.setDefaults();
            this.prepareTableFromDataset();
    
            this.state.orderBy = this.orderBy;
    app/docker/components/datatables/images-datatable/imagesDatatableController.js on lines 38..70
    app/docker/components/datatables/networks-datatable/networksDatatableController.js on lines 24..55
    app/docker/components/datatables/service-tasks-datatable/serviceTasksDatatableController.js on lines 60..91
    app/docker/components/datatables/tasks-datatable/tasksDatatableController.js on lines 15..46
    app/docker/components/datatables/volumes-datatable/volumesDatatableController.js on lines 38..69
    app/integrations/storidge/components/nodes-datatable/storidgeNodesDatatableController.js on lines 24..55
    app/portainer/components/access-datatable/accessDatatableController.js on lines 14..45
    app/portainer/components/datatables/schedules-datatable/schedulesDatatableController.js on lines 14..45
    app/portainer/components/datatables/stacks-datatable/stacksDatatableController.js on lines 14..45
    app/portainer/components/forms/registry-form-gitlab/gitlab-projects-datatable/gitlabProjectsDatatableController.js on lines 15..46

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

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

      this.$onInit = function() {
        this.setDefaults();
        this.prepareTableFromDataset();
    
        this.state.orderBy = this.orderBy;
    app/docker/components/datatables/images-datatable/imagesDatatableController.js on lines 38..70
    app/docker/components/datatables/networks-datatable/networksDatatableController.js on lines 24..55
    app/docker/components/datatables/service-tasks-datatable/serviceTasksDatatableController.js on lines 60..91
    app/docker/components/datatables/tasks-datatable/tasksDatatableController.js on lines 15..46
    app/docker/components/datatables/volumes-datatable/volumesDatatableController.js on lines 38..69
    app/integrations/storidge/components/drives-datatable/storidgeDrivesDatatableController.js on lines 10..41
    app/portainer/components/access-datatable/accessDatatableController.js on lines 14..45
    app/portainer/components/datatables/schedules-datatable/schedulesDatatableController.js on lines 14..45
    app/portainer/components/datatables/stacks-datatable/stacksDatatableController.js on lines 14..45
    app/portainer/components/forms/registry-form-gitlab/gitlab-projects-datatable/gitlabProjectsDatatableController.js on lines 15..46

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

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

      this.$onInit = function() {
        this.setDefaults();
        this.prepareTableFromDataset();
    
        this.state.orderBy = this.orderBy;
    app/docker/components/datatables/images-datatable/imagesDatatableController.js on lines 38..70
    app/docker/components/datatables/networks-datatable/networksDatatableController.js on lines 24..55
    app/docker/components/datatables/service-tasks-datatable/serviceTasksDatatableController.js on lines 60..91
    app/docker/components/datatables/tasks-datatable/tasksDatatableController.js on lines 15..46
    app/integrations/storidge/components/drives-datatable/storidgeDrivesDatatableController.js on lines 10..41
    app/integrations/storidge/components/nodes-datatable/storidgeNodesDatatableController.js on lines 24..55
    app/portainer/components/access-datatable/accessDatatableController.js on lines 14..45
    app/portainer/components/datatables/schedules-datatable/schedulesDatatableController.js on lines 14..45
    app/portainer/components/datatables/stacks-datatable/stacksDatatableController.js on lines 14..45
    app/portainer/components/forms/registry-form-gitlab/gitlab-projects-datatable/gitlabProjectsDatatableController.js on lines 15..46

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

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

          this.$onInit = function() {
            this.setDefaults();
            this.prepareTableFromDataset();
    
            this.state.orderBy = this.orderBy;
    app/docker/components/datatables/images-datatable/imagesDatatableController.js on lines 38..70
    app/docker/components/datatables/networks-datatable/networksDatatableController.js on lines 24..55
    app/docker/components/datatables/service-tasks-datatable/serviceTasksDatatableController.js on lines 60..91
    app/docker/components/datatables/tasks-datatable/tasksDatatableController.js on lines 15..46
    app/docker/components/datatables/volumes-datatable/volumesDatatableController.js on lines 38..69
    app/integrations/storidge/components/drives-datatable/storidgeDrivesDatatableController.js on lines 10..41
    app/integrations/storidge/components/nodes-datatable/storidgeNodesDatatableController.js on lines 24..55
    app/portainer/components/datatables/schedules-datatable/schedulesDatatableController.js on lines 14..45
    app/portainer/components/datatables/stacks-datatable/stacksDatatableController.js on lines 14..45
    app/portainer/components/forms/registry-form-gitlab/gitlab-projects-datatable/gitlabProjectsDatatableController.js on lines 15..46

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

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

      this.$onInit = function() {
        this.setDefaults();
        this.prepareTableFromDataset();
    
        this.state.orderBy = this.orderBy;
    app/docker/components/datatables/networks-datatable/networksDatatableController.js on lines 24..55
    app/docker/components/datatables/service-tasks-datatable/serviceTasksDatatableController.js on lines 60..91
    app/docker/components/datatables/tasks-datatable/tasksDatatableController.js on lines 15..46
    app/docker/components/datatables/volumes-datatable/volumesDatatableController.js on lines 38..69
    app/integrations/storidge/components/drives-datatable/storidgeDrivesDatatableController.js on lines 10..41
    app/integrations/storidge/components/nodes-datatable/storidgeNodesDatatableController.js on lines 24..55
    app/portainer/components/access-datatable/accessDatatableController.js on lines 14..45
    app/portainer/components/datatables/schedules-datatable/schedulesDatatableController.js on lines 14..45
    app/portainer/components/datatables/stacks-datatable/stacksDatatableController.js on lines 14..45
    app/portainer/components/forms/registry-form-gitlab/gitlab-projects-datatable/gitlabProjectsDatatableController.js on lines 15..46

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

    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

    File createContainerController.js has 721 lines of code (exceeds 300 allowed). Consider refactoring.
    Open

    import _ from 'lodash-es';
    import { ContainerCapabilities, ContainerCapability } from '../../../models/containerCapabilities';
    import { AccessControlFormData } from '../../../../portainer/components/accessControlForm/porAccessControlFormModel';
    import { ContainerDetailsViewModel } from '../../../models/container';
    import { PorImageRegistryModel } from 'Docker/models/porImageRegistry';
    Severity: Major
    Found in app/docker/views/containers/create/createContainerController.js - About 1 day to fix

      File authorizations.go has 688 lines of code (exceeds 300 allowed). Consider refactoring.
      Open

      package portainer
      
      // AuthorizationService represents a service used to
      // update authorizations associated to a user or team.
      type AuthorizationService struct {
      Severity: Minor
      Found in api/authorizations.go - About 1 day to fix

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

        angular.module('portainer.app')
        .controller('EndpointSelectorController', function () {
          var ctrl = this;
        
          this.sortGroups = function(groups) {
        app/portainer/components/multi-endpoint-selector/multiEndpointSelectorController.js on lines 3..37

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

        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

        angular.module('portainer.app')
        .controller('MultiEndpointSelectorController', function () {
          var ctrl = this;
        
          this.sortGroups = function(groups) {
        app/portainer/components/endpoint-selector/endpointSelectorController.js on lines 3..37

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

        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