OpenHPS/openhps-core

View on GitHub

Showing 87 of 247 total issues

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

    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

    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

      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

          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 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 _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

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

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

                      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

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

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

                            Function findAll has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public findAll(query?: FilterQuery<T>, options: FindOptions = {}): Promise<T[]> {
                                    return new Promise<T[]>((resolve) => {
                                        options.limit = options.limit || this._data.size;
                                        let data: T[] = [];
                                        this._data.forEach((object) => {
                            Severity: Minor
                            Found in src/service/MemoryDataService.ts - About 1 hr to fix

                              Function processRelativePositions has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  public processRelativePositions<P extends Absolute2DPosition | Absolute3DPosition | GeographicalPosition>(
                                      dataObject: DataObject,
                                      relativePositions: Map<RelativeAngle, DataObject>,
                                      dataFrame: DataFrame,
                                  ): Promise<DataObject> {
                              Severity: Minor
                              Found in src/nodes/processing/TriangulationNode.ts - About 1 hr to fix
                                Severity
                                Category
                                Status
                                Source
                                Language