Showing 497 of 497 total issues

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

  reqPositionsMulti(
    reqId: number,
    account: string,
    modelCode: string | null,
  ): void {
Severity: Major
Found in src/core/io/encoder.ts and 1 other location - About 1 hr to fix
src/core/io/encoder.ts on lines 1769..1781

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

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 start has 38 lines of code (exceeds 25 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 1 hr to fix

    Identical blocks of code found in 3 locations. Consider refactoring.
    Open

      constructor(
        public action: OrderAction,
        public auxPrice: number,
        public totalQuantity: number,
        public transmit?: boolean,
    Severity: Major
    Found in src/api/order/stop.ts and 2 other locations - About 1 hr to fix
    src/api/order/stopLimit.ts on lines 9..21
    src/api/order/trailingStop.ts on lines 29..41

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

    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

    Identical blocks of code found in 3 locations. Consider refactoring.
    Open

      constructor(
        public action: OrderAction,
        public totalQuantity: number,
        public auxPrice?: number,
        public trailingPercent?: number,
    Severity: Major
    Found in src/api/order/trailingStop.ts and 2 other locations - About 1 hr to fix
    src/api/order/stop.ts on lines 9..20
    src/api/order/stopLimit.ts on lines 9..21

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

    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

    Identical blocks of code found in 3 locations. Consider refactoring.
    Open

      constructor(
        public action: OrderAction,
        public lmtPrice: number,
        public auxPrice: number,
        public totalQuantity?: boolean,
    Severity: Major
    Found in src/api/order/stopLimit.ts and 2 other locations - About 1 hr to fix
    src/api/order/stop.ts on lines 9..20
    src/api/order/trailingStop.ts on lines 29..41

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

    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 start has 37 lines of code (exceeds 25 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 1 hr to fix

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

          if (this.serverVersion >= MIN_SERVER_VER.WSH_EVENT_DATA_FILTERS_DATE) {
            tokens.push(wshEventData.startDate);
            tokens.push(wshEventData.endDate);
            tokens.push(wshEventData.totalLimit);
          }
      Severity: Major
      Found in src/core/io/encoder.ts and 1 other location - About 1 hr to fix
      src/core/io/encoder.ts on lines 1485..1489

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

      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

          if (this.serverVersion >= MIN_SERVER_VER.SCALE_TABLE) {
            tokens.push(order.scaleTable);
            tokens.push(order.activeStartTime);
            tokens.push(order.activeStopTime);
          }
      Severity: Major
      Found in src/core/io/encoder.ts and 1 other location - About 1 hr to fix
      src/core/io/encoder.ts on lines 3315..3319

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

      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 readComboLegs has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

        readComboLegs(): void {
          if (this.version >= 14) {
            this.contract.comboLegsDescription = this.decoder.readStr();
          }
      
      
      Severity: Minor
      Found in src/core/io/decoder.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 decodeMsg_ERR_MSG has a Cognitive Complexity of 12 (exceeds 5 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

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

        start(): void {
          super.start();
      
          if (!this.cmdLineArgs.conid) {
            this.error("-conid argument missing.");
      Severity: Minor
      Found in src/tools/histogram-data.ts - About 1 hr to fix

        Function start has 35 lines of code (exceeds 25 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 1 hr to fix

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

              if (this.serverVersion < MIN_SERVER_VER.TRADING_CLASS) {
                if (!!contract.tradingClass || contract.conId != undefined) {
                  return this.emitError(
                    "It does not support conId and tradingClass parameters in reqHistoricalData.",
                    ErrorCode.UPDATE_TWS,
          Severity: Major
          Found in src/core/io/encoder.ts and 3 other locations - About 1 hr to fix
          src/core/io/encoder.ts on lines 626..634
          src/core/io/encoder.ts on lines 2585..2593
          src/core/io/encoder.ts on lines 2760..2768

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

          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 4 locations. Consider refactoring.
          Open

              if (this.serverVersion < MIN_SERVER_VER.TRADING_CLASS) {
                if (!!contract.tradingClass || contract.conId != undefined) {
                  return this.emitError(
                    "It does not support conId and tradingClass parameters in reqRealTimeBars.",
                    ErrorCode.UPDATE_TWS,
          Severity: Major
          Found in src/core/io/encoder.ts and 3 other locations - About 1 hr to fix
          src/core/io/encoder.ts on lines 626..634
          src/core/io/encoder.ts on lines 2186..2194
          src/core/io/encoder.ts on lines 2585..2593

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

          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 4 locations. Consider refactoring.
          Open

              if (this.serverVersion < MIN_SERVER_VER.TRADING_CLASS) {
                if (!!contract.tradingClass || contract.conId != undefined) {
                  return this.emitError(
                    "It does not support conId and tradingClass parameters in reqMktDepth.",
                    ErrorCode.UPDATE_TWS,
          Severity: Major
          Found in src/core/io/encoder.ts and 3 other locations - About 1 hr to fix
          src/core/io/encoder.ts on lines 626..634
          src/core/io/encoder.ts on lines 2186..2194
          src/core/io/encoder.ts on lines 2760..2768

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

          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 4 locations. Consider refactoring.
          Open

              if (this.serverVersion < MIN_SERVER_VER.TRADING_CLASS) {
                if (!!contract.tradingClass || contract.conId != undefined) {
                  return this.emitError(
                    "It does not support conId and tradingClass parameters in exerciseOptions.",
                    ErrorCode.UPDATE_TWS,
          Severity: Major
          Found in src/core/io/encoder.ts and 3 other locations - About 1 hr to fix
          src/core/io/encoder.ts on lines 2186..2194
          src/core/io/encoder.ts on lines 2585..2593
          src/core/io/encoder.ts on lines 2760..2768

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

          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

              if (this.serverVersion < MIN_SERVER_VER.SEC_ID_TYPE) {
                if (!!contract.secIdType || !!contract.secId) {
                  return this.emitError(
                    "It does not support secIdType and secId parameters.",
                    ErrorCode.UPDATE_TWS,
          Severity: Major
          Found in src/core/io/encoder.ts and 1 other location - About 1 hr to fix
          src/core/io/encoder.ts on lines 1943..1951

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

          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

              if (this.serverVersion < MIN_SERVER_VER.SEC_ID_TYPE) {
                if (!!contract.secIdType || !!contract.secId) {
                  return this.emitError(
                    "It does not support secIdType and secId parameters.",
                    ErrorCode.UPDATE_TWS,
          Severity: Major
          Found in src/core/io/encoder.ts and 1 other location - About 1 hr to fix
          src/core/io/encoder.ts on lines 786..794

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

          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 connect has 34 lines of code (exceeds 25 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 1 hr to fix

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

                  if (smartComboRoutingParamsCount > 0) {
                    order.smartComboRoutingParams?.forEach((param) => {
                      tokens.push(param.tag);
                      tokens.push(param.value);
                    });
            Severity: Major
            Found in src/core/io/encoder.ts and 1 other location - About 1 hr to fix
            src/core/io/encoder.ts on lines 1529..1534

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

            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

            Severity
            Category
            Status
            Source
            Language