Vizzuality/landgriffon

View on GitHub

Showing 438 of 1,408 total issues

Function AdminDataPage has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const AdminDataPage: React.FC = () => {
  const { data, isFetched: sourcingLocationsAreFetched } = useSourcingLocations({
    fields: 'updatedAt',
    'page[number]': 1,
    'page[size]': 1,
Severity: Minor
Found in client/src/pages/data/index.tsx - About 25 mins to fix

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 getAdminRegionDescendants has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  async getAdminRegionDescendants(
    adminRegionIds: string[],
    options?: { fullEntities?: boolean; treeResponse?: boolean },
  ): Promise<any> {
    // using type casting not to search for and r
Severity: Minor
Found in api/src/modules/admin-regions/admin-regions.service.ts - About 25 mins to fix

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 getContextualLayerH3 has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  async getContextualLayerH3(
    contextualLayerId: string,
    resolution?: number,
    year?: number,
  ): Promise<{
Severity: Minor
Found in api/src/modules/contextual-layers/contextual-layers.service.ts - About 25 mins to fix

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 addEntityFiltersToQuery has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  private addEntityFiltersToQuery(
    selectQueryBuilder: SelectQueryBuilder<SourcingRecord>,
    impactDataDto: GetActualVsScenarioImpactTableDto | GetImpactTableDto,
  ): SelectQueryBuilder<SourcingRecord> {
    if (impactDataDto.materialIds) {
Severity: Minor
Found in api/src/modules/impact/impact.repository.ts - About 25 mins to fix

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 geoCodeSourcingLocation has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  async geoCodeSourcingLocation(
    locationInfo: locationInfo,
  ): Promise<SourcingLocation> {
    let geoCodedSourcingLocation: Partial<SourcingData> = {};
    if (locationInfo.locationType === LOCATION_TYPES.UNKNOWN) {
Severity: Minor
Found in api/src/modules/geo-coding/geo-coding.service.ts - About 25 mins to fix

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 getDataForImpactTable has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  getDataForImpactTable(
    impactTableDto: AnyImpactTableDto,
    entities: ImpactTableEntityType[],
  ): Promise<ImpactTableData[]> {
    if (entities.length) {
Severity: Minor
Found in api/src/modules/impact/base-impact.service.ts - About 25 mins to fix

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 addOrganisationalEntityFilters has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  private addOrganisationalEntityFilters(
    baseImpactMapFilters: BaseImpactMapFiltersType,
    queryBuilder: { subQueryBuilder: SelectQueryBuilder<any> },
  ): SelectQueryBuilder<any> {
    const {
Severity: Minor
Found in api/src/modules/h3-data/h3-data.repository.ts - About 25 mins to fix

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 6 (exceeds 5 allowed). Consider refactoring.
Open

  private populateValuesRecursively(
    entity: ImpactTableRows,
    entityMap: Map<string, Map<number, ImpactTableRowsValues>>,
    rangeOfYears: number[],
  ): ImpactTableRowsValues[] {
Severity: Minor
Found in api/src/modules/impact/impact.service.ts - About 25 mins to fix

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 createIndicatorRecordsBySourcingRecords has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  async createIndicatorRecordsBySourcingRecords(
    sourcingData: {
      sourcingRecordId: string;
      geoRegionId: string;
      materialId: string;
Severity: Minor
Found in api/src/modules/indicator-records/services/impact-calculator.service.ts - About 25 mins to fix

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 defaultMessage has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  defaultMessage(args: ValidationArguments): string {
    if (
      (args.object as SourcingDataExcelValidator).location_type ===
        LOCATION_TYPES.UNKNOWN ||
      (args.object as SourcingDataExcelValidator).location_type ===

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 getFlowAndCircleColors has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function getFlowAndCircleColors(
  inputColors: FlowAndCircleColors | undefined,
  defaultFlowColorScheme: string[],
  darkMode: boolean,
): FlowAndCircleColorsRGBA {
Severity: Minor
Found in cookie-traceability/src/lib/flowmap/data/colors.ts - About 25 mins to fix

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 calculateIndicatorValues has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  private calculateIndicatorValues(
    rawData: SourcingRecordsWithIndicatorRawData,
    tonnage: number,
  ): Map<INDICATOR_NAME_CODES, number> {
    const map: Map<INDICATOR_NAME_CODES, number> = new Map();
Severity: Minor
Found in api/src/modules/indicator-records/services/impact-calculator.service.ts - About 25 mins to fix

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 updateState has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  updateState({ oldProps, props, changeFlags }: Record<string, any>): void {
    const { dataProvider, highlightedObject } = this.state || {};
    if (!dataProvider) {
      return;
    }
Severity: Minor
Found in cookie-traceability/src/lib/flowmap/layers/FlowMapLayer.ts - About 25 mins to fix

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 Alerts has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const Alerts: React.FC<AlertsProps> = ({ className, items }: AlertsProps) => {
  if (!items) return null;
  if (Array.isArray(items) && !items.length) return null;

  const alerts = Array.isArray(items) ? items : [items];
Severity: Minor
Found in marketing/src/components/alerts/component.tsx - About 25 mins to fix

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 getLocationAreaColorsRGBA has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function getLocationAreaColorsRGBA(
  colors: LocationAreaColors | undefined,
  darkMode: boolean,
): LocationAreaColorsRGBA {
  const normalColor = (colors && colors.normal) || DEFAULT_LOCATION_AREA_COLOR;
Severity: Minor
Found in cookie-traceability/src/lib/flowmap/data/colors.ts - About 25 mins to fix

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 buildQueryForImport has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  buildQueryForImport(nameCodes: INDICATOR_NAME_CODES[]): {
    params: string;
    query: string;
  } {
    const importQueryFields: string[] = [

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 getTimeGranularityForDate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export function getTimeGranularityForDate(date: Date): TimeGranularity {
  let prev = undefined;
  for (const current of TIME_GRANULARITIES) {
    const { interval } = current;
    const floored = interval(date);
Severity: Minor
Found in cookie-traceability/src/lib/flowmap/data/time.ts - About 25 mins to fix

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 6 (exceeds 5 allowed). Consider refactoring.
Open

  async validate(sheet: SourcingDataSheet): Promise<any> {
    const progressTracker: ValidationProgressTracker =
      this.getProgressTracker(sheet);
    const validationErrors: ImportTaskError[] = [];

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

Severity
Category
Status
Source
Language