OpenHPS/openhps-core

View on GitHub

Showing 247 of 247 total issues

Function push has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public push(data: In | In[], options?: PushOptions): Promise<void> {
        return new Promise<void>((resolve, reject) => {
            if (data === null || data === undefined) {
                return reject();
            }
Severity: Minor
Found in src/nodes/SinkNode.ts - About 1 hr to fix

    Function convertAsSet has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        convertAsSet(
            sourceObject: any,
            typeDescriptor: SetTypeDescriptor,
            knownTypes: Map<string, Serializable<any>>,
            memberName: string,
    Severity: Minor
    Found in src/data/Deserializer.ts - About 1 hr to fix

      Function _onPush has 38 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private _onPush(frame: In | In[], options?: PushOptions): Promise<void> {
              return new Promise<void>((resolve, reject) => {
                  const processPromises: Array<Promise<Out | Out[]>> = [];
      
                  if (Array.isArray(frame)) {
      Severity: Minor
      Found in src/nodes/ProcessingNode.ts - About 1 hr to fix

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

            clone(): this {
                const position = super.clone();
                position.x = this.x;
                position.y = this.y;
                return position as this;
        Severity: Major
        Found in src/data/position/Relative2DPosition.ts and 1 other location - About 1 hr to fix
        src/data/position/Absolute2DPosition.ts on lines 88..93

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

        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 position = super.clone();
                position.x = this.x;
                position.y = this.y;
                return position as this;
        Severity: Major
        Found in src/data/position/Absolute2DPosition.ts and 1 other location - About 1 hr to fix
        src/data/position/Relative2DPosition.ts on lines 75..80

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

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

            processObject(object: DataObject, frame: InOut): Promise<DataObject> {
                return new Promise((resolve, reject) => {
                    // Get existing filter data
                    this.getNodeData(object)
                        .then(async (nodeData) => {
        Severity: Minor
        Found in src/nodes/processing/dsp/FilterProcessingNode.ts - About 1 hr to fix

          Function convertAsArray has 36 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              convertAsArray(
                  sourceObject: any,
                  typeDescriptor: ArrayTypeDescriptor,
                  knownTypes: Map<string, Serializable<any>>,
                  memberName: string,
          Severity: Minor
          Found in src/data/Deserializer.ts - About 1 hr to fix

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

                set raw(value: T) {
                    if (this.calibrationData) {
                        if (value instanceof SensorValue) {
                            let result = 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 findByName has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

                protected findByName(name: string): Unit | undefined {
                    // Check all aliases in those units
                    for (const alias of this.aliases.concat(this.name)) {
                        if (name === alias) {
                            // Exact match with alias
            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

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

            worker.setShape(ModelBuilder.create()
                .from()
                .via(new CallbackNode(frame => {
                    frame.test = "abc";
                    console.log("worker", frame);
            Severity: Major
            Found in examples/browser-es6-threading/worker.js and 1 other location - About 1 hr to fix
            examples/browser-es6/worker.js on lines 3..9

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

            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

            export default ModelBuilder.create()
                .from()
                .via(new CallbackNode(frame => {
                    frame.test = "abc";
                    console.log("worker", frame);
            Severity: Major
            Found in examples/browser-es6/worker.js and 1 other location - About 1 hr to fix
            examples/browser-es6-threading/worker.js on lines 4..10

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

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

                protected mergeFrame(frame: DataFrame): Promise<DataFrame> {
                    return new Promise<DataFrame>((resolve, reject) => {
                        const defaultService = this.model.findDataService(DataObject);
                        const promises: Array<Promise<void>> = [];
                        const objects: DataObject[] = [];
            Severity: Minor
            Found in src/nodes/SourceNode.ts - About 1 hr to fix

              Function _convertSingleValue has 35 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private _convertSingleValue(
                      sourceObject: any,
                      typeDescriptor: TypeDescriptor,
                      memberName?: string,
                      memberOptions?: ObjectMemberMetadata,
              Severity: Minor
              Found in src/data/Serializer.ts - About 1 hr to fix

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

                                if (typeof node === 'string') {
                                    nodeObject = this.graph.findNodeByUID(node) || this.graph.findNodeByName(node);
                                    if (nodeObject === undefined) {
                                        // Add a placeholder
                                        nodeObject = new PlaceholderNode(node);
                Severity: Major
                Found in src/graph/builders/GraphBuilder.ts and 1 other location - About 1 hr to fix
                src/graph/builders/GraphBuilder.ts on lines 338..346

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

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

                    public process(frame: InOut, options?: PushOptions): Promise<InOut> {
                        return new Promise<InOut>((resolve) => {
                            if (this.options.maxCount === 1) {
                                return resolve(frame);
                            }
                Severity: Minor
                Found in src/nodes/shapes/MergeShape.ts - About 1 hr to fix

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

                                  } else if (typeof node === 'string') {
                                      nodeObject = this.graph.findNodeByUID(node) || this.graph.findNodeByName(node);
                                      if (nodeObject === undefined) {
                                          // Add a placeholder
                                          nodeObject = new PlaceholderNode(node);
                  Severity: Major
                  Found in src/graph/builders/GraphBuilder.ts and 1 other location - About 1 hr to fix
                  src/graph/builders/GraphBuilder.ts on lines 206..214

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

                  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

                      get accuracy(): Accuracy<LengthUnit, any> {
                          if (!this._accuracy) {
                              this._accuracy = new Accuracy1D(1, this.unit);
                          }
                          return this._accuracy;
                  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 82..87
                  src/data/position/RelativePosition.ts on lines 67..72

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

                  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

                      get accuracy(): Accuracy<U, any> {
                          if (!this._accuracy) {
                              this._accuracy = new Accuracy1D(1, this._defaultUnit);
                          }
                          return this._accuracy;
                  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 82..87
                  src/data/position/Pose.ts on lines 60..65

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

                  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

                      get accuracy(): Accuracy<LengthUnit, any> {
                          if (!this._accuracy) {
                              this._accuracy = new Accuracy1D(1, this.unit);
                          }
                          return this._accuracy;
                  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 60..65
                  src/data/position/RelativePosition.ts on lines 67..72

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

                  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

                      findByDisplayName(displayName: string): Promise<T[]> {
                          return this.findAll({
                              displayName,
                          }) as Promise<T[]>;
                      }
                  Severity: Major
                  Found in src/service/DataObjectService.ts and 1 other location - About 1 hr to fix
                  src/service/DataObjectService.ts on lines 75..79

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

                  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