Showing 504 of 504 total issues

File decoder.ts has 2726 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { IneligibilityReason } from "../..";
import { Contract } from "../../api/contract/contract";
import { ContractDescription } from "../../api/contract/contractDescription";
import { ContractDetails } from "../../api/contract/contractDetails";
import { DeltaNeutralContract } from "../../api/contract/deltaNeutralContract";
Severity: Major
Found in src/core/io/decoder.ts - About 1 wk to fix

    File encoder.ts has 2648 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import { MarketDataType, OrderCancel, WhatToShow } from "../..";
    import { ScanCode } from "../../api-next/market-scanner/market-scanner";
    import { Contract } from "../../api/contract/contract";
    import WshEventData from "../../api/contract/wsh";
    import TagValue from "../../api/data/container/tag-value";
    Severity: Major
    Found in src/core/io/encoder.ts - About 1 wk to fix

      File api-next.ts has 2121 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import { lastValueFrom, Observable, Subject } from "rxjs";
      import { map } from "rxjs/operators";
      import {
        Bar,
        BarSizeSetting,
      Severity: Major
      Found in src/api-next/api-next.ts - About 5 days to fix

        Function placeOrder has a Cognitive Complexity of 257 (exceeds 5 allowed). Consider refactoring.
        Open

          placeOrder(id: number, contract: Contract, order: Order): void {
            if (this.serverVersion < MIN_SERVER_VER.SCALE_ORDERS) {
              if (
                order.scaleInitLevelSize !== undefined ||
                order.scalePriceIncrement !== undefined
        Severity: Minor
        Found in src/core/io/encoder.ts - About 5 days 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 placeOrder has 915 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          placeOrder(id: number, contract: Contract, order: Order): void {
            if (this.serverVersion < MIN_SERVER_VER.SCALE_ORDERS) {
              if (
                order.scaleInitLevelSize !== undefined ||
                order.scalePriceIncrement !== undefined
        Severity: Major
        Found in src/core/io/encoder.ts - About 4 days to fix

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

          /*
           * Typescript implementation of the Interactive Brokers TWS (or IB Gateway) API.
           */
          /* eslint @typescript-eslint/no-unsafe-declaration-merging:warn */
          import { EventEmitter } from "eventemitter3";
          Severity: Major
          Found in src/api/api.ts - About 3 days to fix

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

              start(): void {
                super.start();
            
                if (!this.cmdLineArgs.conid) {
                  this.error("-conid argument missing.");
            Severity: Major
            Found in src/tools/historical-ticks-last.ts and 1 other location - About 2 days to fix
            src/tools/historical-ticks-mid.ts on lines 54..97

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

            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

              start(): void {
                super.start();
            
                if (!this.cmdLineArgs.conid) {
                  this.error("-conid argument missing.");
            Severity: Major
            Found in src/tools/historical-ticks-mid.ts and 1 other location - About 2 days to fix
            src/tools/historical-ticks-last.ts on lines 57..102

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

            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

            Decoder has 95 functions (exceeds 20 allowed). Consider refactoring.
            Open

            export class Decoder {
              /**
               * Create an [[Incoming]] object.
               *
               * @param callback A [[DecoderCallbacks]] implementation.
            Severity: Major
            Found in src/core/io/decoder.ts - About 1 day to fix

              IBApiNext has 89 functions (exceeds 20 allowed). Consider refactoring.
              Open

              export class IBApiNext {
                /**
                 * Create an [[IBApiNext]] object.
                 *
                 * @param options Creation options.
              Severity: Major
              Found in src/api-next/api-next.ts - About 1 day to fix

                OrderDecoder has 87 functions (exceeds 20 allowed). Consider refactoring.
                Open

                class OrderDecoder {
                  constructor(
                    private decoder: Decoder,
                    private contract: Contract,
                    private order: Order,
                Severity: Major
                Found in src/core/io/decoder.ts - About 1 day to fix

                  Encoder has 82 functions (exceeds 20 allowed). Consider refactoring.
                  Open

                  export class Encoder {
                    /**
                     * Create an [[Encoder]] object for encoding messages to token data.
                     *
                     * @param callback A [[EncoderCallbacks]] implementation.
                  Severity: Major
                  Found in src/core/io/encoder.ts - About 1 day to fix

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

                      private decodeMsg_HISTORICAL_TICKS_BID_ASK(): void {
                        const reqId = this.readInt();
                        const tickCount = this.readInt();
                        const ticks: HistoricalTickBidAsk[] = new Array(tickCount);
                        for (let i = 0; i < tickCount; i++) {
                    Severity: Major
                    Found in src/core/io/decoder.ts and 1 other location - About 1 day to fix
                    src/core/io/decoder.ts on lines 2449..2475

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

                    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

                      private decodeMsg_HISTORICAL_TICKS_LAST(): void {
                        const reqId = this.readInt();
                        const tickCount = this.readInt();
                        const ticks: HistoricalTickLast[] = new Array(tickCount);
                        for (let i = 0; i < tickCount; i++) {
                    Severity: Major
                    Found in src/core/io/decoder.ts and 1 other location - About 1 day to fix
                    src/core/io/decoder.ts on lines 2418..2444

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

                    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

                    IBApi has 81 functions (exceeds 20 allowed). Consider refactoring.
                    Open

                    export class IBApi extends EventEmitter {
                      /**
                       * Create a IB API object.
                       *
                       * @param options Creation options.
                    Severity: Major
                    Found in src/api/api.ts - About 1 day to fix

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

                        private decodeMsg_REAL_TIME_BARS(): void {
                          this.readInt(); // version
                          const reqId = this.readInt();
                          const time = this.readInt();
                          const open = this.readDouble();
                      Severity: Major
                      Found in src/core/io/decoder.ts and 1 other location - About 7 hrs to fix
                      src/core/io/decoder.ts on lines 1716..1740

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

                      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

                        private decodeMsg_TICK_EFP(): void {
                          this.readInt(); // version
                          const tickerId = this.readInt();
                          const tickType = this.readInt();
                          const basisPoints = this.readDouble();
                      Severity: Major
                      Found in src/core/io/decoder.ts and 1 other location - About 7 hrs to fix
                      src/core/io/decoder.ts on lines 1755..1779

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

                      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

                      class CommissionReportApp extends IBApiNextApp {
                        constructor() {
                          super(DESCRIPTION_TEXT, USAGE_TEXT, OPTION_ARGUMENTS, EXAMPLE_TEXT);
                        }
                        /**
                      Severity: Major
                      Found in src/tools/commission-reports.ts and 1 other location - About 6 hrs to fix
                      src/tools/execution-details.ts on lines 21..51

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

                      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

                      class CloseOrdersApp extends IBApiNextApp {
                        constructor() {
                          super(DESCRIPTION_TEXT, USAGE_TEXT, OPTION_ARGUMENTS, EXAMPLE_TEXT);
                        }
                        /**
                      Severity: Major
                      Found in src/tools/execution-details.ts and 1 other location - About 6 hrs to fix
                      src/tools/commission-reports.ts on lines 21..51

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

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

                        processMsg(msgId: IN_MSG_ID): void {
                          switch (msgId) {
                            case IN_MSG_ID.TICK_PRICE:
                              return this.decodeMsg_TICK_PRICE();
                            case IN_MSG_ID.TICK_SIZE:
                      Severity: Major
                      Found in src/core/io/decoder.ts - About 6 hrs to fix
                        Severity
                        Category
                        Status
                        Source
                        Language