portainer/portainer

View on GitHub

Showing 1,497 of 3,384 total issues

Function CreateIngressView has 726 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function CreateIngressView() {
  const environmentId = useEnvironmentId();
  const { params } = useCurrentStateAndParams();
  const { authorized: isAuthorizedToAddEdit } = useAuthorizations([
    'K8sIngressesW',
Severity: Major
Found in app/react/kubernetes/ingresses/CreateIngressView/CreateIngressView.tsx - About 3 days to fix

    File portainer.go has 1381 lines of code (exceeds 500 allowed). Consider refactoring.
    Open

    package portainer
    
    import (
        "context"
        "io"
    Severity: Major
    Found in api/portainer.go - About 2 days to fix

      File createApplicationController.js has 945 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import angular from 'angular';
      import _ from 'lodash-es';
      import filesizeParser from 'filesize-parser';
      import * as JsonPatch from 'fast-json-patch';
      import { RegistryTypes } from '@/portainer/models/registryTypes';

        Function StackServiceFactory has 400 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          function StackServiceFactory($q, $async, Stack, StackByName, FileUploadService, StackHelper, ServiceService, ContainerService, SwarmService) {
            'use strict';
            var service = {
              updateGit,
              updateKubeGit,
        Severity: Major
        Found in app/portainer/services/api/stackService.js - About 2 days to fix

          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

            File IngressForm.tsx has 767 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import { ChangeEvent, useEffect } from 'react';
            import { Plus, RefreshCw, Trash2 } from 'lucide-react';
            
            import Route from '@/assets/ico/route.svg?c';
            
            
            Severity: Major
            Found in app/react/kubernetes/ingresses/CreateIngressView/IngressForm.tsx - About 1 day to fix

              File CreateIngressView.tsx has 765 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import { useState, useEffect, useMemo, useCallback, ReactNode } from 'react';
              import { useCurrentStateAndParams, useRouter } from '@uirouter/react';
              import { v4 as uuidv4 } from 'uuid';
              import { debounce } from 'lodash';
              
              

                Method Store.Export has a Cognitive Complexity of 98 (exceeds 20 allowed). Consider refactoring.
                Open

                func (store *Store) Export(filename string) (err error) {
                
                    backup := storeExport{}
                
                    if c, err := store.CustomTemplate().ReadAll(); err != nil {
                Severity: Minor
                Found in api/datastore/services.go - About 1 day to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Function EndpointController has 292 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function EndpointController(
                  $async,
                  $scope,
                  $state,
                  $transition$,
                Severity: Major
                Found in app/portainer/views/endpoints/edit/endpointController.js - About 1 day to fix

                  Function SettingsAuthenticationController has a Cognitive Complexity of 72 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function SettingsAuthenticationController($q, $scope, $state, Notifications, SettingsService, FileUploadService, TeamService, LDAPService) {
                    $scope.authMethod = 1;
                  
                    $scope.state = {
                      uploadInProgress: false,

                  Cognitive Complexity

                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                  A method's cognitive complexity is based on a few simple rules:

                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                  • Code is considered more complex for each "break in the linear flow of the code"
                  • Code is considered more complex when "flow breaking structures are nested"

                  Further reading

                  Function CreateIngressView has a Cognitive Complexity of 71 (exceeds 5 allowed). Consider refactoring.
                  Open

                  export function CreateIngressView() {
                    const environmentId = useEnvironmentId();
                    const { params } = useCurrentStateAndParams();
                    const { authorized: isAuthorizedToAddEdit } = useAuthorizations([
                      'K8sIngressesW',

                  Cognitive Complexity

                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                  A method's cognitive complexity is based on a few simple rules:

                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                  • Code is considered more complex for each "break in the linear flow of the code"
                  • Code is considered more complex when "flow breaking structures are nested"

                  Further reading

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

                  import angular from 'angular';
                  
                  import { PortainerEndpointTypes } from 'Portainer/models/endpoint/models';
                  
                  import { EnvironmentStatus } from '@/react/portainer/environments/types';
                  Severity: Major
                  Found in app/docker/__module.js - About 1 day to fix

                    KubernetesCreateApplicationController has 73 functions (exceeds 20 allowed). Consider refactoring.
                    Open

                    class KubernetesCreateApplicationController {
                      /* #region  CONSTRUCTOR */
                    
                      /* @ngInject */
                      constructor(

                      Method Handler.endpointUpdate has a Cognitive Complexity of 83 (exceeds 20 allowed). Consider refactoring.
                      Open

                      func (handler *Handler) endpointUpdate(w http.ResponseWriter, r *http.Request) *httperror.HandlerError {
                          endpointID, err := request.RetrieveNumericRouteVariableValue(r, "id")
                          if err != nil {
                              return httperror.BadRequest("Invalid environment identifier route variable", err)
                          }
                      Severity: Minor
                      Found in api/http/handler/endpoints/endpoint_update.go - About 1 day to fix

                      Cognitive Complexity

                      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                      A method's cognitive complexity is based on a few simple rules:

                      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                      • Code is considered more complex for each "break in the linear flow of the code"
                      • Code is considered more complex when "flow breaking structures are nested"

                      Further reading

                      Function ApplicationSummaryWidget has 267 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export function ApplicationSummaryWidget() {
                        const stateAndParams = useCurrentStateAndParams();
                        const {
                          params: {
                            namespace,

                        Function ChartService has 241 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          function ChartService() {
                            'use strict';
                        
                            // Max. number of items to display on a chart
                            var CHART_LIMIT = 600;
                        Severity: Major
                        Found in app/portainer/services/chartService.js - About 1 day to fix

                          File createServiceController.js has 566 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          import _ from 'lodash-es';
                          
                          import * as envVarsUtils from '@/react/components/form-components/EnvironmentVariablesFieldset/utils';
                          import { PorImageRegistryModel } from 'Docker/models/porImageRegistry';
                          import { AccessControlFormData } from '../../../../portainer/components/accessControlForm/porAccessControlFormModel';
                          Severity: Major
                          Found in app/docker/views/services/create/createServiceController.js - About 1 day to fix

                            Function kubeServicesValidation has 232 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            export function kubeServicesValidation(
                              validationData?: AppServicesValidationData
                            ): SchemaOf<ServiceFormValues[]> {
                              return array(
                                object({

                              Function EndpointController has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring.
                              Open

                              function EndpointController(
                                $async,
                                $scope,
                                $state,
                                $transition$,
                              Severity: Minor
                              Found in app/portainer/views/endpoints/edit/endpointController.js - About 1 day to fix

                              Cognitive Complexity

                              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                              A method's cognitive complexity is based on a few simple rules:

                              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                              • Code is considered more complex for each "break in the linear flow of the code"
                              • Code is considered more complex when "flow breaking structures are nested"

                              Further reading

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

                              import { EnvironmentStatus } from '@/react/portainer/environments/types';
                              import { getSelfSubjectAccessReview } from '@/react/kubernetes/namespaces/getSelfSubjectAccessReview';
                              
                              import { updateAxiosAdapter } from '@/portainer/services/axios';
                              import { PortainerEndpointTypes } from 'Portainer/models/endpoint/models';
                              Severity: Major
                              Found in app/kubernetes/__module.js - About 1 day to fix
                                Severity
                                Category
                                Status
                                Source
                                Language