Function _addEnableHandlers
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
StreamManagement.prototype._addEnableHandlers = function () {
var self = this;
if (Utils.getEnv().browser) {
self._c.XAddTrackedHandler(_incomingStanzaHandler.bind(self));
- 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 _addEnableHandlers
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
StreamManagement.prototype._addEnableHandlers = function () {
var self = this;
if (Utils.getEnv().browser) {
self._c.XAddTrackedHandler(_incomingStanzaHandler.bind(self));
Function _incomingStanzaHandler
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
function _incomingStanzaHandler (stanza){
/*
* Getting incoming stanza tagName
* */
Function send
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
StreamManagement.prototype.send = function (stanza, message) {
var self = this,
stanzaXML = stanza.nodeTree ? this._parser.parseFromString(stanza.nodeTree.outerHTML, "application/xml").childNodes[0] : stanza,
tagName = stanzaXML.name || stanzaXML.tagName || stanzaXML.nodeTree.tagName,
type = chatUtils.getAttr(stanzaXML, 'type'),
- 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 _timeoutCallback
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
StreamManagement.prototype._timeoutCallback = function () {
var self = this,
now = Date.now(),
updatedStanzasQueue = [];
- 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 _checkCounterOnIncomeStanza
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
StreamManagement.prototype._checkCounterOnIncomeStanza = function (count){
var updatedStanzasQueue = [];
if(this._stanzasQueue.length){
for(var i = 0; i < this._stanzasQueue.length; i++){
- 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 _sendStanzasRequest
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
StreamManagement.prototype._sendStanzasRequest = function (data) {
var self = this;
if(self._isStreamManagementEnabled){
self._stanzasQueue.push(data);
- 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"