Showing 1,408 of 1,408 total issues
Function getMaterialsH3DataYearsList
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
private async getMaterialsH3DataYearsList(
year: number,
materialIds?: string[],
): Promise<MaterialsH3DataYears[]> {
const materialsH3DataYears: MaterialsH3DataYears[] = [];
Function geocode
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
async geocode(args: GeocodeArgs): Promise<GeocodeResponseData> {
if (!this.apiKey) {
this.logger.error(
'Google API key missing when attempting to geocode location. Cannot process request.',
);
Function up
has 32 lines of code (exceeds 25 allowed). Consider refactoring. 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 AdminDataPage
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
const AdminDataPage: React.FC = () => {
const { data, isFetched: sourcingLocationsAreFetched } = useSourcingLocations({
fields: 'updatedAt',
'page[number]': 1,
'page[size]': 1,
Function generateNewLocationsForIntervention
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
async generateNewLocationsForIntervention(
dto: CreateScenarioInterventionDto,
newIntervention: ScenarioIntervention,
actualSourcingLocations: SourcingLocation[],
locationData: {
Function populateValuesRecursively
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
private populateValuesRecursively(
entity: ImpactTableRows,
entityMap: Map<string, Map<number, ImpactTableRowsValues>>,
rangeOfYears: number[],
): ImpactTableRowsValues[] {
Function calculateScenarioComparisonQuantiles
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
private async calculateScenarioComparisonQuantiles(
tmpTableName: string,
): Promise<number[]> {
try {
// due to the inner workings of the pg driver and the way it parses different number types
Function postProcessYearIndicatorData
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
private postProcessYearIndicatorData(
entityMap: Map<string, Map<number, ActualVsScenarioImpactTableRowsValues>>,
rangeOfYears: number[],
lastYearWithData: number,
): void {
Function SBTNandTNFDOverview
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
const SBTNandTNFDOverview: React.FC = () => {
return (
<section className="bg-white">
<Wrapper>
<div className="relative md:py-32 py-12 border-t border-black/10">
Function load_csvs_into_tables
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def load_csvs_into_tables(csv_file_list):
conn = psycopg2.connect(
host=os.getenv('API_POSTGRES_HOST'),
port=os.getenv('API_POSTGRES_PORT'),
database=os.getenv('API_POSTGRES_DATABASE'),
- 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 a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. 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();
- 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 useBottomScrollListener
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
function useBottomScrollListener<T extends HTMLDivElement>(
onBottom: () => void,
scrollref?: MutableRefObject<HTMLDivElement | null>,
options?: {
offset?: number;
- 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 ContextualLegendItem
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
const ContextualLegendItem = ({ layer }: ContextualLegendItemProps) => {
const dispatch = useAppDispatch();
const { isFetching: areLayersLoading } = useContextualLayers();
const { isLoading: isLoadingData } = useContextualLayer(layer.id);
- 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 InterventionPhrase
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
const InterventionPhrase: React.FC<InterventionPhraseProps> = ({ intervention, short = false }) => {
const year = useMemo(() => <strong>{intervention.startYear}</strong>, [intervention.startYear]);
const materials = useMemo(
() => <strong>{intervention.replacedMaterials[0].name}</strong>,
- 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 populateValuesRecursively
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private populateValuesRecursively(
entity: ActualVsScenarioImpactTableRows,
entityDataMap: Map<
string,
Map<number, ActualVsScenarioImpactTableRowsValues>
- 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 buildQuery
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
buildQuery(): Query {
if (this.dto?.supplierIds) {
this.queryBuilder.andWhere(
`${EUDRAlertsFields.supplierId} IN (:...supplierIds)`,
{
- 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 postProcessYearIndicatorData
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private postProcessYearIndicatorData(
rangeOfYears: number[],
lastYearWithData: number,
entityMap: Map<string, Map<number, ImpactTableRowsValues>>,
): Map<number, number> {
- 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 a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
validate(addressInput: string, args: ValidationArguments): boolean {
if (
(args.object as SourcingDataExcelValidator).location_type ===
LOCATION_TYPES.UNKNOWN ||
(args.object as SourcingDataExcelValidator).location_type ===
- 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 validateDTOs
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private async validateDTOs(
dtoLists: SourcingDataDTOs,
): Promise<void | Array<ErrorConstructor>> {
const validationErrorArray: {
line: number;
- 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 aggregateFlows
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
function aggregateFlows<F>(flows: F[], flowAccessors: FlowAccessors<F>): AggregateFlow[] {
// Sum up flows with same origin, dest
const byOriginDest = nest<F, AggregateFlow>()
.key(flowAccessors.getFlowOriginId)
.key(flowAccessors.getFlowDestId)
- 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"