portainer/portainer

View on GitHub
app/docker/views/containers/console/containerConsoleController.js

Summary

Maintainability
C
1 day
Test Coverage

Function initTerm has 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function initTerm(url, resizeRestCall) {
      let resizefun = resize.bind(this, resizeRestCall);

      if ($transition$.params().nodeName) {
        url += '&nodeName=' + $transition$.params().nodeName;
Severity: Minor
Found in app/docker/views/containers/console/containerConsoleController.js - About 1 hr to fix

    Function connectExec has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        $scope.connectExec = function () {
          if ($scope.state > states.disconnected) {
            return;
          }
    
    
    Severity: Minor
    Found in app/docker/views/containers/console/containerConsoleController.js - About 1 hr to fix

      Function onopen has 33 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            socket.onopen = function () {
              $scope.state = states.connected;
              term = new Terminal();
              socket.send('export LANG=C.UTF-8\n');
              socket.send('export LC_ALL=C.UTF-8\n');
      Severity: Minor
      Found in app/docker/views/containers/console/containerConsoleController.js - About 1 hr to fix

        Function connectAttach has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            $scope.connectAttach = function () {
              if ($scope.state > states.disconnected) {
                return;
              }
        
        
        Severity: Minor
        Found in app/docker/views/containers/console/containerConsoleController.js - About 1 hr to fix

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

              $scope.initView = function () {
                HttpRequestHelper.setPortainerAgentTargetHeader($transition$.params().nodeName);
                return ContainerService.container(endpoint.Id, $transition$.params().id)
                  .then(function success(data) {
                    var container = data;
          Severity: Minor
          Found in app/docker/views/containers/console/containerConsoleController.js - About 1 hr to fix

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

                      const base = window.location.origin.startsWith('http') ? `${window.location.origin}${baseHref()}` : baseHref();
            app/docker/views/containers/console/containerConsoleController.js on lines 116..116

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

            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

                      const base = window.location.origin.startsWith('http') ? `${window.location.origin}${baseHref()}` : baseHref();
            app/docker/views/containers/console/containerConsoleController.js on lines 76..76

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

            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

                      var url =
                        base +
                        'api/websocket/attach?' +
                        Object.keys(params)
                          .map((k) => k + '=' + params[k])
            app/docker/views/containers/console/containerConsoleController.js on lines 117..122

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

            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

                      var url =
                        base +
                        'api/websocket/exec?' +
                        Object.keys(params)
                          .map((k) => k + '=' + params[k])
            app/docker/views/containers/console/containerConsoleController.js on lines 77..82

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

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

                $scope.handleIsCustomCommandChange = function (enabled) {
                  $scope.$evalAsync(() => {
                    $scope.formValues.isCustomCommand = enabled;
                  });
                };
            app/docker/views/images/build/buildImageController.js on lines 38..42
            app/docker/views/networks/create/createNetworkController.js on lines 208..212
            app/docker/views/networks/create/createNetworkController.js on lines 214..218
            app/portainer/views/stacks/create/createStackController.js on lines 101..105
            app/portainer/views/stacks/edit/stackController.js on lines 99..103
            app/portainer/views/stacks/edit/stackController.js on lines 105..109

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

            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