Showing 438 of 1,408 total issues
Function save
has 82 lines of code (exceeds 25 allowed). Consider refactoring. Open
async save(
importData: EudrInputShape[],
sourcingLocationGroupId?: string,
): Promise<{
sourcingLocations: SourcingLocation[];
File component.tsx
has 303 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { useCallback, useEffect, useMemo } from 'react';
import Image from 'next/image';
import { format } from 'date-fns';
import LayersData from '../layers.json';
Function saveNewIntervention
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
async saveNewIntervention(
newIntervention: ScenarioIntervention,
): Promise<any> {
const queryRunner: QueryRunner = this.dataSource.createQueryRunner();
await queryRunner.connect();
- 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 UserDataForm
has 80 lines of code (exceeds 25 allowed). Consider refactoring. Open
const UserDataForm: React.FC = () => {
const {
register,
handleSubmit,
formState: { errors },
File impact.repository.ts
has 300 lines of code (exceeds 250 allowed). Consider refactoring. Open
import {
Brackets,
EntityManager,
SelectQueryBuilder,
WhereExpressionBuilder,
File dto-processor.service.ts
has 298 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { Injectable, Logger } from '@nestjs/common';
import { CreateMaterialDto } from 'modules/materials/dto/create.material.dto';
import { CreateBusinessUnitDto } from 'modules/business-units/dto/create.business-unit.dto';
import { CreateSupplierDto } from 'modules/suppliers/dto/create.supplier.dto';
import { CreateAdminRegionDto } from 'modules/admin-regions/dto/create.admin-region.dto';
Function UserPasswordForm
has 78 lines of code (exceeds 25 allowed). Consider refactoring. Open
const UserPasswordForm: React.FC = () => {
const {
register: registerPassword,
handleSubmit: handleSubmitPassword,
formState: { errors },
Function InterventionForm
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
const InterventionForm: React.FC<InterventionFormProps> = ({
intervention,
isSubmitting,
onSubmit,
}) => {
- 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 Map
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
const Map: React.FC<MapProps> = ({ ingredientId, currentTradeFlow }) => {
const queryClient = useQueryClient();
const [hoverInfo, setHoverInfo] = useState<any>(null);
const { x, y, reference, floating, strategy } = useFloating({
middleware: [flip(), offset(10)],
- 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 save
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
async save(
importData: EudrInputShape[],
sourcingLocationGroupId?: string,
): Promise<{
sourcingLocations: SourcingLocation[];
- 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 Features
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
const Features: React.FC = () => {
return (
<section className="relative py-12 bg-white md:py-32">
<Wrapper>
<div className="space-y-10 md:space-y-20">
Function buildMaps
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
buildMaps(): void {
this.soucingData.forEach((entity: Entities) => {
const {
supplierId,
materialId,
Function DataProviders
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
const DataProviders: FC = () => {
const [slide, setSlide] = useState(0);
return (
<section className="bg-white py-12 space-y-1 bg-cover md:space-y-64 md:py-36">
<Wrapper>
File component.tsx
has 293 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { useState, useCallback, useEffect, useMemo } from 'react';
import DeckGL from '@deck.gl/react/typed';
import { GeoJsonLayer } from '@deck.gl/layers/typed';
import Map, { Source, Layer } from 'react-map-gl/maplibre';
import { WebMercatorViewport } from '@deck.gl/core/typed';
File component.tsx
has 289 lines of code (exceeds 250 allowed). Consider refactoring. Open
import React, { useEffect, useMemo, useState } from 'react';
import { useQueryClient, useQueries } from '@tanstack/react-query';
import Flag from 'react-country-flag';
import axios from 'axios';
import DeckGL from '@deck.gl/react/typed';
Function clusterLocations
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function clusterLocations<L>(
locations: L[],
locationAccessors: LocationAccessors<L>,
getLocationWeight: LocationWeightGetter,
options?: Partial<Options>,
Function Step02
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
const Step02: React.FC = () => {
return (
<article
className={cx({
'flex flex-col lg:flex-row justify-between space-y-10 lg:space-x-10 lg:space-y-0': true,
Function Home
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
const Home: React.FC = () => {
const mainElement = useRef<HTMLDivElement>(null);
const [currentTradeFlow, setCurrentTradeFlow] = useState<CountryTrade | null>(null);
const [ingredient, setIngredient] = useState<string>(INGREDIENTS[0].id);
Function Methodology
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
const Methodology = (req: NextApiRequest, res: NextApiResponse): void => {
if (req.method === 'POST') {
const { name, email, newsletter } = req.body;
// Send a message to the user with Methodology link
File scenario-interventions.service.ts
has 285 lines of code (exceeds 250 allowed). Consider refactoring. Open
import {
BadRequestException,
Injectable,
NotFoundException,
} from '@nestjs/common';