samcday/node-fastcgi-stream

View on GitHub

Showing 7 of 18 total issues

Function exports has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

var FastCGIStream = module.exports = function(stream) {
  var that = this;
  var bufferList = new BufferList();

  // These variables are used for an incoming record.
Severity: Minor
Found in lib/stream.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 exports has 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var FastCGIStream = module.exports = function(stream) {
  var that = this;
  var bufferList = new BufferList();

  // These variables are used for an incoming record.
Severity: Major
Found in lib/stream.js - About 2 hrs to fix

    Function StdErr has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

    var StdErr = module.exports = function StdErr(data) {
      this.data = data || '';
    
      this.getSize = function() {
        return Buffer.isBuffer(this.data) ? this.data.length : Buffer.byteLength(this.data);
    Severity: Minor
    Found in lib/records/stderr.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 StdIn has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

    var StdIn = module.exports = function StdIn(data) {
      this.data = data || '';
    
      this.getSize = function() {
        return Buffer.isBuffer(this.data) ? this.data.length : Buffer.byteLength(this.data);
    Severity: Minor
    Found in lib/records/stdin.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 StdOut has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

    var StdOut = module.exports = function StdOut(data) {
      this.data = data || '';
    
      this.getSize = function() {
        return Buffer.isBuffer(this.data) ? this.data.length : Buffer.byteLength(this.data);
    Severity: Minor
    Found in lib/records/stdout.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 Data has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

    var Data = module.exports = function Data(data) {
      this.data = data || '';
    
      this.getSize = function() {
        return Buffer.isBuffer(this.data) ? this.data.length : Buffer.byteLength(this.data);
    Severity: Minor
    Found in lib/records/data.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 processIncomingData has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      var processIncomingData = function() {
        // There are two different states we can be in.
    
        while(bufferList.length) {
          // We don't have shit, and we're waiting for a record header.
    Severity: Minor
    Found in lib/stream.js - About 1 hr to fix
      Severity
      Category
      Status
      Source
      Language