matthsc/gigaset-elements-api

View on GitHub

Showing 17 of 36 total issues

File api.spec.ts has 508 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* eslint-disable @typescript-eslint/no-unused-vars */
import * as sinon from "sinon";
import { IEventRoot, IEventsItem } from "./model";
import { assert, use as chaiUse } from "chai";
import { url, urlParams } from "./requestHelper";
Severity: Major
Found in src/api.spec.ts - About 1 day to fix

    File data-tools.ts has 444 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import {
      IBaseStationRoot,
      IElementRoot,
      IEndnodesItem,
      IEventRoot,
    Severity: Minor
    Found in test-data/data-tools.ts - About 6 hrs to fix

      Function reduceTestData has 80 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function reduceTestData(
        baseStations: IBaseStationRoot,
        elementRoot: IElementRoot,
        eventRoot: IEventRoot,
      ) {
      Severity: Major
      Found in test-data/data-tools.ts - About 3 hrs to fix

        Function tryStripPersonalDataFromBaseStation has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
        Open

        function tryStripPersonalDataFromBaseStation(
          baseStations: IBaseStationRoot,
          maps: IPersonalDataMaps,
        ) {
          for (const base of baseStations) {
        Severity: Minor
        Found in test-data/data-tools.ts - About 3 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

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

        export function reduceTestData(
          baseStations: IBaseStationRoot,
          elementRoot: IElementRoot,
          eventRoot: IEventRoot,
        ) {
        Severity: Minor
        Found in test-data/data-tools.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 tryStripPersonalDataFromEvents has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

        function tryStripPersonalDataFromEvents(
          events: IEventsItem[],
          maps: IPersonalDataMaps,
        ) {
          for (const event of events) {
        Severity: Minor
        Found in test-data/data-tools.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 mergeEventRoots has 41 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function mergeEventRoots(
          eventRoots: IEventRoot[],
          baseStationRoots: IBaseStationRoot[],
          mergedBaseStationRoot: IBaseStationRoot,
          elementRoots: IElementRoot[],
        Severity: Minor
        Found in test-data/data-tools.ts - About 1 hr to fix

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

          function mergeElementsRoots(elementRoots: IElementRoot[]) {
            const mergedElementsRoot = elementRoots[0];
            for (let i = 1; i < elementRoots.length; i++) {
              const currentElementRoot = elementRoots[i];
              // bs01
          Severity: Minor
          Found in test-data/data-tools.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 tryStripPersonalDataFromEvents has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function tryStripPersonalDataFromEvents(
            events: IEventsItem[],
            maps: IPersonalDataMaps,
          ) {
            for (const event of events) {
          Severity: Minor
          Found in test-data/data-tools.ts - About 1 hr to fix

            Function tryStripPersonalDataAndGiveUniqueIds has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export function tryStripPersonalDataAndGiveUniqueIds(
              baseStations: IBaseStationRoot,
              elementRoot: IElementRoot,
              eventRoot: IEventRoot,
            ): void {
            Severity: Minor
            Found in test-data/data-tools.ts - About 1 hr to fix

              Function tryStripPersonalDataFromRooms has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

              function tryStripPersonalDataFromRooms(
                objectWithRoomData: unknown,
                maps: IPersonalDataMaps,
              ) {
                const item = objectWithRoomData as ISubelementsItem;
              Severity: Minor
              Found in test-data/data-tools.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 runTests has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                async function runTests(method: "get" | "post") {
                  const reply1 = {};
                  const reply2 = { alpha: 1, beta: "2" };
                  const reply3 = { m: "NO" };
                  const scope = nock(url)
              Severity: Minor
              Found in src/requestHelper.spec.ts - About 1 hr to fix

                Function mergeTestData has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export function mergeTestData(
                  baseStationRoots: IBaseStationRoot[],
                  elementRoots: IElementRoot[],
                  eventRoots: IEventRoot[],
                ): [IBaseStationRoot, IElementRoot, IEventRoot] {
                Severity: Minor
                Found in test-data/data-tools.ts - About 1 hr to fix

                  Function Authorize has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function Authorize(
                    target: GigasetElementsApi,
                    title: string,
                    descriptor: PropertyDescriptor,
                  ) {
                  Severity: Minor
                  Found in src/api.ts - About 45 mins 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

                  Avoid deeply nested control flow statements.
                  Open

                            for (const setting of settings) {
                              if (setting.endnode_id)
                                setting.endnode_id = maps.elementIds.get(
                                  setting.endnode_id,
                                ) as string;
                  Severity: Major
                  Found in test-data/data-tools.ts - About 45 mins to fix

                    Function mergeEventRoots has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                      eventRoots: IEventRoot[],
                      baseStationRoots: IBaseStationRoot[],
                      mergedBaseStationRoot: IBaseStationRoot,
                      elementRoots: IElementRoot[],
                      mergedElementRoots: IElementRoot,
                    Severity: Minor
                    Found in test-data/data-tools.ts - About 35 mins to fix

                      Function mergeBaseStationRoots has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function mergeBaseStationRoots(baseStationRoots: IBaseStationRoot[]) {
                        const mergedBaseStationRoot = baseStationRoots[0];
                        for (let i = 1; i < baseStationRoots.length; i++) {
                          const currentBaseStationRoot = baseStationRoots[i];
                          for (let j = 0; j < baseStationRoots[i].length; j++) {
                      Severity: Minor
                      Found in test-data/data-tools.ts - About 35 mins 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

                      Severity
                      Category
                      Status
                      Source
                      Language