QuickBlox/quickblox-javascript-sdk

View on GitHub
src/plugins/streamManagement.js

Summary

Maintainability
C
7 hrs
Test Coverage

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));
Severity: Minor
Found in src/plugins/streamManagement.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 _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));
Severity: Minor
Found in src/plugins/streamManagement.js - About 1 hr to fix

    Function _incomingStanzaHandler has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function _incomingStanzaHandler (stanza){
            /*
            * Getting incoming stanza tagName
            * */
    
    
    Severity: Minor
    Found in src/plugins/streamManagement.js - About 1 hr to fix

      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'),
      Severity: Minor
      Found in src/plugins/streamManagement.js - About 45 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 _timeoutCallback has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      StreamManagement.prototype._timeoutCallback = function () {
          var self = this,
              now = Date.now(),
              updatedStanzasQueue = [];
      
      
      Severity: Minor
      Found in src/plugins/streamManagement.js - About 45 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 _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++){
      Severity: Minor
      Found in src/plugins/streamManagement.js - About 35 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 _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);
      Severity: Minor
      Found in src/plugins/streamManagement.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