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;
- Read upRead up
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;
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;
Function frameAndSend
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Sender.prototype.frameAndSend = function(opcode, data, f, m, c, cb) {
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');
}
- Read upRead up
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;
- Read upRead up
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"