Showing 497 of 497 total issues

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

        for (let i = 0; i < secIdListCount; ++i) {
          const tagValue: TagValue = {
            tag: this.readStr(),
            value: this.readStr(),
          };
Severity: Major
Found in src/core/io/decoder.ts and 1 other location - About 1 hr to fix
src/core/io/decoder.ts on lines 1473..1479

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

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

  readConditions(): void {
    if (this.serverVersion >= MIN_SERVER_VER.PEGGED_TO_BENCHMARK) {
      const nConditions = this.decoder.readInt();

      if (nConditions > 0) {
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 readAlgoParams has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  readAlgoParams(): void {
    if (this.version >= 21) {
      this.order.algoStrategy = this.decoder.readStr();
      if (this.order.algoStrategy && this.order.algoStrategy !== "") {
        const algoParamsCount = this.decoder.readInt();
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_POSITION_MULTI has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  private decodeMsg_POSITION_MULTI(): void {
    this.readInt(); // version
    const reqId = this.readInt();
    const account = this.readStr();
    const contract: Contract = {};
Severity: Minor
Found in src/core/io/decoder.ts - About 1 hr to fix

    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

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

                reqMktDepthExchanges(): IBApi {
                  this.controller.schedule(() =>
                    this.controller.encoder.reqMktDepthExchanges(),
                  );
                  return this;
              Severity: Major
              Found in src/api/api.ts and 11 other locations - About 55 mins to fix
              src/api/api.ts on lines 361..366
              src/api/api.ts on lines 417..420
              src/api/api.ts on lines 685..688
              src/api/api.ts on lines 796..799
              src/api/api.ts on lines 821..824
              src/api/api.ts on lines 861..864
              src/api/api.ts on lines 1085..1088
              src/api/api.ts on lines 1283..1286
              src/api/api.ts on lines 1292..1295
              src/api/api.ts on lines 1338..1341
              src/api/api.ts on lines 1415..1420

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

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

                cancelNewsBulletins(): IBApi {
                  this.controller.schedule(() =>
                    this.controller.encoder.cancelNewsBulletins(),
                  );
                  return this;
              Severity: Major
              Found in src/api/api.ts and 11 other locations - About 55 mins to fix
              src/api/api.ts on lines 417..420
              src/api/api.ts on lines 685..688
              src/api/api.ts on lines 796..799
              src/api/api.ts on lines 821..824
              src/api/api.ts on lines 861..864
              src/api/api.ts on lines 1085..1088
              src/api/api.ts on lines 1234..1239
              src/api/api.ts on lines 1283..1286
              src/api/api.ts on lines 1292..1295
              src/api/api.ts on lines 1338..1341
              src/api/api.ts on lines 1415..1420

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

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

                reqCurrentTime(): IBApi {
                  this.controller.schedule(() => this.controller.encoder.reqCurrentTime());
                  return this;
                }
              Severity: Major
              Found in src/api/api.ts and 11 other locations - About 55 mins to fix
              src/api/api.ts on lines 361..366
              src/api/api.ts on lines 417..420
              src/api/api.ts on lines 685..688
              src/api/api.ts on lines 821..824
              src/api/api.ts on lines 861..864
              src/api/api.ts on lines 1085..1088
              src/api/api.ts on lines 1234..1239
              src/api/api.ts on lines 1283..1286
              src/api/api.ts on lines 1292..1295
              src/api/api.ts on lines 1338..1341
              src/api/api.ts on lines 1415..1420

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

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

                reqAllOpenOrders(): IBApi {
                  this.controller.schedule(() => this.controller.encoder.reqAllOpenOrders());
                  return this;
                }
              Severity: Major
              Found in src/api/api.ts and 11 other locations - About 55 mins to fix
              src/api/api.ts on lines 361..366
              src/api/api.ts on lines 417..420
              src/api/api.ts on lines 796..799
              src/api/api.ts on lines 821..824
              src/api/api.ts on lines 861..864
              src/api/api.ts on lines 1085..1088
              src/api/api.ts on lines 1234..1239
              src/api/api.ts on lines 1283..1286
              src/api/api.ts on lines 1292..1295
              src/api/api.ts on lines 1338..1341
              src/api/api.ts on lines 1415..1420

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

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

                reqOpenOrders(): IBApi {
                  this.controller.schedule(() => this.controller.encoder.reqOpenOrders());
                  return this;
                }
              Severity: Major
              Found in src/api/api.ts and 11 other locations - About 55 mins to fix
              src/api/api.ts on lines 361..366
              src/api/api.ts on lines 417..420
              src/api/api.ts on lines 685..688
              src/api/api.ts on lines 796..799
              src/api/api.ts on lines 821..824
              src/api/api.ts on lines 861..864
              src/api/api.ts on lines 1085..1088
              src/api/api.ts on lines 1234..1239
              src/api/api.ts on lines 1283..1286
              src/api/api.ts on lines 1338..1341
              src/api/api.ts on lines 1415..1420

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

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

                cancelPositions(): IBApi {
                  this.controller.schedule(() => this.controller.encoder.cancelPositions());
                  return this;
                }
              Severity: Major
              Found in src/api/api.ts and 11 other locations - About 55 mins to fix
              src/api/api.ts on lines 361..366
              src/api/api.ts on lines 685..688
              src/api/api.ts on lines 796..799
              src/api/api.ts on lines 821..824
              src/api/api.ts on lines 861..864
              src/api/api.ts on lines 1085..1088
              src/api/api.ts on lines 1234..1239
              src/api/api.ts on lines 1283..1286
              src/api/api.ts on lines 1292..1295
              src/api/api.ts on lines 1338..1341
              src/api/api.ts on lines 1415..1420

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

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

                reqGlobalCancel(): IBApi {
                  this.controller.schedule(() => this.controller.encoder.reqGlobalCancel());
                  return this;
                }
              Severity: Major
              Found in src/api/api.ts and 11 other locations - About 55 mins to fix
              src/api/api.ts on lines 361..366
              src/api/api.ts on lines 417..420
              src/api/api.ts on lines 685..688
              src/api/api.ts on lines 796..799
              src/api/api.ts on lines 821..824
              src/api/api.ts on lines 1085..1088
              src/api/api.ts on lines 1234..1239
              src/api/api.ts on lines 1283..1286
              src/api/api.ts on lines 1292..1295
              src/api/api.ts on lines 1338..1341
              src/api/api.ts on lines 1415..1420

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

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

                reqCancelWshMetaData(reqId: number) {
                  this.controller.schedule(() =>
                    this.controller.encoder.reqCancelWshMetaData(reqId),
                  );
                  return this;
              Severity: Major
              Found in src/api/api.ts and 2 other locations - About 55 mins to fix
              src/api/api.ts on lines 724..729
              src/api/api.ts on lines 767..772

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

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

                reqManagedAccts(): IBApi {
                  this.controller.schedule(() => this.controller.encoder.reqManagedAccts());
                  return this;
                }
              Severity: Major
              Found in src/api/api.ts and 11 other locations - About 55 mins to fix
              src/api/api.ts on lines 361..366
              src/api/api.ts on lines 417..420
              src/api/api.ts on lines 685..688
              src/api/api.ts on lines 796..799
              src/api/api.ts on lines 821..824
              src/api/api.ts on lines 861..864
              src/api/api.ts on lines 1234..1239
              src/api/api.ts on lines 1283..1286
              src/api/api.ts on lines 1292..1295
              src/api/api.ts on lines 1338..1341
              src/api/api.ts on lines 1415..1420

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

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

                reqNewsProviders(): IBApi {
                  this.controller.schedule(() => this.controller.encoder.reqNewsProviders());
                  return this;
                }
              Severity: Major
              Found in src/api/api.ts and 11 other locations - About 55 mins to fix
              src/api/api.ts on lines 361..366
              src/api/api.ts on lines 417..420
              src/api/api.ts on lines 685..688
              src/api/api.ts on lines 796..799
              src/api/api.ts on lines 821..824
              src/api/api.ts on lines 861..864
              src/api/api.ts on lines 1085..1088
              src/api/api.ts on lines 1234..1239
              src/api/api.ts on lines 1292..1295
              src/api/api.ts on lines 1338..1341
              src/api/api.ts on lines 1415..1420

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

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

                reqScannerParameters(): IBApi {
                  this.controller.schedule(() =>
                    this.controller.encoder.reqScannerParameters(),
                  );
                  return this;
              Severity: Major
              Found in src/api/api.ts and 11 other locations - About 55 mins to fix
              src/api/api.ts on lines 361..366
              src/api/api.ts on lines 417..420
              src/api/api.ts on lines 685..688
              src/api/api.ts on lines 796..799
              src/api/api.ts on lines 821..824
              src/api/api.ts on lines 861..864
              src/api/api.ts on lines 1085..1088
              src/api/api.ts on lines 1234..1239
              src/api/api.ts on lines 1283..1286
              src/api/api.ts on lines 1292..1295
              src/api/api.ts on lines 1338..1341

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

              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