Showing 142 of 497 total issues

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

  private runWatchdog(): void {
    // verify state
    if (!this.watchdogInterval || this.connectionWatchdogTimeout) {
      return;
    }
Severity: Minor
Found in src/core/api-next/auto-connection.ts - About 1 hr to fix

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

      start(): void {
        super.start();
    
        this.api
          .getNextValidOrderId()
    Severity: Minor
    Found in src/tools/place-order.ts - About 1 hr to fix

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

        private decodeMsg_ERR_MSG(): void {
          const version = this.readInt();
          if (version < 2) {
            const errorMsg = this.readStr();
            this.callback.emitError(errorMsg, -1, -1);
      Severity: Minor
      Found in src/core/io/decoder.ts - About 1 hr to fix

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

          getMarketData(
            contract: Contract,
            genericTickList: string,
            snapshot: boolean,
            regulatorySnapshot: boolean,
        Severity: Minor
        Found in src/api-next/api-next.ts - About 1 hr to fix

          Consider simplifying this complex logical expression.
          Open

                  if (
                    order.scalePriceAdjustValue !== undefined ||
                    order.scalePriceAdjustInterval !== undefined ||
                    order.scaleProfitOffset !== undefined ||
                    order.scaleAutoReset ||
          Severity: Major
          Found in src/core/io/encoder.ts - About 1 hr to fix

            Function runWatchdog has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

              private runWatchdog(): void {
                // verify state
                if (!this.watchdogInterval || this.connectionWatchdogTimeout) {
                  return;
                }
            Severity: Minor
            Found in src/core/api-next/auto-connection.ts - About 55 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

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

              start(): void {
                super.start();
            
                if (!this.cmdLineArgs.conid) {
                  this.error("-conid argument missing.");
            Severity: Minor
            Found in src/tools/historical-ticks-mid.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

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

              private onMessage(data: string): void {
                // tokenize
            
                const dataWithFragment = this.dataFragment + data;
            
            
            Severity: Minor
            Found in src/core/io/socket.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

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

              start(): void {
                super.start();
            
                if (!this.cmdLineArgs.conid) {
                  this.error("-conid argument missing.");
            Severity: Minor
            Found in src/tools/historical-ticks-bid-ask.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

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

              start(): void {
                super.start();
            
                if (!this.cmdLineArgs.conid) {
                  this.error("-conid argument missing.");
            Severity: Minor
            Found in src/tools/historical-ticks-last.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

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

              reqRealTimeBars(
                tickerId: number,
                contract: Contract,
                barSize: number,
                whatToShow: WhatToShow,
            Severity: Minor
            Found in src/core/io/encoder.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

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

              private startAPI(): void {
                // start API
            
                const VERSION = 2;
                if (this.serverVersion >= 3) {
            Severity: Minor
            Found in src/core/io/socket.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

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

              reqScannerSubscription(
                reqId: number,
                subscription: ScannerSubscription,
                scannerSubscriptionOptions: TagValue[],
                scannerSubscriptionFilterOptions?: TagValue[],
            Severity: Minor
            Found in src/core/io/encoder.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

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

              reqWshEventData(reqId: number, wshEventData: WshEventData): void {
                if (this.serverVersion < MIN_SERVER_VER.WSHE_CALENDAR) {
                  return this.emitError(
                    "It does not support WSHE Calendar API.",
                    ErrorCode.UPDATE_TWS,
            Severity: Minor
            Found in src/core/io/encoder.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

            Consider simplifying this complex logical expression.
            Open

                if (
                  this.serverVersion < MIN_SERVER_VER.PEGBEST_PEGMID_OFFSETS &&
                  (order.minTradeQty !== undefined ||
                    order.minCompeteSize !== undefined ||
                    order.competeAgainstBestOffset !== undefined ||
            Severity: Major
            Found in src/core/io/encoder.ts - About 40 mins to fix

              Consider simplifying this complex logical expression.
              Open

                  if (
                    eventName !== EventName.connected &&
                    eventName !== EventName.disconnected &&
                    eventName !== EventName.error &&
                    eventName !== EventName.received &&
              Severity: Major
              Found in src/core/io/controller.ts - About 40 mins to fix

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

                  calculateImpliedVolatility(
                    reqId: number,
                    contract: Contract,
                    optionPrice: number,
                    underPrice: number,
                Severity: Minor
                Found in src/core/io/encoder.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

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

                  send(tokens: unknown[]): void {
                    // flatten arrays and convert boolean types to 0/1
                
                    tokens = this.flattenDeep(tokens);
                    tokens.forEach((value, i) => {
                Severity: Minor
                Found in src/core/io/socket.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

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

                  private decodeMsg_MKT_DEPTH_EXCHANGES(): void {
                    const nDepthMktDataDescriptions = this.readInt();
                    const depthMktDataDescriptions: DepthMktDataDescription[] = new Array(
                      nDepthMktDataDescriptions,
                    );
                Severity: Minor
                Found in src/core/io/decoder.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

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

                  private decodeMsg_PORTFOLIO_VALUE(): void {
                    const version = this.readInt();
                
                    const contract: Contract = {};
                    if (version >= 6) {
                Severity: Minor
                Found in src/core/io/decoder.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