Showing 142 of 497 total issues

Function reqHistoricalData has 83 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  reqHistoricalData(
    tickerId: number,
    contract: Contract,
    endDateTime: string,
    durationStr: string,
Severity: Major
Found in src/core/io/encoder.ts - About 3 hrs to fix

    Function readVolOrderParams has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

      readVolOrderParams(readOpenOrderAttribs: boolean): void {
        if (this.version >= 11) {
          this.order.volatility = this.decoder.readDoubleOrUndefined();
          this.order.volatilityType = this.decoder.readInt();
          if (this.version == 11) {
    Severity: Minor
    Found in src/core/io/decoder.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

    File socket.ts has 299 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import net from "net";
    import { TextEncoder } from "util";
    
    import {
      IBApiCreationOptions,
    Severity: Minor
    Found in src/core/io/socket.ts - About 3 hrs to fix

      Function exerciseOptions has 77 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        exerciseOptions(
          tickerId: number,
          contract: Contract,
          exerciseAction: OptionExerciseAction,
          exerciseQuantity: number,
      Severity: Major
      Found in src/core/io/encoder.ts - About 3 hrs to fix

        Function decodeMsg_COMPLETED_ORDER has 76 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          private decodeMsg_COMPLETED_ORDER(): void {
            const contract: Contract = {};
            const order: Order = {};
            const orderState: OrderState = {};
            const orderDecoder = new OrderDecoder(
        Severity: Major
        Found in src/core/io/decoder.ts - About 3 hrs to fix

          Function decodeMsg_BOND_CONTRACT_DATA has 76 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            private decodeMsg_BOND_CONTRACT_DATA(): void {
              let version = 6;
              if (this.serverVersion < MIN_SERVER_VER.SIZE_RULES) {
                version = this.readInt();
              }
          Severity: Major
          Found in src/core/io/decoder.ts - About 3 hrs to fix

            Function register has 71 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              register<T>(
                requestFunction: (reqId: number) => void,
                cancelFunction: (reqId: number) => void | null | undefined,
                eventHandler: [
                  EventName,
            Severity: Major
            Found in src/core/api-next/subscription-registry.ts - About 2 hrs to fix

              Function decodeMsg_TICK_OPTION_COMPUTATION has 70 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                private decodeMsg_TICK_OPTION_COMPUTATION(): void {
                  let version;
                  if (this.serverVersion >= MIN_SERVER_VER.PRICE_BASED_VOLATILITY)
                    version = Number.MAX_VALUE;
                  else version = this.readInt();
              Severity: Major
              Found in src/core/io/decoder.ts - About 2 hrs to fix

                Function reqHistoricalData has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                Open

                  reqHistoricalData(
                    tickerId: number,
                    contract: Contract,
                    endDateTime: string,
                    durationStr: string,
                Severity: Minor
                Found in src/core/io/encoder.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

                Function decodeMsg_EXECUTION_DATA has 66 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  private decodeMsg_EXECUTION_DATA(): void {
                    let version = this.serverVersion;
                    if (version < MIN_SERVER_VER.LAST_LIQUIDITY) {
                      version = this.readInt();
                    }
                Severity: Major
                Found in src/core/io/decoder.ts - About 2 hrs to fix

                  Function reqMktDepth has 65 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    reqMktDepth(
                      tickerId: number,
                      contract: Contract,
                      numRows: number,
                      isSmartDepth: boolean,
                  Severity: Major
                  Found in src/core/io/encoder.ts - About 2 hrs to fix

                    Function decodeMsg_TICK_OPTION_COMPUTATION has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                    Open

                      private decodeMsg_TICK_OPTION_COMPUTATION(): void {
                        let version;
                        if (this.serverVersion >= MIN_SERVER_VER.PRICE_BASED_VOLATILITY)
                          version = Number.MAX_VALUE;
                        else version = this.readInt();
                    Severity: Minor
                    Found in src/core/io/decoder.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

                    Function process has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                    Open

                      process(): void {
                        while (true) {
                          // verify there is data to process
                    
                          if (!this.dataQueue.length) {
                    Severity: Minor
                    Found in src/core/io/decoder.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

                    Function exerciseOptions has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                    Open

                      exerciseOptions(
                        tickerId: number,
                        contract: Contract,
                        exerciseAction: OptionExerciseAction,
                        exerciseQuantity: number,
                    Severity: Minor
                    Found in src/core/io/encoder.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

                    Function decodeMsg_HISTORICAL_DATA has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      private decodeMsg_HISTORICAL_DATA(): void {
                        let version = Number.MAX_SAFE_INTEGER;
                        if (this.serverVersion < MIN_SERVER_VER.SYNT_REALTIME_BARS) {
                          version = this.readInt();
                        }
                    Severity: Major
                    Found in src/core/io/decoder.ts - About 2 hrs to fix

                      Function decodeMsg_TICK_BY_TICK has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        private decodeMsg_TICK_BY_TICK(): void {
                          const reqId = this.readInt();
                          const tickType = this.readInt();
                          const time = this.readStr();
                      
                      
                      Severity: Major
                      Found in src/core/io/decoder.ts - About 2 hrs to fix

                        Function reqScannerSubscription has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          reqScannerSubscription(
                            reqId: number,
                            subscription: ScannerSubscription,
                            scannerSubscriptionOptions: TagValue[],
                            scannerSubscriptionFilterOptions?: TagValue[],
                        Severity: Major
                        Found in src/core/io/encoder.ts - About 2 hrs to fix

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

                          export class Controller implements EncoderCallbacks, DecoderCallbacks {
                            /**
                             *
                             * @param ib The [[IBApi]] object.
                             * @param _options The [[IBApi]] creation options.
                          Severity: Minor
                          Found in src/core/io/controller.ts - About 2 hrs to fix

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

                            export class Socket {
                              /**
                               * Create a new [[Socket]] object.
                               *
                               * @param controller The parent [[Controller]] object.
                            Severity: Minor
                            Found in src/core/io/socket.ts - About 2 hrs to fix

                              Function connect has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                              Open

                                connect(reconnectInterval?: number, clientId?: number): void {
                                  // create the IBApiNext object
                              
                                  const port = (this.cmdLineArgs.port as number) ?? configuration.ib_port;
                                  const host = (this.cmdLineArgs.host as string) ?? configuration.ib_host;
                              Severity: Minor
                              Found in src/tools/common/ib-api-next-app.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

                              Severity
                              Category
                              Status
                              Source
                              Language