QuickBlox/quickblox-javascript-sdk

View on GitHub

Showing 4,299 of 4,299 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 1806 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 quickblox.d.ts has 910 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>>
    
    export declare interface QBUser {
    Severity: Major
    Found in quickblox.d.ts - About 2 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

        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

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

                sendIsTypingStatus: function (jid_or_user_id) {
                    Utils.QBLog('[QBChat]', 'Call sendIsTypingStatus ');
                    var self = this,
                        stanzaParams = {
                            from: self.helpers.getUserCurrentJid(),
            Severity: Major
            Found in src/modules/chat/qbChat.js and 1 other location - About 1 day to fix
            src/modules/chat/qbChat.js on lines 1221..1242

            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 208.

            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

                sendIsStopTypingStatus: function (jid_or_user_id) {
                    Utils.QBLog('[QBChat]', 'Call sendIsStopTypingStatus ');
                    var self = this,
                        stanzaParams = {
                            from: self.helpers.getUserCurrentJid(),
            Severity: Major
            Found in src/modules/chat/qbChat.js and 1 other location - About 1 day to fix
            src/modules/chat/qbChat.js on lines 1193..1214

            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 208.

            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 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

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

                          if (status && statusCode == '110') {
                              Utils.safeCallbackCall(callback, null, {
                                  dialogId: dialogId
                              });
                          } else {
              Severity: Major
              Found in src/modules/chat/qbChat.js and 1 other location - About 7 hrs to fix
              src/modules/chat/qbChat.js on lines 1834..1853

              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 175.

              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

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

                          if (status && statusCode == '110') {
                              Utils.safeCallbackCall(callback, null, {
                                  dialogId: dialogId
                              });
                          } else {
              Severity: Major
              Found in src/modules/chat/qbChat.js and 1 other location - About 7 hrs to fix
              src/modules/chat/qbChat.js on lines 1906..1925

              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 175.

              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 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

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

                              } else if (result.bytesSent && result.type === 'outbound-rtp') {
                                  item = statistic.local[result.mediaType];
                                  item.bitrate = _getBitratePerSecond(result, lastResults, true);
                                  item.bytesSent = result.bytesSent;
                                  item.packetsSent = result.packetsSent;
                  Severity: Major
                  Found in src/modules/webrtc/qbRTCPeerConnection.js and 1 other location - About 5 hrs to fix
                  src/modules/webrtc/qbRTCPeerConnection.js on lines 531..577

                  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 139.

                  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 (result.bytesReceived && result.type === 'inbound-rtp') {
                                  item = statistic.remote[result.mediaType];
                                  item.bitrate = _getBitratePerSecond(result, lastResults, false);
                                  item.bytesReceived = result.bytesReceived;
                                  item.packetsReceived = result.packetsReceived;
                  Severity: Major
                  Found in src/modules/webrtc/qbRTCPeerConnection.js and 1 other location - About 5 hrs to fix
                  src/modules/webrtc/qbRTCPeerConnection.js on lines 540..577

                  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 139.

                  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 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

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

                          delete: function(id, params_or_callback, callback) {
                              /**
                               * Callback for QB.chat.message.delete().
                               * @param {Object} error - The error object.
                               * @param {String} res - Empty string.
                      Severity: Major
                      Found in src/modules/chat/qbMessage.js and 1 other location - About 4 hrs to fix
                      src/modules/chat/qbDialog.js on lines 97..117

                      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 123.

                      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