OpenHPS/openhps-core

View on GitHub

Showing 247 of 247 total issues

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/Relative3DPosition.ts and 2 other locations - About 2 hrs to fix
src/data/position/Absolute3DPosition.ts on lines 63..69
src/data/position/GeographicalPosition.ts on lines 173..179

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

Function updateSerializableMember has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

export function updateSerializableMember(
    target: unknown,
    propertyKey: string,
    options: SerializableMemberOptions | IndexedObject,
) {
Severity: Minor
Found in src/data/decorators/utils.ts - About 2 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

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/RelativeOrientation.ts and 1 other location - About 2 hrs to fix
src/data/position/Orientation.ts on lines 35..40

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

ReferenceSpace has 21 functions (exceeds 20 allowed). Consider refactoring.
Open

@SerializableObject()
export class ReferenceSpace extends DataObject implements TransformationSpace {
    @SerializableMember({
        name: 'translationMatrix',
    })
Severity: Minor
Found in src/data/object/space/ReferenceSpace.ts - About 2 hrs to fix

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

        clone(): this {
            const result = new (this.constructor as new (...args: any[]) => this)();
            result._value = this._value;
            result._unit = this._unit;
            return result;
    Severity: Major
    Found in src/utils/unit/UnitValue.ts and 1 other location - About 2 hrs to fix
    src/data/values/Accuracy.ts on lines 56..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 77.

    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

        clone(): this {
            const result = new (this.constructor as new (...args: any[]) => this)();
            result.value = this.value;
            result._unit = this._unit;
            return result;
    Severity: Major
    Found in src/data/values/Accuracy.ts and 1 other location - About 2 hrs to fix
    src/utils/unit/UnitValue.ts on lines 80..85

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

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

                        position.accuracy = new Accuracy1D(
                            spheres.map((s) => s.accuracy).reduce((a, b) => a.valueOf() + b.valueOf()) / spheres.length,
                            position.unit,
                        );
    Severity: Major
    Found in src/nodes/processing/MultilaterationNode.ts and 2 other locations - About 2 hrs to fix
    src/nodes/processing/MultilaterationNode.ts on lines 87..91
    src/nodes/processing/MultilaterationNode.ts on lines 103..106

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

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

                        position.accuracy = new Accuracy1D(
                            spheres.map((s) => s.accuracy).reduce((a, b) => a.valueOf() + b.valueOf()) / spheres.length,
                            position.unit,
                        );
    Severity: Major
    Found in src/nodes/processing/MultilaterationNode.ts and 2 other locations - About 2 hrs to fix
    src/nodes/processing/MultilaterationNode.ts on lines 75..78
    src/nodes/processing/MultilaterationNode.ts on lines 87..91

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

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

                                        position.accuracy = new Accuracy1D(
                                            spheres.map((s) => s.accuracy).reduce((a, b) => a.valueOf() + b.valueOf()) /
                                                spheres.length,
                                            position.unit,
                                        );
    Severity: Major
    Found in src/nodes/processing/MultilaterationNode.ts and 2 other locations - About 2 hrs to fix
    src/nodes/processing/MultilaterationNode.ts on lines 75..78
    src/nodes/processing/MultilaterationNode.ts on lines 103..106

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

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

        private _spawnWorker(): Promise<Thread> {
            return new Promise((resolve, reject) => {
                const worker = this.createWorker();
                spawn(worker, {
                    timeout: this.options.timeout,
    Severity: Minor
    Found in src/worker/WorkerHandler.ts - About 1 hr to fix

      Function findByName has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

          static findByName(name: string, baseName?: string): Unit | undefined {
              if (name === undefined) {
                  return undefined;
              } else if (Unit.UNITS.has(name)) {
                  return Unit.UNITS.get(name);
      Severity: Minor
      Found in src/utils/unit/Unit.ts - About 1 hr 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 8 locations. Consider refactoring.
      Open

      export class LinearAccelerationSensor extends SensorObject<Acceleration> {
          constructor(uid?: string, value?: Acceleration, frequency?: number, displayName?: string) {
              super(uid, value ?? new Acceleration(), frequency, displayName);
          }
      }
      Severity: Major
      Found in src/data/object/sensors/LinearAccelerationSensor.ts and 7 other locations - About 1 hr to fix
      src/data/object/sensors/AbsoluteOrientationSensor.ts on lines 10..14
      src/data/object/sensors/Accelerometer.ts on lines 10..14
      src/data/object/sensors/GravitySensor.ts on lines 10..14
      src/data/object/sensors/Gyroscope.ts on lines 10..14
      src/data/object/sensors/LinearVelocitySensor.ts on lines 10..14
      src/data/object/sensors/Magnetometer.ts on lines 10..14
      src/data/object/sensors/RelativeOrientationSensor.ts on lines 10..14

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

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

      export class Magnetometer extends SensorObject<Magnetism> {
          constructor(uid?: string, value?: Magnetism, frequency?: number, displayName?: string) {
              super(uid, value ?? new Magnetism(), frequency, displayName);
          }
      }
      Severity: Major
      Found in src/data/object/sensors/Magnetometer.ts and 7 other locations - About 1 hr to fix
      src/data/object/sensors/AbsoluteOrientationSensor.ts on lines 10..14
      src/data/object/sensors/Accelerometer.ts on lines 10..14
      src/data/object/sensors/GravitySensor.ts on lines 10..14
      src/data/object/sensors/Gyroscope.ts on lines 10..14
      src/data/object/sensors/LinearAccelerationSensor.ts on lines 10..14
      src/data/object/sensors/LinearVelocitySensor.ts on lines 10..14
      src/data/object/sensors/RelativeOrientationSensor.ts on lines 10..14

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

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

      export class RelativeOrientationSensor extends SensorObject<Orientation> {
          constructor(uid?: string, value?: Orientation, frequency?: number, displayName?: string) {
              super(uid, value ?? new Orientation(), frequency, displayName);
          }
      }
      Severity: Major
      Found in src/data/object/sensors/RelativeOrientationSensor.ts and 7 other locations - About 1 hr to fix
      src/data/object/sensors/AbsoluteOrientationSensor.ts on lines 10..14
      src/data/object/sensors/Accelerometer.ts on lines 10..14
      src/data/object/sensors/GravitySensor.ts on lines 10..14
      src/data/object/sensors/Gyroscope.ts on lines 10..14
      src/data/object/sensors/LinearAccelerationSensor.ts on lines 10..14
      src/data/object/sensors/LinearVelocitySensor.ts on lines 10..14
      src/data/object/sensors/Magnetometer.ts on lines 10..14

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

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

      export class LinearVelocitySensor extends SensorObject<LinearVelocity> {
          constructor(uid?: string, value?: LinearVelocity, frequency?: number, displayName?: string) {
              super(uid, value ?? new LinearVelocity(), frequency, displayName);
          }
      }
      Severity: Major
      Found in src/data/object/sensors/LinearVelocitySensor.ts and 7 other locations - About 1 hr to fix
      src/data/object/sensors/AbsoluteOrientationSensor.ts on lines 10..14
      src/data/object/sensors/Accelerometer.ts on lines 10..14
      src/data/object/sensors/GravitySensor.ts on lines 10..14
      src/data/object/sensors/Gyroscope.ts on lines 10..14
      src/data/object/sensors/LinearAccelerationSensor.ts on lines 10..14
      src/data/object/sensors/Magnetometer.ts on lines 10..14
      src/data/object/sensors/RelativeOrientationSensor.ts on lines 10..14

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

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

      export class Gyroscope extends SensorObject<AngularVelocity> {
          constructor(uid?: string, value?: AngularVelocity, frequency?: number, displayName?: string) {
              super(uid, value ?? new AngularVelocity(), frequency, displayName);
          }
      }
      Severity: Major
      Found in src/data/object/sensors/Gyroscope.ts and 7 other locations - About 1 hr to fix
      src/data/object/sensors/AbsoluteOrientationSensor.ts on lines 10..14
      src/data/object/sensors/Accelerometer.ts on lines 10..14
      src/data/object/sensors/GravitySensor.ts on lines 10..14
      src/data/object/sensors/LinearAccelerationSensor.ts on lines 10..14
      src/data/object/sensors/LinearVelocitySensor.ts on lines 10..14
      src/data/object/sensors/Magnetometer.ts on lines 10..14
      src/data/object/sensors/RelativeOrientationSensor.ts on lines 10..14

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

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

      export class AbsoluteOrientationSensor extends SensorObject<Orientation> {
          constructor(uid?: string, value?: Orientation, frequency?: number, displayName?: string) {
              super(uid, value ?? new Orientation(), frequency, displayName);
          }
      }
      Severity: Major
      Found in src/data/object/sensors/AbsoluteOrientationSensor.ts and 7 other locations - About 1 hr to fix
      src/data/object/sensors/Accelerometer.ts on lines 10..14
      src/data/object/sensors/GravitySensor.ts on lines 10..14
      src/data/object/sensors/Gyroscope.ts on lines 10..14
      src/data/object/sensors/LinearAccelerationSensor.ts on lines 10..14
      src/data/object/sensors/LinearVelocitySensor.ts on lines 10..14
      src/data/object/sensors/Magnetometer.ts on lines 10..14
      src/data/object/sensors/RelativeOrientationSensor.ts on lines 10..14

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

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

      export class GravitySensor extends SensorObject<Acceleration> {
          constructor(uid?: string, value?: Acceleration, frequency?: number, displayName?: string) {
              super(uid, value ?? new Acceleration(), frequency, displayName);
          }
      }
      Severity: Major
      Found in src/data/object/sensors/GravitySensor.ts and 7 other locations - About 1 hr to fix
      src/data/object/sensors/AbsoluteOrientationSensor.ts on lines 10..14
      src/data/object/sensors/Accelerometer.ts on lines 10..14
      src/data/object/sensors/Gyroscope.ts on lines 10..14
      src/data/object/sensors/LinearAccelerationSensor.ts on lines 10..14
      src/data/object/sensors/LinearVelocitySensor.ts on lines 10..14
      src/data/object/sensors/Magnetometer.ts on lines 10..14
      src/data/object/sensors/RelativeOrientationSensor.ts on lines 10..14

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

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

      export class Accelerometer extends SensorObject<Acceleration> {
          constructor(uid?: string, value?: Acceleration, frequency?: number, displayName?: string) {
              super(uid, value ?? new Acceleration(), frequency, displayName);
          }
      }
      Severity: Major
      Found in src/data/object/sensors/Accelerometer.ts and 7 other locations - About 1 hr to fix
      src/data/object/sensors/AbsoluteOrientationSensor.ts on lines 10..14
      src/data/object/sensors/GravitySensor.ts on lines 10..14
      src/data/object/sensors/Gyroscope.ts on lines 10..14
      src/data/object/sensors/LinearAccelerationSensor.ts on lines 10..14
      src/data/object/sensors/LinearVelocitySensor.ts on lines 10..14
      src/data/object/sensors/Magnetometer.ts on lines 10..14
      src/data/object/sensors/RelativeOrientationSensor.ts on lines 10..14

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

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

          getCurrentPosition(object: T | string, options: GeoOptions = {}): Promise<P> {
              return new Promise((resolve, reject) => {
                  const maximumAge = options.maximumAge || Infinity;
                  options.timeout = options.timeout || 10000;
                  const uid = object instanceof DataObject ? object.uid : object;
      Severity: Minor
      Found in src/service/LocationBasedService.ts - About 1 hr to fix
        Severity
        Category
        Status
        Source
        Language