Function _waitSend
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
WebRTCTransportProvider.prototype._waitSend = function(tag, buffers) {
var bufferBound = 0, // upper bound on the # of bytes buffered
sendBuffers, checkBufferedAmount;
sendBuffers = function() {
- Create a ticketCreate a ticket
Function send
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
WebRTCTransportProvider.prototype.send = function(tag, data, continuation) {
// console.log("TransportProvider.send." + this.name);
if(!this._setup) {
continuation(undefined, {
"errcode": "NOTREADY",
- Create a ticketCreate a ticket
Function _handleData
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
WebRTCTransportProvider.prototype._handleData = function(tag, buffer) {
var currentTag;
if (tag in this._chunks) {
currentTag = this._chunks[tag];
currentTag.buffers.push(buffer);
- Create a ticketCreate a ticket
Function send
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
WebRTCTransportProvider.prototype.send = function(tag, data, continuation) {
// console.log("TransportProvider.send." + this.name);
if(!this._setup) {
continuation(undefined, {
"errcode": "NOTREADY",
- Read upRead up
- Create a ticketCreate a ticket
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 onData
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
WebRTCTransportProvider.prototype.onData = function(msg) {
//console.log("TransportProvider.prototype.message: Got Message:" + JSON.stringify(msg));
if (msg.buffer) {
this._handleData(msg.channelLabel, msg.buffer);
} else if (msg.binary) {
- Read upRead up
- Create a ticketCreate a ticket
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 _handleData
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
WebRTCTransportProvider.prototype._handleData = function(tag, buffer) {
var currentTag;
if (tag in this._chunks) {
currentTag = this._chunks[tag];
currentTag.buffers.push(buffer);
- Read upRead up
- Create a ticketCreate a ticket
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"