Showing 438 of 1,408 total issues
Function EUDRTool
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
const EUDRTool: React.FC = () => {
return (
<section className="relative bg-blue-600 bg-cover md:space-y-64">
<Wrapper>
<div className="space-y-12 text-white md:space-y-20 md:py-32 py-12">
Function Hero
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
const Hero: React.FC = () => {
return (
<section className="relative overflow-hidden bg-white">
<Wrapper>
<motion.div
File intervention-creation.cy.ts
has 264 lines of code (exceeds 250 allowed). Consider refactoring. Open
beforeEach(() => {
cy.interceptAllRequests();
cy.intercept('GET', '/api/v1/indicators?filter[status]=active&include=unit&sort=name', {
fixture: 'indicators/withUnits',
H3DataRepository
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
@Injectable()
export class H3DataRepository extends Repository<H3Data> {
constructor(private dataSource: DataSource) {
super(H3Data, dataSource.createEntityManager());
}
Function createScenarioIntervention
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
async createScenarioIntervention(
dto: CreateScenarioInterventionDto,
): Promise<Partial<ScenarioIntervention>> {
// Validate new location. If it's validated, get the geolocated info. If not, throw an exception
Function Header
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
const Header: React.FC = () => {
const [open, setOpen] = useState(false);
const { scrollDirection } = useScrollDirection();
const prevDirection = useRef<string | number>(0);
Function ScienceBasedTargets
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
const ScienceBasedTargets: React.FC = () => {
return (
<section className="relative space-y-12 bg-blue-600 md:py-8 overflow-hidden">
<Wrapper>
<div className="space-y-10 text-white md:space-y-20 md:py-32 py-12">
Function UploadTracker
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const UploadTracker: FC = () => {
const queryClient = useQueryClient();
const [isSettingUp, setIsSettingUp] = useState(true);
const [tasksProgress, setTaskProgress] = useState<ProgressTask['data'] | undefined>(undefined);
Function SuppliersListTable
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
const SuppliersListTable = (): JSX.Element => {
const dispatch = useAppDispatch();
// const [rowSelection, setRowSelection] = useState({});
// const [columnVisibility, setColumnVisibility] = useState<VisibilityState>({});
// const [columnFilters, setColumnFilters] = useState<ColumnFiltersState>([]);
- 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 clusterLocations
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
export function clusterLocations<L>(
locations: L[],
locationAccessors: LocationAccessors<L>,
getLocationWeight: LocationWeightGetter,
options?: Partial<Options>,
- 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 calcLocationTotalsExtent
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
function calcLocationTotalsExtent(
locationTotals: Map<string, LocationTotals> | undefined,
locationIdsInViewport: Set<string> | undefined,
) {
if (!locationTotals) return undefined;
- 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 component.tsx
has 260 lines of code (exceeds 250 allowed). Consider refactoring. Open
import React, { cloneElement, useCallback, useEffect, useMemo, useRef, useState } from 'react';
import classnames from 'classnames';
import { Transition, Combobox } from '@headlessui/react';
import { ChevronUpIcon, ChevronDownIcon, XIcon } from '@heroicons/react/solid';
import { flip, useFloating, size, autoUpdate, offset } from '@floating-ui/react-dom';
Function populateValuesRecursively
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
private populateValuesRecursively(
entity: ActualVsScenarioImpactTableRows,
entityDataMap: Map<
string,
Map<number, ActualVsScenarioImpactTableRowsValues>
Function EUDRModal
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const EUDRModal: React.FC = () => {
const [isOpen, setIsOpen] = useState(false);
const { start, stop } = useTimeout(() => {
setIsOpen(true);
Function Contact
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
const Contact = (req: NextApiRequest, res: NextApiResponse): void => {
if (req.method === 'POST') {
const { name, email, message, company, topic, newsletter } = req.body;
// Saving contacts and emails in Sendgrid
File 1645259040554-ImpactStoredFunctions.ts
has 257 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { MigrationInterface, QueryRunner } from 'typeorm';
export class ImpactStoredFunctions1645259040554 implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`
Function handleSearchSelection
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
(newKey: Key) => {
resetSearch();
const selectedNode = flatTreeData.find((data) => data.key === newKey);
setKeyToScroll(newKey);
Function Video
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
const Video: FC = () => {
const videoRef = useRef<HTMLVideoElement>();
const { ref, inView } = useInView();
const onVideoEnded = useCallback(() => {
Function ContactUs
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
const ContactUs: FC = () => {
return (
<section className="bg-orange-500 xl:bg-white">
<Wrapper>
<div className="relative z-10 pt-12 bg-orange-500 md:pt-20 xl:-mt-10 xl:px-20 xl:-mx-20">
Function DatesRange
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
const DatesRange = (): JSX.Element => {
const dispatch = useAppDispatch();
const {
filters: { dates },
} = useAppSelector(eudrDetail);