QuickBlox/quickblox-javascript-sdk

View on GitHub

Showing 4,301 of 4,301 total issues

Function _onCallListener has 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

WebRTCClient.prototype._onCallListener = function(userID, sessionID, extension) {
    var userInfo = extension.userInfo || {};

    var currentUserID = Helpers.getIdFromNode(this.chat.connection.jid);
    if (userID === currentUserID && !extension.opponentsIDs.includes(currentUserID)) {
Severity: Minor
Found in src/modules/webrtc/qbWebRTCClient.js - About 1 hr to fix

    Function send has 44 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        send: function (jid_or_user_id, message) {
            Utils.QBLog('[QBChat]', 'Call send ' + JSON.stringify(message));
            var self = this,
                builder = Utils.getEnv().browser ? $msg : XMPP.Stanza;
    
    
    Severity: Minor
    Found in src/modules/chat/qbChat.js - About 1 hr to fix

      Function delete has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

          delete: function(className, requestedData, callback) {
              /**
               * Callback for QB.data.delete(className, requestedData, callback).
               * @callback deletedDataCallback
               * @param {object} error - The error object.
      Severity: Minor
      Found in src/modules/qbData.js - About 1 hr 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 send has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

          send: function (jid_or_user_id, message) {
              Utils.QBLog('[QBChat]', 'Call send ' + JSON.stringify(message));
              var self = this,
                  builder = Utils.getEnv().browser ? $msg : XMPP.Stanza;
      
      
      Severity: Minor
      Found in src/modules/chat/qbChat.js - About 1 hr 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 injectISOTimes has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

          injectISOTimes: function(data) {
              if (data.created_at) {
                  if (typeof data.created_at === 'number') data.iso_created_at = new Date(data.created_at * 1000).toISOString();
                  if (typeof data.updated_at === 'number') data.iso_updated_at = new Date(data.updated_at * 1000).toISOString();
              }
      Severity: Minor
      Found in src/qbUtils.js - About 1 hr 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 ping has 43 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          ping: function (jid_or_user_id, callback) {
              Utils.QBLog('[QBChat]', 'Call ping ');
              var self = this;
              var id = this.helpers.getUniqueId('ping');
              var builder = Utils.getEnv().browser ? $iq : XMPP.Stanza;
      Severity: Minor
      Found in src/modules/chat/qbChat.js - About 1 hr to fix

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

                case 'completed':
                    if (this._reconnecting) {
                        this.delegate._stopReconnectTimer(this.userID);
                    }
                    this.state = qbRTCPeerConnection.State.COMPLETED;
        Severity: Major
        Found in src/modules/webrtc/qbRTCPeerConnection.js and 1 other location - About 1 hr to fix
        src/modules/webrtc/qbRTCPeerConnection.js on lines 369..375

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 69.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

                case 'connected':
                    if (this._reconnecting) {
                        this.delegate._stopReconnectTimer(this.userID);
                    }
                    this.state = qbRTCPeerConnection.State.CONNECTED;
        Severity: Major
        Found in src/modules/webrtc/qbRTCPeerConnection.js and 1 other location - About 1 hr to fix
        src/modules/webrtc/qbRTCPeerConnection.js on lines 377..383

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 69.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

                var iqParams = {
                        type: 'set',
                        from: self.helpers.getUserCurrentJid(),
                        id: chatUtils.getUniqueId('edit')
                    },
        Severity: Major
        Found in src/modules/chat/qbChat.js and 1 other location - About 1 hr to fix
        src/modules/chat/qbChat.js on lines 2202..2207

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 68.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

                } else if (typeof extension[field] === 'object') {
                    self._JStoXML(field, extension[field], msg);
                } else {
                    msg.c(field).t(extension[field]).up();
                }
        Severity: Major
        Found in src/modules/webrtc/qbWebRTCSignalingProvider.js and 1 other location - About 1 hr to fix
        src/modules/chat/qbChatHelpers.js on lines 140..144

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 68.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

                        if (typeof data.items[i].created_at === 'number') data.items[i].iso_created_at = new Date(data.items[i].created_at * 1000).toISOString();
        Severity: Major
        Found in src/qbUtils.js and 1 other location - About 1 hr to fix
        src/qbUtils.js on lines 167..167

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 68.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

                        if (typeof data.items[i].updated_at === 'number') data.items[i].iso_updated_at = new Date(data.items[i].updated_at * 1000).toISOString();
        Severity: Major
        Found in src/qbUtils.js and 1 other location - About 1 hr to fix
        src/qbUtils.js on lines 166..166

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 68.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

                    iq = $iq(stanzaParams).c('query', {
                        xmlns: Strophe.NS.PRIVACY_LIST
                    }).c('default', name && name.length > 0 ? {name: name} : {});
        Severity: Major
        Found in src/modules/chat/qbChat.js and 1 other location - About 1 hr to fix
        src/modules/chat/qbChat.js on lines 2525..2527

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 68.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

                    if (typeof obj[field] === 'object') {
                        self._JStoXML(field, obj[field], msg);
                    } else {
                        msg.c(field).t(obj[field]).up();
                    }
        Severity: Major
        Found in src/modules/chat/qbChatHelpers.js and 1 other location - About 1 hr to fix
        src/modules/webrtc/qbWebRTCSignalingProvider.js on lines 77..81

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 68.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

                var iqParams = {
                        type: 'get',
                        from: self.helpers.getUserCurrentJid(),
                        id: chatUtils.getUniqueId('getlist')
                    },
        Severity: Major
        Found in src/modules/chat/qbChat.js and 1 other location - About 1 hr to fix
        src/modules/chat/qbChat.js on lines 2060..2065

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 68.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

                        setAsActiveIq = $iq(setAsActiveStanzaParams).c('query', {
                            xmlns: Strophe.NS.PRIVACY_LIST
                        }).c('active', name && name.length > 0 ? {name: name} : {});
        Severity: Major
        Found in src/modules/chat/qbChat.js and 1 other location - About 1 hr to fix
        src/modules/chat/qbChat.js on lines 2482..2484

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 68.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Function _acceptInternal has 41 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        WebRTCSession.prototype._acceptInternal = function (userID, extension) {
            var self = this;
        
            /** create a peer connection */
            var peerConnection = this.peerConnections[userID];
        Severity: Minor
        Found in src/modules/webrtc/qbWebRTCSession.js - About 1 hr to fix

          Function listOnlineUsers has 40 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              listOnlineUsers: function (dialogJID, callback) {
                  /**
                   * Callback for QB.chat.muc.leave().
                   * @param {Object} Users - list of online users
                   * @callback listOnlineUsersMacCallback
          Severity: Minor
          Found in src/modules/chat/qbChat.js - About 1 hr to fix

            Function sendMessage has 40 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            WebRTCSignalingProvider.prototype.sendMessage = function (userId, ext, signalingType) {
                var extension = ext || {},
                    self = this;
            
                /** basic parameters */
            Severity: Minor
            Found in src/modules/webrtc/qbWebRTCSignalingProvider.js - About 1 hr to fix

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                                  case Strophe.Status.ERROR:
                                      self.isConnected = false;
                                      self._isConnecting = false;
              
                                      err = Utils.getError(422, 'Status.ERROR - An error has occurred', 'QBChat');
              Severity: Major
              Found in src/modules/chat/qbChat.js and 1 other location - About 1 hr to fix
              src/modules/chat/qbChat.js on lines 762..772

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 67.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Severity
              Category
              Status
              Source
              Language