Showing 438 of 1,408 total issues
Function MapPage
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const MapPage: NextPageWithLayout = () => {
const scrollRef = useRef<HTMLDivElement>(null);
const [isCollapsed, setIsCollapsed] = useState(false);
const { planetCompareLayer } = useAppSelector((state) => state.eudr);
const {
Function YearsRange
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const YearsRange: React.FC = () => {
const dispatch = useAppDispatch();
const [years, setYears] = useState<number[]>([]);
const { visualizationMode } = useAppSelector(analysisUI);
Function createIndicatorRecordsBySourcingRecords
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async createIndicatorRecordsBySourcingRecords(
sourcingData: {
sourcingRecordId: string;
geoRegionId: string;
materialId: string;
Function addFilters
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
static addFilters<Entity extends ObjectLiteral>(
queryBuilder: SelectQueryBuilder<Entity>,
filters: CommonFiltersDto,
): SelectQueryBuilder<Entity> {
if (filters.materialIds) {
Function _getModel
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
_getModel(gl: WebGLRenderingContext): Record<string, any> {
let positions: number[] = [];
let pixelOffsets: number[] = [];
const { drawOutline, outlineThickness } = this.props;
Function renderLayers
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
Open
renderLayers(): Array<any> {
const layers = [];
if (this.state?.layersData) {
const { layersData, highlightedObject } = this.state;
const { circleAttributes, lineAttributes } = layersData || {};
- 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 baseGetImpactMap
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private async baseGetImpactMap(
baseImpactMap: BaseImpactMap,
): Promise<{ impactMap: H3IndexValueData[]; quantiles: number[] }> {
let baseMapQuery: SelectQueryBuilder<any> = this.baseMapQuery(
baseImpactMap.indicatorId,
Function Testimonials
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const Testimonials: React.FC = () => {
const [slide, setSlide] = useState(0);
return (
<section className="relative py-12 bg-blue-600 md:py-32">
Function Snow
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function Snow() {
const pointsRef = useRef<Points>(null);
const { viewport } = useThree();
Function parseInterventionFormDataToDto
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function parseInterventionFormDataToDto(
interventionFormData: InterventionFormData,
): InterventionDto {
// removing some fields which API doesn't support
delete interventionFormData.cityAddressCoordinates;
File index.tsx
has 270 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import React, { useCallback, useState, useEffect, useMemo } from 'react';
import { FilterIcon } from '@heroicons/react/solid';
import {
offset,
shift,
Function populateValuesRecursively
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private populateValuesRecursively(
entity: ScenarioVsScenarioImpactTableRows,
entityDataMap: Map<
string,
Map<number, ScenarioVsScenarioImpactTableRowsValues>
Function geoCodeLocations
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async geoCodeLocations(
sourcingData: SourcingData[],
): Promise<{ geoCodedSourcingData: SourcingData[]; errors: any[] }> {
this.logger.log(
`Geocoding locations for ${sourcingData.length} sourcing record elements`,
Function OpenScience
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const OpenScience: React.FC = () => {
return (
<section className="relative py-12 space-y-12 bg-blue-600 bg-cover md:space-y-64 md:py-36 overflow-hidden">
<Wrapper>
<div className="grid grid-cols-2">
Function ScenariosComparison
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const ScenariosComparison: FC = () => {
const { query, push } = useRouter();
const { scenarioId, compareScenarioId } = query;
const dispatch = useAppDispatch();
File index.tsx
has 268 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { useCallback, useMemo, useState } from 'react';
import Head from 'next/head';
import { useRouter } from 'next/router';
import { PlusIcon, SortDescendingIcon } from '@heroicons/react/solid';
import Lottie from 'lottie-react';
File eudr.controller.ts
has 268 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import {
Controller,
Get,
Param,
Query,
Function YearsRange
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
Open
const YearsRange: React.FC = () => {
const dispatch = useAppDispatch();
const [years, setYears] = useState<number[]>([]);
const { visualizationMode } = useAppSelector(analysisUI);
- 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 UserDropdown
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const UserDropdown: React.FC = () => {
const { x, y, refs, strategy } = useFloating({
placement: 'top-start',
middleware: [offset({ crossAxis: 20, mainAxis: 10 }), shift()],
});
Function importEudr
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async importEudr(filePath: string, taskId: string): Promise<any> {
this.logger.log(`Starting eudr import process`);
await this.fileService.isFilePresentInFs(filePath);
try {
const parsedEudrData: any = await this.fileService.transformToJson(