QuickBlox/quickblox-javascript-sdk

View on GitHub

Showing 4,299 of 4,299 total issues

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

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

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

                    iq.c('item', {
                        type: 'jid',
                        value: params.jidOrMuc,
                        action: params.userAction,
                        order: params.order
    Severity: Major
    Found in src/modules/chat/qbChat.js and 1 other location - About 4 hrs to fix
    src/modules/chat/qbChat.js on lines 2092..2101

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

    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

                    list.c('item', {
                        type: 'jid',
                        value: params.jidOrMuc,
                        action: params.userAction,
                        order: params.order
    Severity: Major
    Found in src/modules/chat/qbChat.js and 1 other location - About 4 hrs to fix
    src/modules/chat/qbChat.js on lines 2079..2088

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

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

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

      function MucProxy(options) {
          this.service = options.service;
          this.helpers = options.helpers;
          this.connection = options.stropheClient;
          this.Client = options.xmppClient;
      Severity: Major
      Found in src/modules/chat/qbChat.js and 1 other location - About 3 hrs to fix
      src/modules/chat/qbChat.js on lines 1528..1536

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

      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

      function RosterProxy(options) {
          this.service = options.service;
          this.helpers = options.helpers;
          this.connection = options.stropheClient;
          this.Client = options.xmppClient;
      Severity: Major
      Found in src/modules/chat/qbChat.js and 1 other location - About 3 hrs to fix
      src/modules/chat/qbChat.js on lines 1774..1782

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

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

          Function parseExtraParams has 76 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              parseExtraParams: function(extraParams) {
                  var self = this;
          
                  if (!extraParams) {
                      return null;
          Severity: Major
          Found in src/modules/chat/qbChatHelpers.js - About 3 hrs to fix

            Function setLocalSessionDescription has 75 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            qbRTCPeerConnection.prototype.setLocalSessionDescription = function (params, callback) {
                var self = this;
            
                self.state = qbRTCPeerConnection.State.CONNECTING;
            
            
            Severity: Major
            Found in src/modules/webrtc/qbRTCPeerConnection.js - About 3 hrs to fix

              Function init has a Cognitive Complexity of 21 (exceeds 5 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: Minor
              Found in src/qbMain.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 setAsDefault has 71 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

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

                File qbWebRTCClient.js has 280 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                'use strict';
                
                /**
                 * QuickBlox JavaScript SDK
                 * WebRTC Module (WebRTC client)
                Severity: Minor
                Found in src/modules/webrtc/qbWebRTCClient.js - About 2 hrs to fix

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

                      getFile: function (uid, callback) {
                          /**
                           * Callback for QB.content.getFile(uid, callback).
                           * @callback downloadFileByUIDCallback
                           * @param {object} error - The error object.
                  Severity: Major
                  Found in src/modules/qbContent.js and 1 other location - About 2 hrs to fix
                  src/modules/qbContent.js on lines 270..284

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

                  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

                      conn.xmlInput = function(data) {
                        if (data.childNodes[0]) {
                          for (var i = 0, len = data.childNodes.length; i < len; i++) {
                            Utils.QBLog('[QBChat]', 'RECV:', data.childNodes[i]);
                          }
                  Severity: Major
                  Found in src/qbStrophe.js and 1 other location - About 2 hrs to fix
                  src/qbStrophe.js on lines 28..34

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

                  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

                      getInfo: function (id, callback) {
                          /**
                           * Callback for QB.content.getInfo(id, callback).
                           * @callback getFileInfoByIdCallback
                           * @param {object} error - The error object.
                  Severity: Major
                  Found in src/modules/qbContent.js and 1 other location - About 2 hrs to fix
                  src/modules/qbContent.js on lines 292..306

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

                  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