Showing 1,516 of 3,440 total issues
Function RegistryServiceFactory
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
function RegistryServiceFactory($q, $async, EndpointService, Registries, ImageHelper, FileUploadService) {
return {
registries,
registry,
encodedCredentials,
- 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
File NonGitStackForm.tsx
has 385 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { Form, Formik, useFormikContext } from 'formik';
import { useState, useEffect } from 'react';
import { array, boolean, number, object, SchemaOf, string } from 'yup';
import { useRouter } from '@uirouter/react';
import _ from 'lodash';
Method Handler.deleteEndpoint
has a Cognitive Complexity of 49 (exceeds 20 allowed). Consider refactoring. Open
func (handler *Handler) deleteEndpoint(tx dataservices.DataStoreTx, endpointID portainer.EndpointID, deleteCluster bool) error {
endpoint, err := tx.Endpoint().Endpoint(portainer.EndpointID(endpointID))
if tx.IsErrObjectNotFound(err) {
return httperror.NotFound("Unable to find an environment 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 LocalStorageFactory
has 126 lines of code (exceeds 25 allowed). Consider refactoring. Open
function LocalStorageFactory(localStorageService) {
return {
storeLoginStateUUID: function (uuid) {
localStorageService.set('LOGIN_STATE_UUID', uuid);
},
Function DashboardView
has 125 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function DashboardView() {
const queryClient = useQueryClient();
const environmentId = useEnvironmentId();
const { data: namespaces, ...namespacesQuery } =
useNamespacesQuery(environmentId);
File applicationService.js
has 374 lines of code (exceeds 250 allowed). Consider refactoring. Open
import _ from 'lodash-es';
import angular from 'angular';
import PortainerError from 'Portainer/error';
import { KubernetesApplicationDeploymentTypes, KubernetesApplicationTypes } from 'Kubernetes/models/application/models/appConstants';
Function AuthenticationFactory
has 122 lines of code (exceeds 25 allowed). Consider refactoring. Open
function AuthenticationFactory($async, $state, Auth, OAuth, LocalStorage, StateManager, EndpointProvider, ThemeManager) {
'use strict';
var user = {};
if (process.env.NODE_ENV === 'development') {
Function CreateForm
has 122 lines of code (exceeds 25 allowed). Consider refactoring. Open
function CreateForm() {
const environmentId = useEnvironmentId();
const router = useRouter();
const isWindows = useIsWindows(environmentId);
const { trackEvent } = useAnalytics();
testDatastore
has 37 methods (exceeds 20 allowed). Consider refactoring. Open
type testDatastore struct {
customTemplate dataservices.CustomTemplateService
edgeGroup dataservices.EdgeGroupService
edgeJob dataservices.EdgeJobService
edgeStack dataservices.EdgeStackService
File index.ts
has 367 lines of code (exceeds 250 allowed). Consider refactoring. Open
import angular from 'angular';
import { r2a } from '@/react-tools/react2angular';
import { IngressClassDatatableAngular } from '@/react/kubernetes/cluster/ingressClass/IngressClassDatatable/IngressClassDatatableAngular';
import { NamespacesSelector } from '@/react/kubernetes/cluster/RegistryAccessView/NamespacesSelector';
Function $onInit
has 119 lines of code (exceeds 25 allowed). Consider refactoring. Open
$onInit() {
return this.$async(async () => {
try {
this.endpoint = await this.EndpointService.endpoint(this.endpoint.Id);
await this.StateManager.updateEndpointState(this.endpoint);
Function isConfigurationFormValid
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
export function isConfigurationFormValid(alreadyExist, isDataValid, formValues) {
const uniqueCheck = !alreadyExist && isDataValid;
let secretWarningMessage = '';
let isFormValid = false;
- 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 getUpdatedApplicationResources
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
export function getUpdatedApplicationResources(oldFormValues, newFormValues) {
const resources = [];
const [oldApp, oldHeadlessService, oldServices, oldService, oldClaims] = KubernetesApplicationConverter.applicationFormValuesToApplication(oldFormValues);
const [newApp, newHeadlessService, newServices, newService, newClaims] = KubernetesApplicationConverter.applicationFormValuesToApplication(newFormValues);
- 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 UserService
has 118 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function UserService($q, Users, TeamService, TeamMembershipService) {
'use strict';
var service = {};
service.users = async function (includeAdministrators, environmentId) {
Method Store.initServices
has 142 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (store *Store) initServices() error {
authorizationsetService, err := role.NewService(store.connection)
if err != nil {
return err
}
Consider simplifying this complex logical expression. Open
if (
(matchExpression.operator === 'Exists' && exists) ||
(matchExpression.operator === 'DoesNotExist' && !exists) ||
(matchExpression.operator === 'In' && isIn) ||
(matchExpression.operator === 'NotIn' && !isIn) ||
File EnvironmentList.tsx
has 358 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { ReactNode, useEffect, useState } from 'react';
import { HardDrive, RefreshCcw } from 'lucide-react';
import _ from 'lodash';
import { useStore } from 'zustand';
Method Handler.updateSettings
has a Cognitive Complexity of 46 (exceeds 20 allowed). Consider refactoring. Open
func (handler *Handler) updateSettings(tx dataservices.DataStoreTx, payload settingsUpdatePayload) (*portainer.Settings, error) {
settings, err := tx.Settings().Settings()
if err != nil {
return nil, httperror.InternalServerError("Unable to retrieve the settings from the database", 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 ServiceHelperFactory
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
function ServiceHelperFactory() {
'use strict';
var helper = {};
- 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 ApplicationDetailsWidget
has 113 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function ApplicationDetailsWidget() {
const stateAndParams = useCurrentStateAndParams();
const {
params: {
namespace,