portainer/portainer

View on GitHub
app/docker/views/services/edit/serviceController.js

Summary

Maintainability
F
6 days
Test Coverage

File serviceController.js has 792 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require('./includes/configs.html');
require('./includes/constraints.html');
require('./includes/container-specs.html');
require('./includes/containerlabels.html');
require('./includes/environmentvariables.html');
Severity: Major
Found in app/docker/views/services/edit/serviceController.js - About 1 day to fix

    Function initView has 106 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function initView() {
          var apiVersion = $scope.applicationState.endpoint.apiVersion;
          var agentProxy = $scope.applicationState.endpoint.mode.agentProxy;
    
          var service = null;
    Severity: Major
    Found in app/docker/views/services/edit/serviceController.js - About 4 hrs to fix

      Function buildChanges has 99 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function buildChanges(service) {
            var config = convertServiceToConfig(service.Model);
            config.Name = service.Name;
            config.Labels = LabelHelper.fromKeyValueToLabelHash(service.ServiceLabels);
            config.TaskTemplate.ContainerSpec.Env = envVarsUtils.convertToArrayOfStrings(service.EnvironmentVariables);
      Severity: Major
      Found in app/docker/views/services/edit/serviceController.js - About 3 hrs to fix

        Function success has 70 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                .then(async function success(data) {
                  $scope.nodes = data.nodes;
                  $scope.configs = data.configs;
                  $scope.secrets = data.secrets;
                  $scope.availableImages = ImageService.getUniqueTagListFromImages(data.availableImages);
        Severity: Major
        Found in app/docker/views/services/edit/serviceController.js - About 2 hrs to fix

          Consider simplifying this complex logical expression.
          Open

                        if (item.IPAM.Config.length) {
                          addr = item.IPAM.Config[0].Subnet;
                        } else {
                          const network = await NetworkService.network(item.Id);
                          addr = (network && network.IPAM && network.IPAM.Config && network.IPAM.Config.length && network.IPAM.Config[0].Subnet) || '';
          Severity: Major
          Found in app/docker/views/services/edit/serviceController.js - About 40 mins to fix

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

                $scope.updateContainerLabel = function updateLabel(service, label) {
                  if (label.value !== label.originalValue || label.key !== label.originalKey) {
                    updateServiceArray(service, 'ServiceContainerLabels', service.ServiceContainerLabels);
                  }
                };
            Severity: Major
            Found in app/docker/views/services/edit/serviceController.js and 2 other locations - About 1 hr to fix
            app/docker/views/services/edit/serviceController.js on lines 204..208
            app/docker/views/services/edit/serviceController.js on lines 323..327

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

            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

                $scope.updateLabel = function updateLabel(service, label) {
                  if (label.value !== label.originalValue || label.key !== label.originalKey) {
                    updateServiceArray(service, 'ServiceLabels', service.ServiceLabels);
                  }
                };
            Severity: Major
            Found in app/docker/views/services/edit/serviceController.js and 2 other locations - About 1 hr to fix
            app/docker/views/services/edit/serviceController.js on lines 219..223
            app/docker/views/services/edit/serviceController.js on lines 323..327

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

            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

                $scope.updateLogDriverOpt = function updateLogDriverOpt(service, variable) {
                  if (variable.value !== variable.originalValue || variable.key !== variable.originalKey) {
                    updateServiceArray(service, 'LogDriverOpts', service.LogDriverOpts);
                  }
                };
            Severity: Major
            Found in app/docker/views/services/edit/serviceController.js and 2 other locations - About 1 hr to fix
            app/docker/views/services/edit/serviceController.js on lines 204..208
            app/docker/views/services/edit/serviceController.js on lines 219..223

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

            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.removePortPublishedBinding = function removePortPublishedBinding(service, index) {
                  var removedElement = service.Ports.splice(index, 1);
                  if (removedElement !== null) {
                    updateServiceArray(service, 'Ports', service.Ports);
                  }
            Severity: Major
            Found in app/docker/views/services/edit/serviceController.js and 7 other locations - About 1 hr to fix
            app/docker/views/services/edit/serviceController.js on lines 163..168
            app/docker/views/services/edit/serviceController.js on lines 188..193
            app/docker/views/services/edit/serviceController.js on lines 198..203
            app/docker/views/services/edit/serviceController.js on lines 213..218
            app/docker/views/services/edit/serviceController.js on lines 228..233
            app/docker/views/services/edit/serviceController.js on lines 273..278
            app/docker/views/services/edit/serviceController.js on lines 317..322

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

            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.removeConfig = function removeSecret(service, index) {
                  var removedElement = service.ServiceConfigs.splice(index, 1);
                  if (removedElement !== null) {
                    updateServiceArray(service, 'ServiceConfigs', service.ServiceConfigs);
                  }
            Severity: Major
            Found in app/docker/views/services/edit/serviceController.js and 7 other locations - About 1 hr to fix
            app/docker/views/services/edit/serviceController.js on lines 188..193
            app/docker/views/services/edit/serviceController.js on lines 198..203
            app/docker/views/services/edit/serviceController.js on lines 213..218
            app/docker/views/services/edit/serviceController.js on lines 228..233
            app/docker/views/services/edit/serviceController.js on lines 273..278
            app/docker/views/services/edit/serviceController.js on lines 306..311
            app/docker/views/services/edit/serviceController.js on lines 317..322

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

            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.removeSecret = function removeSecret(service, index) {
                  var removedElement = service.ServiceSecrets.splice(index, 1);
                  if (removedElement !== null) {
                    updateServiceArray(service, 'ServiceSecrets', service.ServiceSecrets);
                  }
            Severity: Major
            Found in app/docker/views/services/edit/serviceController.js and 7 other locations - About 1 hr to fix
            app/docker/views/services/edit/serviceController.js on lines 163..168
            app/docker/views/services/edit/serviceController.js on lines 198..203
            app/docker/views/services/edit/serviceController.js on lines 213..218
            app/docker/views/services/edit/serviceController.js on lines 228..233
            app/docker/views/services/edit/serviceController.js on lines 273..278
            app/docker/views/services/edit/serviceController.js on lines 306..311
            app/docker/views/services/edit/serviceController.js on lines 317..322

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

            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.removeContainerLabel = function removeLabel(service, index) {
                  var removedElement = service.ServiceContainerLabels.splice(index, 1);
                  if (removedElement !== null) {
                    updateServiceArray(service, 'ServiceContainerLabels', service.ServiceContainerLabels);
                  }
            Severity: Major
            Found in app/docker/views/services/edit/serviceController.js and 7 other locations - About 1 hr to fix
            app/docker/views/services/edit/serviceController.js on lines 163..168
            app/docker/views/services/edit/serviceController.js on lines 188..193
            app/docker/views/services/edit/serviceController.js on lines 198..203
            app/docker/views/services/edit/serviceController.js on lines 228..233
            app/docker/views/services/edit/serviceController.js on lines 273..278
            app/docker/views/services/edit/serviceController.js on lines 306..311
            app/docker/views/services/edit/serviceController.js on lines 317..322

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

            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.removePlacementConstraint = function removePlacementConstraint(service, index) {
                  var removedElement = service.ServiceConstraints.splice(index, 1);
                  if (removedElement !== null) {
                    updateServiceArray(service, 'ServiceConstraints', service.ServiceConstraints);
                  }
            Severity: Major
            Found in app/docker/views/services/edit/serviceController.js and 7 other locations - About 1 hr to fix
            app/docker/views/services/edit/serviceController.js on lines 163..168
            app/docker/views/services/edit/serviceController.js on lines 188..193
            app/docker/views/services/edit/serviceController.js on lines 198..203
            app/docker/views/services/edit/serviceController.js on lines 213..218
            app/docker/views/services/edit/serviceController.js on lines 228..233
            app/docker/views/services/edit/serviceController.js on lines 306..311
            app/docker/views/services/edit/serviceController.js on lines 317..322

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

            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.removeLabel = function removeLabel(service, index) {
                  var removedElement = service.ServiceLabels.splice(index, 1);
                  if (removedElement !== null) {
                    updateServiceArray(service, 'ServiceLabels', service.ServiceLabels);
                  }
            Severity: Major
            Found in app/docker/views/services/edit/serviceController.js and 7 other locations - About 1 hr to fix
            app/docker/views/services/edit/serviceController.js on lines 163..168
            app/docker/views/services/edit/serviceController.js on lines 188..193
            app/docker/views/services/edit/serviceController.js on lines 213..218
            app/docker/views/services/edit/serviceController.js on lines 228..233
            app/docker/views/services/edit/serviceController.js on lines 273..278
            app/docker/views/services/edit/serviceController.js on lines 306..311
            app/docker/views/services/edit/serviceController.js on lines 317..322

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

            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.removeMount = function removeMount(service, index) {
                  var removedElement = service.ServiceMounts.splice(index, 1);
                  if (removedElement !== null) {
                    updateServiceArray(service, 'ServiceMounts', service.ServiceMounts);
                  }
            Severity: Major
            Found in app/docker/views/services/edit/serviceController.js and 7 other locations - About 1 hr to fix
            app/docker/views/services/edit/serviceController.js on lines 163..168
            app/docker/views/services/edit/serviceController.js on lines 188..193
            app/docker/views/services/edit/serviceController.js on lines 198..203
            app/docker/views/services/edit/serviceController.js on lines 213..218
            app/docker/views/services/edit/serviceController.js on lines 273..278
            app/docker/views/services/edit/serviceController.js on lines 306..311
            app/docker/views/services/edit/serviceController.js on lines 317..322

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

            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.removeLogDriverOpt = function removeLogDriverOpt(service, index) {
                  var removedElement = service.LogDriverOpts.splice(index, 1);
                  if (removedElement !== null) {
                    updateServiceArray(service, 'LogDriverOpts', service.LogDriverOpts);
                  }
            Severity: Major
            Found in app/docker/views/services/edit/serviceController.js and 7 other locations - About 1 hr to fix
            app/docker/views/services/edit/serviceController.js on lines 163..168
            app/docker/views/services/edit/serviceController.js on lines 188..193
            app/docker/views/services/edit/serviceController.js on lines 198..203
            app/docker/views/services/edit/serviceController.js on lines 213..218
            app/docker/views/services/edit/serviceController.js on lines 228..233
            app/docker/views/services/edit/serviceController.js on lines 273..278
            app/docker/views/services/edit/serviceController.js on lines 306..311

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

            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

                $scope.addLogDriverOpt = function addLogDriverOpt(service) {
                  service.LogDriverOpts.push({ key: '', value: '', originalValue: '' });
                  updateServiceArray(service, 'LogDriverOpts', service.LogDriverOpts);
                };
            Severity: Major
            Found in app/docker/views/services/edit/serviceController.js and 3 other locations - About 1 hr to fix
            app/docker/views/services/edit/serviceController.js on lines 194..197
            app/docker/views/services/edit/serviceController.js on lines 209..212
            app/docker/views/services/edit/serviceController.js on lines 269..272

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

            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

                $scope.addLabel = function addLabel(service) {
                  service.ServiceLabels.push({ key: '', value: '', originalValue: '' });
                  updateServiceArray(service, 'ServiceLabels', service.ServiceLabels);
                };
            Severity: Major
            Found in app/docker/views/services/edit/serviceController.js and 3 other locations - About 1 hr to fix
            app/docker/views/services/edit/serviceController.js on lines 209..212
            app/docker/views/services/edit/serviceController.js on lines 269..272
            app/docker/views/services/edit/serviceController.js on lines 313..316

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

            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

                $scope.addPlacementConstraint = function addPlacementConstraint(service) {
                  service.ServiceConstraints.push({ key: '', operator: '==', value: '' });
                  updateServiceArray(service, 'ServiceConstraints', service.ServiceConstraints);
                };
            Severity: Major
            Found in app/docker/views/services/edit/serviceController.js and 3 other locations - About 1 hr to fix
            app/docker/views/services/edit/serviceController.js on lines 194..197
            app/docker/views/services/edit/serviceController.js on lines 209..212
            app/docker/views/services/edit/serviceController.js on lines 313..316

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

            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

                $scope.addContainerLabel = function addContainerLabel(service) {
                  service.ServiceContainerLabels.push({ key: '', value: '', originalValue: '' });
                  updateServiceArray(service, 'ServiceContainerLabels', service.ServiceContainerLabels);
                };
            Severity: Major
            Found in app/docker/views/services/edit/serviceController.js and 3 other locations - About 1 hr to fix
            app/docker/views/services/edit/serviceController.js on lines 194..197
            app/docker/views/services/edit/serviceController.js on lines 269..272
            app/docker/views/services/edit/serviceController.js on lines 313..316

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

            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.removeHostsEntry = function (service, index) {
                  var removedElement = service.Hosts.splice(index, 1);
                  if (removedElement !== null) {
                    updateServiceArray(service, 'Hosts', service.Hosts);
                  }
            Severity: Major
            Found in app/docker/views/services/edit/serviceController.js and 1 other location - About 1 hr to fix
            app/docker/views/services/edit/serviceController.js on lines 287..292

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

            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.removePlacementPreference = function (service, index) {
                  var removedElement = service.ServicePreferences.splice(index, 1);
                  if (removedElement !== null) {
                    updateServiceArray(service, 'ServicePreferences', service.ServicePreferences);
                  }
            Severity: Major
            Found in app/docker/views/services/edit/serviceController.js and 1 other location - About 1 hr to fix
            app/docker/views/services/edit/serviceController.js on lines 338..343

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

            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

                      if (Object.keys(logOpts).length !== 0 && logOpts.constructor === Object) {
                        config.TaskTemplate.LogDriver.Options = logOpts;
                      }
            Severity: Minor
            Found in app/docker/views/services/edit/serviceController.js and 1 other location - About 55 mins to fix
            app/docker/views/services/create/createServiceController.js on lines 480..482

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

            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

                $scope.removeService = function () {
                  confirmDelete('Do you want to remove this service? All the containers associated to this service will be removed too.').then((confirmed) => {
                    if (!confirmed) {
                      return;
                    }
            Severity: Major
            Found in app/docker/views/services/edit/serviceController.js and 2 other locations - About 55 mins to fix
            app/portainer/views/stacks/edit/stackController.js on lines 148..155
            app/portainer/views/users/edit/userController.js on lines 32..39

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

            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

                function mountsAreValid() {
                  const mounts = $scope.service.ServiceMounts;
                  return mounts.every((mount) => mount.Source && mount.Target);
                }
            Severity: Minor
            Found in app/docker/views/services/edit/serviceController.js and 1 other location - About 45 mins to fix
            app/docker/views/services/create/createServiceController.js on lines 564..567

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

            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

                      if (maxCpus > 0) {
                        $scope.state.sliderMaxCpu = maxCpus / 1000000000;
                      } else {
                        $scope.state.sliderMaxCpu = 32;
                      }
            Severity: Minor
            Found in app/docker/views/services/edit/serviceController.js and 1 other location - About 40 mins to fix
            app/docker/views/services/create/createServiceController.js on lines 592..596

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

            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

                  config.TaskTemplate.ContainerSpec.Configs = service.ServiceConfigs ? service.ServiceConfigs.map(ConfigHelper.configConfig) : [];
            Severity: Minor
            Found in app/docker/views/services/edit/serviceController.js and 1 other location - About 30 mins to fix
            app/docker/views/services/edit/serviceController.js on lines 466..466

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

                  config.TaskTemplate.ContainerSpec.Secrets = service.ServiceSecrets ? service.ServiceSecrets.map(SecretHelper.secretConfig) : [];
            Severity: Minor
            Found in app/docker/views/services/edit/serviceController.js and 1 other location - About 30 mins to fix
            app/docker/views/services/edit/serviceController.js on lines 467..467

            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

            There are no issues that match your filters.

            Category
            Status