nfroidure/streamfilter

View on GitHub

Showing 13 of 13 total issues

Function StreamFilter has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

function StreamFilter(filterCallback, options) {
  const _this = this;

  // Ensure new is called
  if (!(this instanceof StreamFilter)) {
Severity: Minor
Found in src/index.js - About 3 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 StreamFilter has 66 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function StreamFilter(filterCallback, options) {
  const _this = this;

  // Ensure new is called
  if (!(this instanceof StreamFilter)) {
Severity: Major
Found in src/index.js - About 2 hrs to fix

    Function createReadStreamBackpressureManager has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function createReadStreamBackpressureManager(readableStream) {
      const manager = {
        waitPush: true,
        programmedPushs: [],
        programPush: function programPush(chunk, encoding, done) {
    Severity: Minor
    Found in src/index.js - About 1 hr to fix

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

      function createReadStreamBackpressureManager(readableStream) {
        const manager = {
          waitPush: true,
          programmedPushs: [],
          programPush: function programPush(chunk, encoding, done) {
      Severity: Minor
      Found in src/index.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

      Replace 'use·strict' with "use·strict"
      Open

      'use strict';
      Severity: Minor
      Found in src/index.js by eslint

      For more information visit Source: http://eslint.org/docs/rules/

      Replace 'readable' with "readable"
      Open

                readableStream.emit('readable');
      Severity: Minor
      Found in src/index.js by eslint

      For more information visit Source: http://eslint.org/docs/rules/

      Replace 'readable' with "readable"
      Open

            readableStream.emit('readable');
      Severity: Minor
      Found in src/index.js by eslint

      For more information visit Source: http://eslint.org/docs/rules/

      Replace 'filterCallback·must·be·a·function.' with "filterCallback·must·be·a·function."
      Open

          throw new Error('filterCallback must be a function.');
      Severity: Minor
      Found in src/index.js by eslint

      For more information visit Source: http://eslint.org/docs/rules/

      Replace 'util' with "util"
      Open

      const util = require('util');
      Severity: Minor
      Found in src/index.js by eslint

      For more information visit Source: http://eslint.org/docs/rules/

      Replace 'drain' with "drain"
      Open

            readableStream.emit('drain');
      Severity: Minor
      Found in src/index.js by eslint

      For more information visit Source: http://eslint.org/docs/rules/

      Replace 'finish' with "finish"
      Open

            this.restore.on('finish', function streamFilterRestoreFinish() {
      Severity: Minor
      Found in src/index.js by eslint

      For more information visit Source: http://eslint.org/docs/rules/

      Replace 'readable-stream' with "readable-stream"
      Open

      const stream = require('readable-stream');
      Severity: Minor
      Found in src/index.js by eslint

      For more information visit Source: http://eslint.org/docs/rules/

      Delete ,
      Open

          },
      Severity: Minor
      Found in src/index.js by eslint

      For more information visit Source: http://eslint.org/docs/rules/

      Severity
      Category
      Status
      Source
      Language