GillesRasigade/pattern

View on GitHub

Showing 8 of 46 total issues

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

  reconnect() {
    const self = this;
    const ws = this.ws;

    self._attempts = 0;
Severity: Minor
Found in src/Queue/QueueWebSocket.js - About 2 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function main has 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function* main() {
  // let { mapper, commandEmitter, commandHandler, stateEmitter, stateHandler } =
  yield before();

  const user = {};
Severity: Minor
Found in doc/examples/cqrs/index.js - About 1 hr to fix

    Function reconnect has 36 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      reconnect() {
        const self = this;
        const ws = this.ws;
    
        self._attempts = 0;
    Severity: Minor
    Found in src/Queue/QueueWebSocket.js - About 1 hr to fix

      Function reconnect has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          const cb = co.wrap(function* reconnect() {
            if (self._attempts >= self.WEBSOCKET_RECONNECT_MAX_ATTEMPTS) {
              return false;
            }
      
      
      Severity: Minor
      Found in src/Queue/QueueWebSocket.js - About 1 hr to fix

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

          onMessage(message, flags = {}) {
            if (flags.binary) {
              throw new Error('Binary flag not yet supported =)');
            } else {
              const data = JSON.parse(message);
        Severity: Minor
        Found in src/Queue/QueueWebSocket.js - 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 replay has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

          replay() {
            const self = this;
            return co(function* replay() {
              self._replaying = true;
        
        
        Severity: Minor
        Found in src/EventSourcing/EventSourcing.js - 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 _defineGettersSetters has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          static _defineGettersSetters(constructor) {
            const schema = constructor.SCHEMA;
            if (schema && schema.properties) {
               // eslint-disable-next-line no-restricted-syntax
              for (const key in schema.properties) {
        Severity: Minor
        Found in src/Entity/Entity.js - 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 close has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          close(callback) {
            if (this.ws) {
              if (this._supervisor) {
                this._supervisor.removeAllListeners();
                this._supervisor.close(1000, '');
        Severity: Minor
        Found in src/Queue/QueueWebSocket.js - 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