OpenHPS/openhps-core

View on GitHub

Showing 242 of 242 total issues

Function nls has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring.
Open

    protected nls(spheres: Array<Sphere<any>>): AbsolutePosition {
        // Initiailize parameters
        const f = (point: number[]) => this._calculateError(point, spheres);
        const x0 = this._calculateInit(spheres);
        const maxIterations = this.options.maxIterations;
Severity: Minor
Found in src/nodes/processing/MultilaterationNode.ts - About 7 hrs 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

Similar blocks of code found in 2 locations. Consider refactoring.
Open

export class LinearVelocity extends SensorValue<LinearVelocityUnit> {
    @SerializableMember()
    unit!: LinearVelocityUnit;

    constructor(x?: number, y?: number, z?: number, unit = LinearVelocityUnit.METER_PER_SECOND) {
Severity: Major
Found in src/data/values/LinearVelocity.ts and 1 other location - About 7 hrs to fix
src/data/values/AngularVelocity.ts on lines 10..25

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 182.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

export class AngularVelocity extends SensorValue<AngularVelocityUnit> {
    @SerializableMember()
    unit!: AngularVelocityUnit;

    constructor(x?: number, y?: number, z?: number, unit = AngularVelocityUnit.RADIAN_PER_SECOND) {
Severity: Major
Found in src/data/values/AngularVelocity.ts and 1 other location - About 7 hrs to fix
src/data/values/LinearVelocity.ts on lines 9..24

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 182.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

    fromVector(vector: Vector3, unit?: LengthUnit): this {
        if (unit) {
            this.x = unit.convert(vector.x, this.unit);
            this.y = unit.convert(vector.y, this.unit);
            this.z = unit.convert(vector.z ?? 0, this.unit);
Severity: Major
Found in src/data/position/Absolute3DPosition.ts and 1 other location - About 7 hrs to fix
src/data/position/Relative3DPosition.ts on lines 33..44

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 177.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

    fromVector(vector: Vector3, unit?: LengthUnit): this {
        if (unit) {
            this.x = unit.convert(vector.x, this.unit);
            this.y = unit.convert(vector.y, this.unit);
            this.z = unit.convert(vector.z ?? 0, this.unit);
Severity: Major
Found in src/data/position/Relative3DPosition.ts and 1 other location - About 7 hrs to fix
src/data/position/Absolute3DPosition.ts on lines 34..45

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 177.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

File Deserializer.ts has 454 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { Deserializer as JSONDeserializer } from 'typedjson/lib/cjs/deserializer';
import type { TypeDescriptor } from 'typedjson/lib/types/type-descriptor';
import {
    ensureTypeDescriptor,
    ConcreteTypeDescriptor,
Severity: Minor
Found in src/data/Deserializer.ts - About 6 hrs to fix

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

        protected errorHandler: (error: Error) => void = (e: Error) => {
            e.message = e.message.replace('@jsonObject', '@SerializableObject()');
            e.message = e.message.replace('@jsonMember', '@SerializableMember()');
            e.message = e.message.replace('@jsonSetMember', '@SerializableSetMember()');
            e.message = e.message.replace('@jsonMapMember', '@SerializableMapMember()');
    Severity: Major
    Found in src/data/Serializer.ts and 1 other location - About 6 hrs to fix
    src/data/Deserializer.ts on lines 20..27

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 156.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

        protected errorHandler: (error: Error) => void = (e: Error) => {
            e.message = e.message.replace('@jsonObject', '@SerializableObject()');
            e.message = e.message.replace('@jsonMember', '@SerializableMember()');
            e.message = e.message.replace('@jsonSetMember', '@SerializableSetMember()');
            e.message = e.message.replace('@jsonMapMember', '@SerializableMapMember()');
    Severity: Major
    Found in src/data/Deserializer.ts and 1 other location - About 6 hrs to fix
    src/data/Serializer.ts on lines 21..28

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 156.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

        fromVector(vector: Vector2 | Vector3, unit?: LengthUnit): this {
            if (unit) {
                this.x = unit.convert(vector.x, this.unit);
                this.y = unit.convert(vector.y, this.unit);
            } else {
    Severity: Major
    Found in src/data/position/Relative2DPosition.ts and 1 other location - About 4 hrs to fix
    src/data/position/Absolute2DPosition.ts on lines 65..74

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 131.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

        fromVector(vector: Vector2 | Vector3, unit?: LengthUnit): this {
            if (unit) {
                this.x = unit.convert(vector.x, this.unit);
                this.y = unit.convert(vector.y, this.unit);
            } else {
    Severity: Major
    Found in src/data/position/Absolute2DPosition.ts and 1 other location - About 4 hrs to fix
    src/data/position/Relative2DPosition.ts on lines 52..61

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 131.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Function convertAsObject has 118 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        convertAsObject<T>(
            sourceObject: IndexedObject,
            typeDescriptor: ConcreteTypeDescriptor,
            knownTypes: Map<string, Serializable<any>>,
            memberName: string,
    Severity: Major
    Found in src/data/Deserializer.ts - About 4 hrs to fix

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      export class RelativeLinearVelocity extends RelativePosition<LinearVelocity, LinearVelocityUnit> {
          @SerializableMember()
          referenceValue: LinearVelocity;
      
          constructor(referenceObject?: any, velocity?: LinearVelocity) {
      Severity: Major
      Found in src/data/position/RelativeLinearVelocity.ts and 1 other location - About 4 hrs to fix
      src/data/position/RelativeAngularVelocity.ts on lines 11..26

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 125.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      export class RelativeAngularVelocity extends RelativePosition<AngularVelocity, AngularVelocityUnit> {
          @SerializableMember()
          referenceValue: AngularVelocity;
      
          constructor(referenceObject?: any, velocity?: AngularVelocity) {
      Severity: Major
      Found in src/data/position/RelativeAngularVelocity.ts and 1 other location - About 4 hrs to fix
      src/data/position/RelativeLinearVelocity.ts on lines 11..26

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 125.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Function nls has 102 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected nls(spheres: Array<Sphere<any>>): AbsolutePosition {
              // Initiailize parameters
              const f = (point: number[]) => this._calculateError(point, spheres);
              const x0 = this._calculateInit(spheres);
              const maxIterations = this.options.maxIterations;
      Severity: Major
      Found in src/nodes/processing/MultilaterationNode.ts - About 4 hrs to fix

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

            toVector3(unit?: LengthUnit): Vector3 {
                if (unit) {
                    return new Vector3(
                        this.unit.convert(this.x, unit),
                        this.unit.convert(this.y, unit),
        Severity: Major
        Found in src/data/position/Absolute3DPosition.ts and 1 other location - About 4 hrs to fix
        src/data/position/Relative3DPosition.ts on lines 46..56

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 115.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

            toVector3(unit?: LengthUnit): Vector3 {
                if (unit) {
                    return new Vector3(
                        this.unit.convert(this.x, unit),
                        this.unit.convert(this.y, unit),
        Severity: Major
        Found in src/data/position/Relative3DPosition.ts and 1 other location - About 4 hrs to fix
        src/data/position/Absolute3DPosition.ts on lines 47..57

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 115.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Function convertAsObject has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
        Open

            convertAsObject<T>(
                sourceObject: IndexedObject,
                typeDescriptor: ConcreteTypeDescriptor,
                knownTypes: Map<string, Serializable<any>>,
                memberName: string,
        Severity: Minor
        Found in src/data/Deserializer.ts - About 3 hrs 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

        File MultilaterationNode.ts has 322 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import { AbsolutePosition, Accuracy1D, DataObject, GeographicalPosition, RelativeDistance } from '../../data';
        import { DataFrame } from '../../data/DataFrame';
        import { AngleUnit } from '../../utils';
        import { Vector3 } from '../../utils/math';
        import { ObjectProcessingNodeOptions } from '../ObjectProcessingNode';
        Severity: Minor
        Found in src/nodes/processing/MultilaterationNode.ts - About 3 hrs to fix

          File Serializer.ts has 315 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import { Serializer as JSONSerializer } from 'typedjson/lib/cjs/serializer';
          import type { ConcreteTypeDescriptor, TypeDescriptor } from 'typedjson/lib/types/type-descriptor';
          import {
              ensureTypeDescriptor,
              ArrayTypeDescriptor,
          Severity: Minor
          Found in src/data/Serializer.ts - About 3 hrs to fix

            Function convertAsMap has 87 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                convertAsMap(
                    sourceObject: any,
                    typeDescriptor: MapTypeDescriptor,
                    knownTypes: Map<string, Serializable<any>>,
                    memberName: string,
            Severity: Major
            Found in src/data/Deserializer.ts - About 3 hrs to fix
              Severity
              Category
              Status
              Source
              Language