pristineio/wsd

View on GitHub
lib/Sender.js

Summary

Maintainability
C
1 day
Test Coverage

Function frameAndSend has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
Open

Sender.prototype.frameAndSend = function(opcode, data, f, m, c, cb) {
  var finalFragment = f;
  var maskData = m;
  var compressed = c;
  var canModifyData = false;
Severity: Minor
Found in lib/Sender.js - About 5 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 frameAndSend has 87 lines of code (exceeds 25 allowed). Consider refactoring.
Open

Sender.prototype.frameAndSend = function(opcode, data, f, m, c, cb) {
  var finalFragment = f;
  var maskData = m;
  var compressed = c;
  var canModifyData = false;
Severity: Major
Found in lib/Sender.js - About 3 hrs to fix

    Function send has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    Sender.prototype.send = function(data, options, cb) {
      var finalFragment = options && options.fin === false ? false : true;
      var mask = options && options.mask;
      var compress = options && options.compress;
      var opcode = options && options.binary ? 2 : 1;
    Severity: Minor
    Found in lib/Sender.js - About 1 hr to fix

      Function frameAndSend has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      Sender.prototype.frameAndSend = function(opcode, data, f, m, c, cb) {
      Severity: Minor
      Found in lib/Sender.js - About 45 mins to fix

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

        Sender.prototype.close = function(code, data, mask, cb) {
          if(code) {
            if(typeof code !== 'number' || !(code in ErrorCodes)) {
              throw new Error('first argument must be a valid error code number');
            }
        Severity: Minor
        Found in lib/Sender.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

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

        Sender.prototype.send = function(data, options, cb) {
          var finalFragment = options && options.fin === false ? false : true;
          var mask = options && options.mask;
          var compress = options && options.compress;
          var opcode = options && options.binary ? 2 : 1;
        Severity: Minor
        Found in lib/Sender.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

        There are no issues that match your filters.

        Category
        Status