QuickBlox/quickblox-javascript-sdk

View on GitHub

Showing 143 of 4,295 total issues

Function ChatProxy has a Cognitive Complexity of 268 (exceeds 5 allowed). Consider refactoring.
Open

function ChatProxy(service) {
    var self = this;
    var originSendFunction;

    self.webrtcSignalingProcessor = null;
Severity: Minor
Found in src/modules/chat/qbChat.js - About 5 days 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

File qbChat.js has 1779 lines of code (exceeds 250 allowed). Consider refactoring.
Open

'use strict';

/** JSHint inline rules */
/* globals Strophe, $pres, $msg, $iq */

Severity: Major
Found in src/modules/chat/qbChat.js - About 4 days to fix

    File qbWebRTCSession.js has 887 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    'use strict';
    
    /**
     * QuickBlox JavaScript SDK
     * WebRTC Module (WebRTC session model)
    Severity: Major
    Found in src/modules/webrtc/qbWebRTCSession.js - About 2 days to fix

      File quickblox.d.ts has 819 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      type Dictionary<T> = Record<string, T>;
      
      type RequiredProps<T, K extends keyof T> = T & Required<Pick<T, K>>;
      
      declare enum QBChatProtocol {
      Severity: Major
      Found in quickblox.d.ts - About 1 day to fix

        Function ChatProxy has 387 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function ChatProxy(service) {
            var self = this;
            var originSendFunction;
        
            self.webrtcSignalingProcessor = null;
        Severity: Major
        Found in src/modules/chat/qbChat.js - About 1 day to fix

          File qbRTCPeerConnection.js has 578 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          'use strict';
          
          /**
           * QuickBlox JavaScript SDK
           * WebRTC Module (WebRTC peer connection model)
          Severity: Major
          Found in src/modules/webrtc/qbRTCPeerConnection.js - About 1 day to fix

            Function parseExtraParams has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring.
            Open

                parseExtraParams: function(extraParams) {
                    var self = this;
            
                    if (!extraParams) {
                        return null;
            Severity: Minor
            Found in src/modules/chat/qbChatHelpers.js - About 1 day 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 ajax has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
            Open

                ajax: function(params, callback) {
            
                    if (this._fetchingSettings) {
                        this._queue.push([params, callback]);
                        return;
            Severity: Minor
            Found in src/qbProxy.js - About 1 day 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 connect has 197 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                connect: function (params, callback) {
                    /**
                     * This callback Returns error or contact list.
                     * @callback chatConnectCallback
                     * @param {Object} error - The error object
            Severity: Major
            Found in src/modules/chat/qbChat.js - About 7 hrs to fix

              Function ajax has 148 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  ajax: function(params, callback) {
              
                      if (this._fetchingSettings) {
                          this._queue.push([params, callback]);
                          return;
              Severity: Major
              Found in src/qbProxy.js - About 5 hrs to fix

                Function _onPresence has 139 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    this._onPresence = function (stanza) {
                        var from = chatUtils.getAttr(stanza, 'from'),
                            to = chatUtils.getAttr(stanza, 'to'),
                            id = chatUtils.getAttr(stanza, 'id'),
                            type = chatUtils.getAttr(stanza, 'type'),
                Severity: Major
                Found in src/modules/chat/qbChat.js - About 5 hrs to fix

                  Function create has 123 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      create: function (list, callback) {
                          /**
                           * Callback for QB.chat.privacylist.create().
                           * @param {Object} error - The error object
                           * @callback createPrivacylistCallback
                  Severity: Major
                  Found in src/modules/chat/qbChat.js - About 4 hrs to fix

                    Consider simplifying this complex logical expression.
                    Open

                                if (error || (statusCode !== 200 && statusCode !== 201 && statusCode !== 202)) {
                                    var errorMsg;
                    
                                    try {
                                        errorMsg = {
                    Severity: Critical
                    Found in src/qbProxy.js - About 4 hrs to fix

                      Function WebRTCSignalingProcessor has 108 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function WebRTCSignalingProcessor(service, delegate) {
                          var self = this;
                      
                          self.service = service;
                          self.delegate = delegate;
                      Severity: Major
                      Found in src/modules/webrtc/qbWebRTCSignalingProcessor.js - About 4 hrs to fix

                        Function _getStats has 99 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        function _getStats(peer, lastResults, successCallback, errorCallback) {
                            var statistic = {
                                'local': {
                                    'audio': {},
                                    'video': {},
                        Severity: Major
                        Found in src/modules/webrtc/qbRTCPeerConnection.js - About 3 hrs to fix

                          Function WebRTCSignalingProcessor has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
                          Open

                          function WebRTCSignalingProcessor(service, delegate) {
                              var self = this;
                          
                              self.service = service;
                              self.delegate = delegate;
                          Severity: Minor
                          Found in src/modules/webrtc/qbWebRTCSignalingProcessor.js - About 3 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 findLineInRange has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
                          Open

                          function findLineInRange(
                            sdpLines,
                            startLine,
                            endLine,
                            prefix,
                          Severity: Minor
                          Found in src/modules/webrtc/qbRTCPeerConnection.js - About 3 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 QBLog has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
                          Open

                              QBLog: function(){
                                  if (this.loggers) {
                                      for (var i=0; i<this.loggers.length; ++i) {
                                          this.loggers[i](arguments);
                                      }
                          Severity: Minor
                          Found in src/qbUtils.js - About 3 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 init has 82 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              init: function(appIdOrToken, authKeyOrAppId, authSecret, accountKey, configMap) {
                                  console.log('current platform: ', Utils.getEnv());
                                  if (typeof accountKey === 'string' && accountKey.length) {
                                      if (configMap && typeof configMap === 'object') {
                                          config.set(configMap);
                          Severity: Major
                          Found in src/qbMain.js - About 3 hrs to fix

                            Function _onMessage has 79 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                this._onMessage = function (stanza) {
                                    var from = chatUtils.getAttr(stanza, 'from'),
                                        to = chatUtils.getAttr(stanza, 'to'),
                                        type = chatUtils.getAttr(stanza, 'type'),
                                        messageId = chatUtils.getAttr(stanza, 'id'),
                            Severity: Major
                            Found in src/modules/chat/qbChat.js - About 3 hrs to fix
                              Severity
                              Category
                              Status
                              Source
                              Language