ikeisuke/node-easy-concurrent-stream

View on GitHub

Showing 8 of 14 total issues

Function _read has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
Open

ConcurrentTransform.prototype._read = function(n) {
  const ts = this._transformState;
  const backlog = ts.backlog;
  if (backlog) {
    ts.backlog = null;
Severity: Minor
Found in lib/transform.js - About 4 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 _read has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

ConcurrentTransform.prototype._read = function(n) {
  const ts = this._transformState;
  const backlog = ts.backlog;
  if (backlog) {
    ts.backlog = null;
Severity: Minor
Found in lib/transform.js - About 1 hr to fix

    Avoid deeply nested control flow statements.
    Open

              if (k.charAt(0) === '_') continue;
    Severity: Major
    Found in lib/transform.js - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                if (!this.hasOwnProperty(k)) continue;
      Severity: Major
      Found in lib/transform.js - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                  if (typeof this[k] === "function") continue;
        Severity: Major
        Found in lib/transform.js - About 45 mins to fix

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

          function afterTransform(stream, err, data) {
            const ts = stream._transformState;
            ts.transforming--;
          
            const context = ts.context;
          Severity: Minor
          Found in lib/transform.js - 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

          Avoid deeply nested control flow statements.
          Open

                    if (defaultProperties.some((key)=>{ return key === k })) continue;
          Severity: Major
          Found in lib/transform.js - About 45 mins to fix

            Function ConcurrentTransform has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            function ConcurrentTransform(options) {
              if (!(this instanceof ConcurrentTransform)) {
                return new ConcurrentTransform(options);
              }
            
            
            Severity: Minor
            Found in lib/transform.js - About 25 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