Showing 1,497 of 3,384 total issues
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;
Function ContainerHelperFactory
has 157 lines of code (exceeds 25 allowed). Consider refactoring. Open
function ContainerHelperFactory() {
'use strict';
var helper = {};
helper.configFromContainer = function (container) {
Function ItemView
has 157 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function ItemView() {
const {
params: { id },
} = useCurrentStateAndParams();
const { subscriptionId, resourceGroupId, containerGroupId } = parseId(id);
Method Handler.registryUpdate
has a Cognitive Complexity of 56 (exceeds 20 allowed). Consider refactoring. Open
func (handler *Handler) registryUpdate(w http.ResponseWriter, r *http.Request) *httperror.HandlerError {
securityContext, err := security.RetrieveRestrictedRequestContext(r)
if err != nil {
return httperror.InternalServerError("Unable to retrieve info from request context", 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
File stackController.js
has 426 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { ResourceControlType } from '@/react/portainer/access-control/types';
import { AccessControlFormData } from 'Portainer/components/accessControlForm/porAccessControlFormModel';
import { FeatureId } from '@/react/portainer/feature-flags/enums';
import { getEnvironments } from '@/react/portainer/environments/environment.service';
import { StackStatus, StackType } from '@/react/common/stacks/types';
Method Store.Export
has 178 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (store *Store) Export(filename string) (err error) {
backup := storeExport{}
if c, err := store.CustomTemplate().ReadAll(); err != nil {
Function snapshotContainers
has a Cognitive Complexity of 55 (exceeds 20 allowed). Consider refactoring. Open
func snapshotContainers(snapshot *portainer.DockerSnapshot, cli *client.Client) error {
containers, err := cli.ContainerList(context.Background(), container.ListOptions{All: true})
if err != nil {
return 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 StackServiceFactory
has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring. Open
function StackServiceFactory($q, $async, Stack, StackByName, FileUploadService, StackHelper, ServiceService, ContainerService, SwarmService) {
'use strict';
var service = {
updateGit,
updateKubeGit,
- 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 validate
has 151 lines of code (exceeds 25 allowed). Consider refactoring. Open
(
ingressRule: Rule,
ingressNames: string[],
groupedServiceOptions: GroupedServiceOptions,
existingIngressClass?: IngressController
File stackService.js
has 417 lines of code (exceeds 250 allowed). Consider refactoring. Open
import _ from 'lodash-es';
import { transformAutoUpdateViewModel } from '@/react/portainer/gitops/AutoUpdateFieldset/utils';
import { StackViewModel } from '@/react/docker/stacks/view-models/stack';
angular.module('portainer.app').factory('StackService', [
Function applicationCommon
has 149 lines of code (exceeds 25 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;
File ConfigureForm.tsx
has 413 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { Formik, Form, FormikProps, FormikHelpers } from 'formik';
import { useCallback, useEffect, useMemo } from 'react';
import _ from 'lodash';
import { useTransitionHook } from '@uirouter/react';
Function RegistryServiceFactory
has 146 lines of code (exceeds 25 allowed). Consider refactoring. Open
function RegistryServiceFactory($q, $async, EndpointService, Registries, ImageHelper, FileUploadService) {
return {
registries,
registry,
encodedCredentials,
Function ImageServiceFactory
has 141 lines of code (exceeds 25 allowed). Consider refactoring. Open
function ImageServiceFactory($q, Image, ImageHelper, RegistryService, HttpRequestHelper, ContainerService, FileUploadService) {
'use strict';
var service = {};
service.image = function (imageId) {
Function ContainerServiceFactory
has 139 lines of code (exceeds 25 allowed). Consider refactoring. Open
function ContainerServiceFactory($q, Container, $timeout) {
const service = {
killContainer,
pauseContainer,
renameContainer,
KubernetesNodeController
has 41 functions (exceeds 20 allowed). Consider refactoring. Open
class KubernetesNodeController {
/* @ngInject */
constructor(
$async,
$state,
Function EndpointServiceFactory
has 136 lines of code (exceeds 25 allowed). Consider refactoring. Open
function EndpointServiceFactory($q, Endpoints, FileUploadService) {
'use strict';
var service = {
updateSecuritySettings,
registries,
Function ItemView
has 136 lines of code (exceeds 25 allowed). Consider refactoring. Open
function ItemView() {
const {
params: { id: idParam },
} = useCurrentStateAndParams();
File InputList.tsx
has 391 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { ComponentType, useRef } from 'react';
import { FormikErrors } from 'formik';
import { ArrowDown, ArrowUp, Plus, RotateCw, Trash2 } from 'lucide-react';
import clsx from 'clsx';
Function BuildImageController
has 134 lines of code (exceeds 25 allowed). Consider refactoring. Open
function BuildImageController($scope, $async, $window, BuildService, Notifications, HttpRequestHelper, endpoint) {
$scope.endpoint = endpoint;
$scope.options = [editor, upload, url];
$scope.state = {