Vizzuality/landgriffon

View on GitHub

Showing 1,408 of 1,408 total issues

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