OpenHPS/openhps-core

View on GitHub

Showing 247 of 247 total issues

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

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

          constructor() {
              super();
              this.setSerializationStrategy(Map, this.convertAsMap.bind(this));
              this.setSerializationStrategy(Array, this.convertAsArray.bind(this));
              this.setSerializationStrategy(Set, this.convertAsSet.bind(this));
      Severity: Major
      Found in src/data/Serializer.ts and 1 other location - About 3 hrs to fix
      src/data/Deserializer.ts on lines 50..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 102.

      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

          constructor() {
              super();
              this.setDeserializationStrategy(Map, this.convertAsMap.bind(this));
              this.setDeserializationStrategy(Array, this.convertAsArray.bind(this));
              this.setDeserializationStrategy(Set, this.convertAsSet.bind(this));
      Severity: Major
      Found in src/data/Deserializer.ts and 1 other location - About 3 hrs to fix
      src/data/Serializer.ts on lines 39..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 102.

      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 processRelativePositions has 78 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          processRelativePositions<P extends AbsolutePosition>(
              dataObject: DataObject,
              relativePositions: Map<RelativeDistance, DataObject>,
              dataFrame: DataFrame,
          ): Promise<DataObject> {
      Severity: Major
      Found in src/nodes/processing/MultilaterationNode.ts - About 3 hrs to fix

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

        export function SerializableSetMember<T>(
            elementConstructor: Constructor<T>,
            options?: SerializableSetMemberOptions,
        ): PropertyDecorator {
            return (target: unknown, propertyKey: string) => {
        Severity: Major
        Found in src/data/decorators/SerializableSetMember.ts and 1 other location - About 3 hrs to fix
        src/data/decorators/SerializableArrayMember.ts on lines 14..23

        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 96.

        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 function SerializableArrayMember<T>(
            elementConstructor: Serializable<T>,
            options?: SerializableArrayMemberOptions,
        ): PropertyDecorator {
            return (target: unknown, propertyKey: string) => {
        Severity: Major
        Found in src/data/decorators/SerializableArrayMember.ts and 1 other location - About 3 hrs to fix
        src/data/decorators/SerializableSetMember.ts on lines 10..19

        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 96.

        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 init has 76 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            init(config: WorkerData): Promise<void> {
                return new Promise(async (resolve, reject) => { // eslint-disable-line
                    this.config = config;
                    const importFn: (file: string) => Promise<any> =
                        typeof process !== 'object'
        Severity: Major
        Found in src/worker/WorkerBase.ts - About 3 hrs to fix

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

              setAccuracy(accuracy: number | Accuracy<LengthUnit, any>, unit?: Unit): this {
                  if (typeof accuracy === 'number') {
                      this.accuracy = new Accuracy1D(accuracy, unit || this.unit);
                  } else {
                      this.accuracy = accuracy;
          Severity: Major
          Found in src/data/position/AbsolutePosition.ts and 1 other location - About 2 hrs to fix
          src/data/position/RelativePosition.ts on lines 101..108

          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 93.

          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

              setAccuracy(accuracy: number | Accuracy<U, any>, unit?: U): this {
                  if (typeof accuracy === 'number') {
                      this.accuracy = new Accuracy1D(accuracy, unit || this._defaultUnit);
                  } else {
                      this.accuracy = accuracy;
          Severity: Major
          Found in src/data/position/RelativePosition.ts and 1 other location - About 2 hrs to fix
          src/data/position/AbsolutePosition.ts on lines 154..161

          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 93.

          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));
                  } else {
                      return new Vector3(this.x, this.y);
          Severity: Major
          Found in src/data/position/Absolute2DPosition.ts and 1 other location - About 2 hrs to fix
          src/data/position/Relative2DPosition.ts on lines 63..69

          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 92.

          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));
                  } else {
                      return new Vector3(this.x, this.y);
          Severity: Major
          Found in src/data/position/Relative2DPosition.ts and 1 other location - About 2 hrs to fix
          src/data/position/Absolute2DPosition.ts on lines 76..82

          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 92.

          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 WorkerHandler.ts has 277 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import { BlobWorker, Pool, spawn, Thread, Worker } from 'threads';
          import { PoolEvent } from 'threads/dist/master/pool';
          import { Observable } from 'threads/observable';
          import { DataFrame } from '../data/DataFrame';
          import { DataSerializer } from '../data/DataSerializer';
          Severity: Minor
          Found in src/worker/WorkerHandler.ts - About 2 hrs to fix

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

                convertAsObject(
                    sourceObject: IndexedObject,
                    typeDescriptor: ConcreteTypeDescriptor,
                    memberName: string,
                    serializer: Serializer,
            Severity: Major
            Found in src/data/Serializer.ts - About 2 hrs to fix

              File Unit.ts has 271 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import 'reflect-metadata';
              import { SerializableObject, SerializableMember } from '../../data/decorators';
              import { UnitOptions } from './UnitOptions';
              import { UnitBasicDefinition, UnitDefinition, UnitFunctionDefinition, UnitValueType } from './UnitDefinition';
              import { UnitPrefix, UnitPrefixType } from './UnitPrefix';
              Severity: Minor
              Found in src/utils/unit/Unit.ts - About 2 hrs to fix

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

                @SerializableObject()
                export class Temperature extends SensorValue<TemperatureUnit> {
                    constructor(value = 0, unit = TemperatureUnit.CELCIUS) {
                        super(value, undefined, undefined, unit, TemperatureUnit.CELCIUS);
                    }
                Severity: Major
                Found in src/data/values/Temperature.ts and 1 other location - About 2 hrs to fix
                src/data/values/Pressure.ts on lines 5..18

                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 83.

                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

                @SerializableObject()
                export class Pressure extends SensorValue<PressureUnit> {
                    constructor(value = 0, unit = PressureUnit.PASCAL) {
                        super(value, undefined, undefined, unit, PressureUnit.PASCAL);
                    }
                Severity: Major
                Found in src/data/values/Pressure.ts and 1 other location - About 2 hrs to fix
                src/data/values/Temperature.ts on lines 8..21

                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 83.

                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

                    clone(): this {
                        const vector = super.clone();
                        vector.accuracy = this.accuracy ? this.accuracy.clone() : undefined;
                        vector.timestamp = this.timestamp;
                        return vector as this;
                Severity: Major
                Found in src/data/position/Orientation.ts and 1 other location - About 2 hrs to fix
                src/data/position/RelativeOrientation.ts on lines 37..42

                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 80.

                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 3 locations. Consider refactoring.
                Open

                    clone(): this {
                        const position = super.clone();
                        position.x = this.x;
                        position.y = this.y;
                        position.z = this.z;
                Severity: Major
                Found in src/data/position/Absolute3DPosition.ts and 2 other locations - About 2 hrs to fix
                src/data/position/GeographicalPosition.ts on lines 173..179
                src/data/position/Relative3DPosition.ts on lines 62..68

                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 80.

                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 3 locations. Consider refactoring.
                Open

                    clone(): this {
                        const position = super.clone();
                        position.latitude = this.latitude;
                        position.longitude = this.longitude;
                        position.z = this.altitude;
                Severity: Major
                Found in src/data/position/GeographicalPosition.ts and 2 other locations - About 2 hrs to fix
                src/data/position/Absolute3DPosition.ts on lines 63..69
                src/data/position/Relative3DPosition.ts on lines 62..68

                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 80.

                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

                Severity
                Category
                Status
                Source
                Language