Showing 438 of 1,408 total issues
Function AdminDataPage
has 205 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const AdminDataPage: React.FC = () => {
const { push, query } = useRouter();
const [sorting, setSorting] = useState<SortingState>([]);
const { data: session } = useSession();
const { data: task } = useLasTask();
File index.tsx
has 506 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { useCallback, useEffect, useMemo, useState } from 'react';
import { DownloadIcon, InformationCircleIcon } from '@heroicons/react/outline';
import { uniq, omit } from 'lodash-es';
import toast from 'react-hot-toast';
import { ArrowLeftIcon } from '@heroicons/react/solid';
Function InnerTreeSelect
has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring. Open
Open
const InnerTreeSelect = <IsMulti extends boolean>(
{
current: currentRaw,
loading,
maxBadges = 5,
- 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 UpdateScenarioPage
has 198 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const UpdateScenarioPage: React.FC = () => {
const { query } = useRouter();
const queryClient = useQueryClient();
const { data, isLoading } = useScenario(query?.scenarioId as string, { include: 'user' });
const updateScenario = useUpdateScenario();
Function ScenariosAdminPage
has 195 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const ScenariosAdminPage: React.FC = () => {
const router = useRouter();
const { query } = router;
const [scenatioToDelete, setScenatioToDelete] = useState<string>(null);
Function AnalysisTable
has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring. Open
Open
const AnalysisTable = () => {
const searchParams = useSearchParams();
const isComparisonEnabled = Boolean(searchParams.get('compareScenarioId'));
const [paginationState, setPaginationState] = useState<PaginationState>({
- 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 DeforestationAlertsChart
has 187 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const DeforestationAlertsChart = (): JSX.Element => {
const [selectedPlots, setSelectedPlots] = useState<string[]>([]);
const [selectedDate, setSelectedDate] = useState<number>(null);
const ticks = useRef<number[]>([]);
const { supplierId }: { supplierId: string } = useParams();
Function saveNewIntervention
has 180 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async saveNewIntervention(
newIntervention: ScenarioIntervention,
): Promise<any> {
const queryRunner: QueryRunner = this.dataSource.createQueryRunner();
await queryRunner.connect();
Function EUDRCompliance
has 179 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const EUDRCompliance: React.FC = () => {
return (
<section className="relative bg-white">
<Wrapper>
<div className="relative border-t border-black/10 md:py-32 py-12">
Function Step03
has 174 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const Step03: React.FC = () => {
return (
<article
className={cx({
'flex flex-col lg:flex-row-reverse justify-between space-y-10 lg:space-x-10 lg:space-x-reverse lg:space-y-0':
Function buildDashboardDetail
has 173 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async buildDashboardDetail(
supplierId: string,
dto?: GetEUDRAlertDatesDto,
): Promise<EUDRDashBoardDetail> {
const result: any = {};
File colors.ts
has 453 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import {
interpolateCool,
interpolateInferno,
interpolateMagma,
interpolatePlasma,
Function SuppliersStackedBar
has 167 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const SuppliersStackedBar = () => {
const {
viewBy,
totalSuppliers,
filters: { dates, suppliers, origins, materials },
File scenario-vs-scenario.service.ts
has 438 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { Injectable, Logger } from '@nestjs/common';
import {
GetActualVsScenarioImpactTableDto,
GetScenarioVsScenarioImpactTableDto,
GROUP_BY_VALUES,
Function Rason
has 160 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const Rason: React.FC = () => {
return (
<section className="relative py-12 space-y-12 bg-blue-600 bg-cover md:space-y-64 md:py-64">
<Wrapper>
<div className="space-y-10 text-white md:space-y-20">
Function up
has 158 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`CREATE OR REPLACE FUNCTION sum_h3_weighted_cropland_area(
geo_region_id uuid,
material_id uuid,
h3_data_type material_to_h3_type_enum
Function MethodologyForm
has 152 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const MethodologyForm: React.FC = () => {
const [submitting, setSubmitting] = useState(false);
const { register, handleSubmit, formState } = useForm({
resolver: yupResolver(schema),
Function Developed
has 151 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const Developed: React.FC = () => {
return (
<section className="relative py-32 bg-white bg-cover">
<Wrapper>
<div className="space-y-10 md:space-y-20">
Function Legend
has 150 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const Legend: React.FC = () => {
const [showLegend, setShowLegend] = useState<boolean>(true);
const [showSettings, setShowSettings] = useState<boolean>(false);
const dispatch = useAppDispatch();
File component.tsx
has 414 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import React, { useCallback, useState, useMemo, useEffect } from 'react';
import { FilterIcon } from '@heroicons/react/solid';
import {
offset,
shift,