NGO-DB/ndb-core

View on GitHub

Showing 128 of 288 total issues

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

  private parseFieldDefinition(
    fieldDef: ConfigFieldRaw,
    entityType: string,
  ): { id: string; schema: EntitySchemaField } {
    const fieldId = fieldDef.id ?? generateIdFromLabel(fieldDef.label);
Severity: Minor
Found in src/app/features/config-setup/config-import-parser.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 getWarningLevel has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  public getWarningLevel(forChildId?: string): WarningLevel {
    let attendancePercentage;
    if (forChildId) {
      attendancePercentage = this.getAttendancePercentage(forChildId);
    } else {
Severity: Minor
Found in src/app/child-dev-project/attendance/model/activity-attendance.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 getValueDescription has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function getValueDescription(value: any, property: string): string {
  if (typeof value === "boolean") {
    return value
      ? property
      : $localize`:Not a certain property|e.g. 'not male':not ${property}`;
Severity: Minor
Found in src/app/features/reporting/report-row.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 getSchemaFieldsForDetailsView has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  static getSchemaFieldsForDetailsView(entity: Entity): FormFieldConfig[] {
    let formFields: string[] = [];
    let isUsingShowFlag = false;

    for (const [key, field] of entity.getSchema()) {
Severity: Minor
Found in src/app/core/form-dialog/form-dialog.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 compareValues has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function compareValues(a, b) {
  if (a === b) {
    return 0;
  } else if (typeof a === "string" && typeof b === "string") {
    return a.localeCompare(b, undefined, { numeric: true });
Severity: Minor
Found in src/app/core/common-components/entities-table/table-sort/table-sort.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 loadParticipants has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  private async loadParticipants() {
    this.children = [];
    this.inactiveParticipants = [];
    for (const childId of this.eventEntity.children) {
      let child: Child;

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

  private logToRemoteMonitoring(message: any, logLevel: LogLevel) {
    if (logLevel === LogLevel.ERROR) {
      if (message instanceof Error) {
        Sentry.captureException(message);
      } else {
Severity: Minor
Found in src/app/core/logging/logging.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 printObjectDifferences has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function printObjectDifferences(name: string, obj1: object, obj2: object) {
  for (const attr in obj1) {
    if (!obj1.hasOwnProperty(attr)) {
      continue;
    }
Severity: Minor
Found in src/app/utils/expect-entity-data.spec.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

Severity
Category
Status
Source
Language