Showing 1,519 of 3,462 total issues
Function applicationCommon
has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring. Open
static applicationCommon(res, data, pods, service, ingresses) {
const containers = data.spec.template ? _.without(_.concat(data.spec.template.spec.containers, data.spec.template.spec.initContainers), undefined) : data.spec.containers;
res.Id = data.metadata.uid;
res.Name = data.metadata.name;
res.Metadata = data.metadata;
- 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
Method Handler.updateEndpointGroup
has a Cognitive Complexity of 71 (exceeds 20 allowed). Consider refactoring. Open
func (handler *Handler) updateEndpointGroup(tx dataservices.DataStoreTx, endpointGroupID portainer.EndpointGroupID, payload endpointGroupUpdatePayload) (*portainer.EndpointGroup, error) {
endpointGroup, err := tx.EndpointGroup().Read(portainer.EndpointGroupID(endpointGroupID))
if tx.IsErrObjectNotFound(err) {
return nil, httperror.NotFound("Unable to find an environment group with the specified identifier inside the database", err)
} else if err != nil {
- 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 SettingsAuthenticationController
has 213 lines of code (exceeds 25 allowed). Consider refactoring. Open
function SettingsAuthenticationController($q, $scope, $state, Notifications, SettingsService, FileUploadService, TeamService, LDAPService) {
$scope.authMethod = 1;
$scope.state = {
uploadInProgress: false,
Function BackupS3Form
has 211 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function BackupS3Form() {
const limitedToBE = isLimitedToBE(FeatureId.S3_BACKUP_SETTING);
const exportS3Mutate = useExportS3BackupMutation();
File utils.test.ts
has 518 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { ApplicationFormValues } from '../../types';
import { Summary } from './types';
import { getAppResourceSummaries } from './utils';
Function FileUploadFactory
has 205 lines of code (exceeds 25 allowed). Consider refactoring. Open
function FileUploadFactory($q, Upload, EndpointProvider) {
'use strict';
var service = {};
Service
has 57 methods (exceeds 20 allowed). Consider refactoring. Open
type Service struct {
dataStorePath string
fileStorePath string
}
File filesystem.go
has 751 lines of code (exceeds 500 allowed). Consider refactoring. Open
package filesystem
import (
"bytes"
"encoding/pem"
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 {
File __module.js
has 480 lines of code (exceeds 250 allowed). Consider refactoring. Open
import featureFlagModule from '@/react/portainer/feature-flags';
import './rbac';
import componentsModule from './components';
Function StateManagerFactory
has 185 lines of code (exceeds 25 allowed). Consider refactoring. Open
function StateManagerFactory(
$async,
$q,
SystemService,
InfoHelper,
Method Server.Start
has 209 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)
Function config
has 178 lines of code (exceeds 25 allowed). Consider refactoring. Open
.config(function config($stateRegistryProvider) {
const edge = {
name: 'edge',
url: '/edge',
parent: 'root',
Method Handler.updateEdgeSchedule
has a Cognitive Complexity of 61 (exceeds 20 allowed). Consider refactoring. Open
func (handler *Handler) updateEdgeSchedule(tx dataservices.DataStoreTx, edgeJob *portainer.EdgeJob, payload *edgeJobUpdatePayload) error {
if payload.Name != nil {
edgeJob.Name = *payload.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 ServiceHelperFactory
has 174 lines of code (exceeds 25 allowed). Consider refactoring. Open
function ServiceHelperFactory() {
'use strict';
var helper = {};
Function CreateContainerInstanceForm
has 174 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function CreateContainerInstanceForm() {
const environmentId = useEnvironmentId();
const { isPureAdmin } = useCurrentUser();
const { providers, subscriptions, resourceGroups, isLoading } =
Function ConsoleView
has 169 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function ConsoleView() {
const {
params: {
endpointId: environmentId,
container,
Function buildServer
has 186 lines of code (exceeds 50 allowed). Consider refactoring. Open
func buildServer(flags *portainer.CLIFlags) portainer.Server {
shutdownCtx, shutdownTrigger := context.WithCancel(context.Background())
if flags.FeatureFlags != nil {
featureflags.Parse(*flags.FeatureFlags, portainer.SupportedFeatureFlags)
Method Handler.edgeGroupUpdate
has a Cognitive Complexity of 57 (exceeds 20 allowed). Consider refactoring. Open
func (handler *Handler) edgeGroupUpdate(w http.ResponseWriter, r *http.Request) *httperror.HandlerError {
edgeGroupID, err := request.RetrieveNumericRouteVariableValue(r, "id")
if err != nil {
return httperror.BadRequest("Invalid Edge group identifier route variable", err)
}
- 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 createEventDetails
has 158 lines of code (exceeds 25 allowed). Consider refactoring. Open
function createEventDetails(event) {
var eventAttr = event.Actor.Attributes;
var details = '';
var action = event.Action;