portainer/portainer

View on GitHub

Showing 3,384 of 3,384 total issues

File filesystem.go has 746 lines of code (exceeds 500 allowed). Consider refactoring.
Open

package filesystem

import (
    "bytes"
    "encoding/pem"
Severity: Minor
Found in api/filesystem/filesystem.go - About 7 hrs to fix

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

      return (
        <RowProvider context={rowContext}>
          <Datatable<User>
            dataset={users}
            columns={columns}
    app/react/portainer/users/teams/ItemView/TeamAssociationSelector/TeamMembersList/TeamMembersList.tsx on lines 52..83

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 193.

    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

      return (
        <RowProvider context={rowContext}>
          <Datatable<User>
            dataset={users}
            columns={columns}
    app/react/portainer/users/teams/ItemView/TeamAssociationSelector/UsersList/UsersList.tsx on lines 36..67

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

    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

    package docker
    
    import (
        "context"
        "net/http"
    Severity: Major
    Found in api/http/proxy/factory/docker/configs.go and 1 other location - About 7 hrs to fix
    api/http/proxy/factory/docker/secrets.go on lines 1..87

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

    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

    package docker
    
    import (
        "context"
        "net/http"
    Severity: Major
    Found in api/http/proxy/factory/docker/secrets.go and 1 other location - About 7 hrs to fix
    api/http/proxy/factory/docker/configs.go on lines 1..87

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

    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 index.js has 485 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import _ from 'lodash-es';
    import { KubernetesPortMapping, KubernetesPortMappingPort } from 'Kubernetes/models/port/models';
    import { KubernetesService, KubernetesServicePort, KubernetesServiceTypes } from 'Kubernetes/models/service/models';
    import { KubernetesConfigurationKinds } from 'Kubernetes/models/configuration/models';
    import {
    Severity: Minor
    Found in app/kubernetes/helpers/application/index.js - About 7 hrs to fix

      File __module.js has 481 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import featureFlagModule from '@/react/portainer/feature-flags';
      
      import './rbac';
      
      import componentsModule from './components';
      Severity: Minor
      Found in app/portainer/__module.js - About 7 hrs to fix

        Method Server.Start has 212 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func (server *Server) Start() error {
            kubernetesTokenCacheManager := server.KubernetesTokenCacheManager
        
            requestBouncer := security.NewRequestBouncer(server.DataStore, server.JWTService, server.APIKeyService)
        
        
        Severity: Major
        Found in api/http/server.go - About 7 hrs to fix

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

              function deleteSelectedUsers(selectedItems) {
                var actionCount = selectedItems.length;
                angular.forEach(selectedItems, function (user) {
                  UserService.deleteUser(user.Id)
                    .then(function success() {
          Severity: Major
          Found in app/portainer/views/users/usersController.js and 1 other location - About 7 hrs to fix
          app/docker/views/secrets/secretsController.js on lines 7..26

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

          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.removeAction = async function (selectedItems) {
                var actionCount = selectedItems.length;
                angular.forEach(selectedItems, function (secret) {
                  SecretService.remove(secret.Id)
                    .then(function success() {
          Severity: Major
          Found in app/docker/views/secrets/secretsController.js and 1 other location - About 7 hrs to fix
          app/portainer/views/users/usersController.js on lines 72..91

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

          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

          Function StateManagerFactory has 186 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function StateManagerFactory(
            $async,
            $q,
            SystemService,
            InfoHelper,
          Severity: Major
          Found in app/portainer/services/stateManager.js - About 7 hrs to fix

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

                function assignSwarmStackResources(resources, agentProxy) {
                  var services = resources.services;
                  var tasks = resources.tasks;
            
                  if (agentProxy) {
            Severity: Major
            Found in app/portainer/views/stacks/edit/stackController.js and 1 other location - About 7 hrs to fix
            app/docker/views/services/servicesController.js on lines 26..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 181.

            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

                    .then(function success(data) {
                      var services = data.services;
                      var tasks = data.tasks;
            
                      if (agentProxy) {
            Severity: Major
            Found in app/docker/views/services/servicesController.js and 1 other location - About 7 hrs to fix
            app/portainer/views/stacks/edit/stackController.js on lines 394..414

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

            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

            export function TableActions({
              selectedItems,
              onRemove,
            }: {
              selectedItems: Array<DecoratedVolume>;
            app/react/docker/secrets/ListView/SecretsDatatable.tsx on lines 90..113

            Duplicated Code

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

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

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

            Tuning

            This issue has a mass of 181.

            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 TableActions({
              selectedItems,
              onRemove,
            }: {
              selectedItems: Array<SecretViewModel>;
            Severity: Major
            Found in app/react/docker/secrets/ListView/SecretsDatatable.tsx and 1 other location - About 7 hrs to fix
            app/react/docker/volumes/ListView/VolumesDatatable/TableActions.tsx on lines 8..30

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

            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

            Function config has 181 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              .config(function config($stateRegistryProvider) {
                const edge = {
                  name: 'edge',
                  url: '/edge',
                  parent: 'root',
            Severity: Major
            Found in app/edge/__module.js - About 7 hrs to fix

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

                it('should split single quoted string', () => {
                  const i = 'I said "I am sorry.", and he said "it doesn\'t matter."';
                  const o = splitargs(i);
                  expect(o).toHaveLength(7);
                  expect(o[0]).toBe('I');
              Severity: Major
              Found in app/docker/helpers/splitargs.test.ts and 2 other locations - About 7 hrs to fix
              app/docker/helpers/splitargs.test.ts on lines 24..35
              app/docker/helpers/splitargs.test.ts on lines 50..61

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

              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

                it('should split pure double quoted string', () => {
                  const i = 'I said "I am sorry.", and he said "it doesn\'t matter."';
                  const o = splitargs(i);
                  expect(o).toHaveLength(7);
                  expect(o[0]).toBe('I');
              Severity: Major
              Found in app/docker/helpers/splitargs.test.ts and 2 other locations - About 7 hrs to fix
              app/docker/helpers/splitargs.test.ts on lines 37..48
              app/docker/helpers/splitargs.test.ts on lines 50..61

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

              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

                it('should split pure single quoted string', () => {
                  const i = "I said 'I am sorry.', and he said \"it doesn't matter.\"";
                  const o = splitargs(i);
                  expect(o).toHaveLength(7);
                  expect(o[0]).toBe('I');
              Severity: Major
              Found in app/docker/helpers/splitargs.test.ts and 2 other locations - About 7 hrs to fix
              app/docker/helpers/splitargs.test.ts on lines 24..35
              app/docker/helpers/splitargs.test.ts on lines 37..48

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

              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 setUpdateRepeater() {
                    var refreshRate = $scope.state.refreshRate;
                    $scope.repeater = $interval(function () {
                      TaskService.logs($transition$.params().id, 1, 1, $scope.state.displayTimestamps ? 1 : 0, moment($scope.state.sinceTimestamp).unix(), $scope.state.lineCount)
                        .then(function success(data) {
              Severity: Major
              Found in app/docker/views/tasks/logs/taskLogsController.js and 1 other location - About 7 hrs to fix
              app/docker/views/services/logs/serviceLogsController.js on lines 37..49

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

              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