QuickBlox/quickblox-javascript-sdk

View on GitHub
src/modules/webrtc/qbRTCPeerConnection.js

Summary

Maintainability
F
1 wk
Test Coverage

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 _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 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 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 _getStats has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

        function _getStats(peer, lastResults, successCallback, errorCallback) {
            var statistic = {
                'local': {
                    'audio': {},
                    'video': {},
        Severity: Minor
        Found in src/modules/webrtc/qbRTCPeerConnection.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 onIceConnectionStateCallback has 51 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        qbRTCPeerConnection.prototype.onIceConnectionStateCallback = function () {
            Helpers.trace("onIceConnectionStateCallback: " + this._pc.iceConnectionState);
            var connectionState = null;
        
            switch (this._pc.iceConnectionState) {
        Severity: Major
        Found in src/modules/webrtc/qbRTCPeerConnection.js - About 2 hrs to fix

          Function setMediaBitrate has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function setMediaBitrate(sdp, media, bitrate) {
              if (!bitrate) {
                  return sdp
                      .replace(/b=AS:.*\r\n/, '')
                      .replace(/b=TIAS:.*\r\n/, '');
          Severity: Minor
          Found in src/modules/webrtc/qbRTCPeerConnection.js - About 1 hr to fix

            Function setMediaBitrate has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

            function setMediaBitrate(sdp, media, bitrate) {
                if (!bitrate) {
                    return sdp
                        .replace(/b=AS:.*\r\n/, '')
                        .replace(/b=TIAS:.*\r\n/, '');
            Severity: Minor
            Found in src/modules/webrtc/qbRTCPeerConnection.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 findLineInRange has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function findLineInRange(
              sdpLines,
              startLine,
              endLine,
              prefix,
            Severity: Minor
            Found in src/modules/webrtc/qbRTCPeerConnection.js - About 1 hr to fix

              Function setPreferredCodec has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

              function setPreferredCodec(sdp, type, codec) {
                  if (!codec) {
                    return sdp;
                  }
              
              
              Severity: Minor
              Found in src/modules/webrtc/qbRTCPeerConnection.js - About 55 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 findLineInRange has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                sdpLines,
                startLine,
                endLine,
                prefix,
                substr,
              Severity: Minor
              Found in src/modules/webrtc/qbRTCPeerConnection.js - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                if (result.remoteSource) {
                                    item = statistic.remote.video;
                                    item.frameHeight = result.frameHeight;
                                    item.frameWidth = result.frameWidth;
                                    item.framesPerSecond = _getFramesPerSecond(result, lastResults, false);
                Severity: Major
                Found in src/modules/webrtc/qbRTCPeerConnection.js - About 45 mins to fix

                  Function onIceConnectionStateCallback has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                  qbRTCPeerConnection.prototype.onIceConnectionStateCallback = function () {
                      Helpers.trace("onIceConnectionStateCallback: " + this._pc.iceConnectionState);
                      var connectionState = null;
                  
                      switch (this._pc.iceConnectionState) {
                  Severity: Minor
                  Found in src/modules/webrtc/qbRTCPeerConnection.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 setLocalSessionDescription has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                  qbRTCPeerConnection.prototype.setLocalSessionDescription = function (params, callback) {
                      var self = this;
                  
                      self.state = qbRTCPeerConnection.State.CONNECTING;
                  
                  
                  Severity: Minor
                  Found in src/modules/webrtc/qbRTCPeerConnection.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

                  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

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

                      for (var j = realStartLine; j >= 0; --j) {
                        if (sdpLines[j].indexOf(prefix) === 0) {
                          if (!substr ||
                              sdpLines[j].toLowerCase().indexOf(substr.toLowerCase()) !== -1) {
                            return j;
                  Severity: Major
                  Found in src/modules/webrtc/qbRTCPeerConnection.js and 1 other location - About 2 hrs to fix
                  src/modules/webrtc/qbRTCPeerConnection.js on lines 636..643

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

                  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

                      for (var i = startLine; i < realEndLine; ++i) {
                        if (sdpLines[i].indexOf(prefix) === 0) {
                          if (!substr ||
                              sdpLines[i].toLowerCase().indexOf(substr.toLowerCase()) !== -1) {
                            return i;
                  Severity: Major
                  Found in src/modules/webrtc/qbRTCPeerConnection.js and 1 other location - About 2 hrs to fix
                  src/modules/webrtc/qbRTCPeerConnection.js on lines 647..654

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

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

                                  } else {
                                      item = statistic.local.video;
                                      item.frameHeight = result.frameHeight;
                                      item.frameWidth = result.frameWidth;
                                      item.framesPerSecond = _getFramesPerSecond(result, lastResults, true);
                  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 566..571

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

                  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.remoteSource) {
                                      item = statistic.remote.video;
                                      item.frameHeight = result.frameHeight;
                                      item.frameWidth = result.frameWidth;
                                      item.framesPerSecond = _getFramesPerSecond(result, lastResults, false);
                  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 571..576

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

                  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 3 locations. Consider refactoring.
                  Open

                          case 'closed':
                              this.delegate._stopReconnectTimer(this.userID);
                              this.state = qbRTCPeerConnection.State.CLOSED;
                              connectionState = Helpers.SessionConnectionState.CLOSED;
                              break;
                  Severity: Major
                  Found in src/modules/webrtc/qbRTCPeerConnection.js and 2 other locations - About 1 hr to fix
                  src/modules/webrtc/qbRTCPeerConnection.js on lines 385..389
                  src/modules/webrtc/qbRTCPeerConnection.js on lines 391..395

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

                  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 3 locations. Consider refactoring.
                  Open

                          case 'disconnected':
                              this.delegate._startReconnectTimer(this.userID);
                              this.state = qbRTCPeerConnection.State.DISCONNECTED;
                              connectionState = Helpers.SessionConnectionState.DISCONNECTED;
                              break;
                  Severity: Major
                  Found in src/modules/webrtc/qbRTCPeerConnection.js and 2 other locations - About 1 hr to fix
                  src/modules/webrtc/qbRTCPeerConnection.js on lines 385..389
                  src/modules/webrtc/qbRTCPeerConnection.js on lines 398..402

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

                  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 3 locations. Consider refactoring.
                  Open

                          case 'failed':
                              this.delegate._startReconnectTimer(this.userID);
                              this.state = qbRTCPeerConnection.State.FAILED;
                              connectionState = Helpers.SessionConnectionState.FAILED;
                              break;
                  Severity: Major
                  Found in src/modules/webrtc/qbRTCPeerConnection.js and 2 other locations - About 1 hr to fix
                  src/modules/webrtc/qbRTCPeerConnection.js on lines 391..395
                  src/modules/webrtc/qbRTCPeerConnection.js on lines 398..402

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

                  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 preferredCodecSendIndex = sendCodecs.findIndex(function(codec) {
                                      return codec
                                          .mimeType
                                          .toLowerCase()
                                          .includes(self.preferredCodec.toLowerCase());
                  Severity: Minor
                  Found in src/modules/webrtc/qbRTCPeerConnection.js and 1 other location - About 55 mins to fix
                  src/modules/webrtc/qbRTCPeerConnection.js on lines 172..177

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

                  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 preferredCodecRecvIndex = recvCodecs.findIndex(function(codec) {
                                      return codec
                                          .mimeType
                                          .toLowerCase()
                                          .includes(self.preferredCodec.toLowerCase());
                  Severity: Minor
                  Found in src/modules/webrtc/qbRTCPeerConnection.js and 1 other location - About 55 mins to fix
                  src/modules/webrtc/qbRTCPeerConnection.js on lines 159..164

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

                  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.candidateType === 'host' && result.mozLocalTransport === 'udp' && result.transport === 'udp') {
                                      item.protocol = result.transport;
                                      item.ip = result.ipAddress;
                                      item.port = result.portNumber;
                                  } else if (!Helpers.getVersionFirefox()) {
                  Severity: Minor
                  Found in src/modules/webrtc/qbRTCPeerConnection.js and 1 other location - About 40 mins to fix
                  src/modules/webrtc/qbRTCPeerConnection.js on lines 555..559

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

                  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 (!Helpers.getVersionFirefox()) {
                                      item.protocol = result.protocol;
                                      item.ip = result.ip;
                                      item.port = result.port;
                                  }
                  Severity: Minor
                  Found in src/modules/webrtc/qbRTCPeerConnection.js and 1 other location - About 40 mins to fix
                  src/modules/webrtc/qbRTCPeerConnection.js on lines 551..559

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

                  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

                  There are no issues that match your filters.

                  Category
                  Status