OpenHPS/openhps-core

View on GitHub

Showing 247 of 247 total issues

Function updateSerializableMember has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function updateSerializableMember(
    target: unknown,
    propertyKey: string,
    options: SerializableMemberOptions | IndexedObject,
) {
Severity: Minor
Found in src/data/decorators/utils.ts - About 1 hr to fix

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

        convertAsMap(
            sourceObject: Map<any, any>,
            typeDescriptor: MapTypeDescriptor,
            memberName: string,
            serializer: Serializer,
    Severity: Minor
    Found in src/data/Serializer.ts - About 1 hr to fix

      Function toString has 45 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          toString(byteLength?: number, padding: boolean = true): string {
              byteLength = byteLength ?? this._raw.byteLength;
              const bytes = [];
              for (const [, value] of this._raw.entries()) {
                  bytes.push(value);
      Severity: Minor
      Found in src/data/UUID.ts - About 1 hr to fix

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

            constructor(options?: TimeSyncOptions) {
                super(options);
                this.on('build', this._initTimer.bind(this));
                this.on('destroy', this._stopTimer.bind(this));
            }
        Severity: Major
        Found in src/nodes/shapes/TimeSyncNode.ts and 1 other location - About 1 hr to fix
        src/nodes/GraphShapeNode.ts on lines 20..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 70.

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

            private _onOutput(next: { id: string; success: boolean; result?: any }): void {
                if (this._promises.has(next.id)) {
                    const promise = this._promises.get(next.id);
                    if (next.success) {
                        if (next.result === undefined) {
        Severity: Minor
        Found in src/service/WorkerServiceProxy.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 2 locations. Consider refactoring.
        Open

            constructor(options?: GraphShapeNodeOptions) {
                super(options);
                this.once('build', this._onBuild.bind(this));
                this.once('destroy', this._onDestroy.bind(this));
            }
        Severity: Major
        Found in src/nodes/GraphShapeNode.ts and 1 other location - About 1 hr to fix
        src/nodes/shapes/TimeSyncNode.ts on lines 15..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 70.

        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

            set probability(value: number) {
                if (value > 1 || value < 0) {
                    throw new Error(`${this.constructor.name} should be between 0 and 1.`);
                }
                this._probability = value;
        Severity: Major
        Found in src/data/position/RelativePosition.ts and 2 other locations - About 1 hr to fix
        src/data/position/AbsolutePosition.ts on lines 71..76
        src/data/position/Pose.ts on lines 49..54

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

        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

            set probability(value: number) {
                if (value > 1 || value < 0) {
                    throw new Error(`${this.constructor.name} should be between 0 and 1.`);
                }
                this._probability = value;
        Severity: Major
        Found in src/data/position/AbsolutePosition.ts and 2 other locations - About 1 hr to fix
        src/data/position/Pose.ts on lines 49..54
        src/data/position/RelativePosition.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 69.

        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

            set probability(value: number) {
                if (value > 1 || value < 0) {
                    throw new Error(`${this.constructor.name} should be between 0 and 1.`);
                }
                this._probability = value;
        Severity: Major
        Found in src/data/position/Pose.ts and 2 other locations - About 1 hr to fix
        src/data/position/AbsolutePosition.ts on lines 71..76
        src/data/position/RelativePosition.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 69.

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

            protected filterValue<T extends number | Vector3>(object: DataObject, value: T, key = 'default'): Promise<T> {
                return new Promise((resolve, reject) => {
                    // Get existing filter data
                    this.getNodeData(object)
                        .then(async (nodeData) => {
        Severity: Minor
        Found in src/nodes/processing/dsp/PropertyFilterProcessingNode.ts - About 1 hr to fix

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

              public static rotationFromQuaternion<T extends Matrix4>(quat: THREE.Quaternion): T {
                  const matrix = new this();
                  matrix.makeRotationFromQuaternion(quat);
                  return matrix as T;
              }
          Severity: Major
          Found in src/utils/math/Matrix4.ts and 1 other location - About 1 hr to fix
          src/utils/math/Matrix4.ts on lines 50..54

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

          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

                              } else {
                                  // Forward pull
                                  Promise.all(this.inlets.map((inlet) => inlet.pull(options)))
                                      .then(() => {
                                          resolve();
          Severity: Major
          Found in src/nodes/CallbackNode.ts and 1 other location - About 1 hr to fix
          src/nodes/WorkerNode.ts on lines 103..110

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

          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

              public static rotationFromEuler<T extends Matrix4>(euler: THREE.Euler): T {
                  const matrix = new this();
                  matrix.makeRotationFromEuler(euler);
                  return matrix as T;
              }
          Severity: Major
          Found in src/utils/math/Matrix4.ts and 1 other location - About 1 hr to fix
          src/utils/math/Matrix4.ts on lines 39..43

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

          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

                      if (this.options.optimizedPull) {
                          // Do not pass the pull request to the worker
                          Promise.all(this.inlets.map((inlet) => inlet.pull(options)))
                              .then(() => {
                                  resolve();
          Severity: Major
          Found in src/nodes/WorkerNode.ts and 1 other location - About 1 hr to fix
          src/nodes/CallbackNode.ts on lines 56..63

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

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

          export default function register() {
              GraphShapeBuilder.registerShape(
                  'convertToSpace',
                  (space: ReferenceSpace) =>
                      new ReferenceSpaceConversionNode(space, {
          Severity: Minor
          Found in src/graph/_internal/GraphShapeRegistration.ts - About 1 hr to fix

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

                convertAsObject(
                    sourceObject: IndexedObject,
                    typeDescriptor: ConcreteTypeDescriptor,
                    memberName: string,
                    serializer: Serializer,
            Severity: Minor
            Found in src/data/Serializer.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

            Function raw has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

                get raw(): T {
                    if (this.calibrationData) {
                        if (this.value instanceof SensorValue) {
                            let result = this.value.clone() as SensorValue;
                            const offset = this.calibrationData.offset as unknown as SensorValue;
            Severity: Minor
            Found in src/data/object/SensorObject.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

            Function getLatestChanges has 39 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                getLatestChanges(): Change[] {
                    // Get the changes per property
                    const changesPerProperty: { [key: string]: Change[] } = {};
                    this.changes.forEach((change) => {
                        if (!changesPerProperty[change.property]) {
            Severity: Minor
            Found in src/data/decorators/ChangeLog.ts - About 1 hr to fix

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

                              serializedParams.forEach((param: any) => {
                                  if (param['__type']) {
                                      params.push(DataSerializer.deserialize(param));
                                  } else {
                                      params.push(param);
              Severity: Major
              Found in src/worker/WorkerBase.ts and 1 other location - About 1 hr to fix
              src/worker/WorkerHandler.ts on lines 275..281

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

              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

                          serializedParams.forEach((param: any) => {
                              if (param['__type']) {
                                  params.push(DataSerializer.deserialize(param));
                              } else {
                                  params.push(param);
              Severity: Major
              Found in src/worker/WorkerHandler.ts and 1 other location - About 1 hr to fix
              src/worker/WorkerBase.ts on lines 233..239

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

              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