Showing 1,516 of 3,440 total issues
Function constructor
has 113 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor(data: Service & { Portainer?: PortainerMetadata }) {
this.Model = data;
this.Id = data.ID || '';
this.Tasks = [];
this.Name = data.Spec?.Name || '';
Function SSLSettingsPanel
has 113 lines of code (exceeds 25 allowed). Consider refactoring. Open
function SSLSettingsPanel() {
const settingsQuery = useSSLSettings();
const [reloadingPage, setReloadingPage] = useState(false);
const mutation = useUpdateSSLConfigMutation();
File nodeController.js
has 354 lines of code (exceeds 250 allowed). Consider refactoring. Open
import angular from 'angular';
import _ from 'lodash-es';
import KubernetesResourceReservationHelper from 'Kubernetes/helpers/resourceReservationHelper';
import { KubernetesResourceReservation } from 'Kubernetes/models/resource-reservation/models';
import KubernetesEventHelper from 'Kubernetes/helpers/eventHelper';
File application.service.ts
has 354 lines of code (exceeds 250 allowed). Consider refactoring. Open
import {
DaemonSetList,
StatefulSetList,
DeploymentList,
Deployment,
Function ImageServiceFactory
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
function ImageServiceFactory($q, Image, ImageHelper, RegistryService, HttpRequestHelper, ContainerService, FileUploadService) {
'use strict';
var service = {};
service.image = function (imageId) {
- Read upRead up
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 ImportDeviceController
has 108 lines of code (exceeds 25 allowed). Consider refactoring. Open
function ImportDeviceController($async, $q, $scope, $state, EndpointService, GroupService, TagService, Notifications, Authentication, FileUploadService) {
$scope.state = {
actionInProgress: false,
vouchersUploading: false,
vouchersUploaded: false,
Function DefaultEndpointAuthorizationsForEndpointAdministratorRole
has 132 lines of code (exceeds 50 allowed). Consider refactoring. Open
func DefaultEndpointAuthorizationsForEndpointAdministratorRole() portainer.Authorizations {
return map[portainer.Authorization]bool{
portainer.OperationDockerContainerArchiveInfo: true,
portainer.OperationDockerContainerList: true,
portainer.OperationDockerContainerExport: true,
Function constructor
has 107 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor(
$scope,
$async,
$state,
$timeout,
File application.queries.ts
has 345 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { UseQueryResult, useMutation, useQuery } from '@tanstack/react-query';
import { Pod } from 'kubernetes-types/core/v1';
import { queryClient, withError } from '@/react-tools/react-query';
import { EnvironmentId } from '@/react/portainer/environments/types';
File deployController.js
has 344 lines of code (exceeds 250 allowed). Consider refactoring. Open
import angular from 'angular';
import _ from 'lodash-es';
import stripAnsi from 'strip-ansi';
import PortainerError from '@/portainer/error';
Method ClientFactory.MigrateEndpointIngresses
has a Cognitive Complexity of 44 (exceeds 20 allowed). Consider refactoring. Open
func (factory *ClientFactory) MigrateEndpointIngresses(e *portainer.Endpoint, datastore dataservices.DataStore, cli *KubeClient) error {
return datastore.UpdateTx(func(tx dataservices.DataStoreTx) error {
environment, err := tx.Endpoint().Endpoint(e.ID)
if err != nil {
log.Error().Err(err).Msgf("Error retrieving environment %d", e.ID)
- Read upRead up
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 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;
File transport.go
has 593 lines of code (exceeds 500 allowed). Consider refactoring. Open
package docker
import (
"bytes"
"encoding/base64"
File resourcePoolController.js
has 342 lines of code (exceeds 250 allowed). Consider refactoring. Open
import angular from 'angular';
import _ from 'lodash-es';
import filesizeParser from 'filesize-parser';
import { KubernetesResourceQuotaDefaults } from 'Kubernetes/models/resource-quota/models';
import KubernetesResourceReservationHelper from 'Kubernetes/helpers/resourceReservationHelper';
File utils.ts
has 342 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { Ingress } from '@/react/kubernetes/ingresses/types';
import { ServiceFormValues } from '../../CreateView/application-services/types';
import { ApplicationFormValues } from '../../types';
import {
Function NotificationsMenu
has 105 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function NotificationsMenu() {
const notificationsStoreState = useStore(notificationsStore);
const { removeNotification } = notificationsStoreState;
const { clearUserNotifications } = notificationsStoreState;
Function IngressDatatable
has 103 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function IngressDatatable() {
const tableState = useTableState(settingsStore, storageKey);
const environmentId = useEnvironmentId();
const { authorized: canAccessSystemResources } = useAuthorizations(
Function BuildImageController
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
function BuildImageController($scope, $async, $window, BuildService, Notifications, HttpRequestHelper, endpoint) {
$scope.endpoint = endpoint;
$scope.options = [editor, upload, url];
$scope.state = {
- Read upRead up
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 constructor
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
constructor(data: Service & { Portainer?: PortainerMetadata }) {
this.Model = data;
this.Id = data.ID || '';
this.Tasks = [];
this.Name = data.Spec?.Name || '';
- Read upRead up
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 DefaultEndpointAuthorizationsForStandardUserRole
has 127 lines of code (exceeds 50 allowed). Consider refactoring. Open
func DefaultEndpointAuthorizationsForStandardUserRole(volumeBrowsingAuthorizations bool) portainer.Authorizations {
authorizations := map[portainer.Authorization]bool{
portainer.OperationDockerContainerArchiveInfo: true,
portainer.OperationDockerContainerList: true,
portainer.OperationDockerContainerExport: true,