QuickBlox/quickblox-javascript-sdk

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

Summary

Maintainability
F
6 days
Test Coverage

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

    WebRTCSession.prototype.attachMediaStream = function (elementId, stream, options) {
        var elem = document.getElementById(elementId);
    
        if (elem) {
            if (elem instanceof HTMLMediaElement) {
    Severity: Minor
    Found in src/modules/webrtc/qbWebRTCSession.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 _startReconnectTimer has 50 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    WebRTCSession.prototype._startReconnectTimer = function (userID) {
        var self = this;
        var delay = config.webrtc.disconnectTimeInterval * 1000;
        var peer = this.peerConnections[userID];
    
    
    Severity: Minor
    Found in src/modules/webrtc/qbWebRTCSession.js - About 2 hrs to fix

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

        WebRTCSession.prototype.processOnUpdate = function (userID, extension) {
            var SRD = extension.sessionDescription;
            var reason = extension.reason;
            var sessionIsActive = this.state === WebRTCSession.State.ACTIVE;
            if (sessionIsActive && reason && reason === 'reconnect') {
        Severity: Minor
        Found in src/modules/webrtc/qbWebRTCSession.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 _replaceTracks has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        WebRTCSession.prototype._replaceTracks = function (stream) {
            var localStream = this.localStream;
            var elemId = this.mediaParams.elemId;
            var ops = this.mediaParams.options;
            var currentStreamTracks = localStream.getTracks();
        Severity: Minor
        Found in src/modules/webrtc/qbWebRTCSession.js - About 1 hr to fix

          Function _processReconnectOffer has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          WebRTCSession.prototype._processReconnectOffer = function (userID, SRD) {
              var self = this;
              if (this.peerConnections[userID].polite) {
                  this._reconnect(this.peerConnections[userID]);
                  var peer = this.peerConnections[userID];
          Severity: Minor
          Found in src/modules/webrtc/qbWebRTCSession.js - About 1 hr to fix

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

            WebRTCSession.prototype._reconnectToChat = function (callback) {
                var self = this;
                var signalingProvider = this.signalingProvider;
                var reconnectToChat = function () {
                    var _onReconnectListener = signalingProvider.chat.onReconnectListener;
            Severity: Minor
            Found in src/modules/webrtc/qbWebRTCSession.js - About 1 hr to fix

              Function processOnAccept has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

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

                Function update has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                WebRTCSession.prototype.update = function (extension, userID) {
                    var self = this,
                        ext = typeof extension === 'object' ? extension : {};
                
                    Helpers.trace('Update, extension: ' + JSON.stringify(extension));
                Severity: Minor
                Found in src/modules/webrtc/qbWebRTCSession.js - About 1 hr to fix

                  Function accept has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  WebRTCSession.prototype.accept = function (extension) {
                      var self = this,
                          ext = _prepareExtension(extension);
                  
                      Helpers.trace('Accept, extension: ' + JSON.stringify(ext.userInfo));
                  Severity: Minor
                  Found in src/modules/webrtc/qbWebRTCSession.js - About 1 hr to fix

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

                    WebRTCSession.prototype._reconnectToChat = function (callback) {
                        var self = this;
                        var signalingProvider = this.signalingProvider;
                        var reconnectToChat = function () {
                            var _onReconnectListener = signalingProvider.chat.onReconnectListener;
                    Severity: Minor
                    Found in src/modules/webrtc/qbWebRTCSession.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 _stopReconnectTimer has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                    WebRTCSession.prototype._stopReconnectTimer = function (userID) {
                        var peer = this.peerConnections[userID];
                        if (this.iceConnectTimers[userID]) {
                            clearTimeout(this.iceConnectTimers[userID]);
                            this.iceConnectTimers[userID] = undefined;
                    Severity: Minor
                    Found in src/modules/webrtc/qbWebRTCSession.js - About 45 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 getUserMedia has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                    WebRTCSession.prototype.getUserMedia = function (params, callback) {
                        if (!navigator.mediaDevices.getUserMedia) {
                            throw new Error('getUserMedia() is not supported in your browser');
                        }
                    
                    
                    Severity: Minor
                    Found in src/modules/webrtc/qbWebRTCSession.js - About 45 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 _startWaitingOfferOrAnswerTimer has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                    WebRTCSession.prototype._startWaitingOfferOrAnswerTimer = function (time) {
                        var self = this,
                            timeout = (config.webrtc.answerTimeInterval - time) < 0 ? 1 : config.webrtc.answerTimeInterval - time,
                            waitingOfferOrAnswerTimeoutCallback = function () {
                                Helpers.trace("waitingOfferOrAnswerTimeoutCallback");
                    Severity: Minor
                    Found in src/modules/webrtc/qbWebRTCSession.js - About 45 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 _startReconnectTimer has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                    WebRTCSession.prototype._startReconnectTimer = function (userID) {
                        var self = this;
                        var delay = config.webrtc.disconnectTimeInterval * 1000;
                        var peer = this.peerConnections[userID];
                    
                    
                    Severity: Minor
                    Found in src/modules/webrtc/qbWebRTCSession.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 _close has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                    WebRTCSession.prototype._close = function () {
                        Helpers.trace('_close');
                    
                        for (var key in this.peerConnections) {
                            var peer = this.peerConnections[key];
                    Severity: Minor
                    Found in src/modules/webrtc/qbWebRTCSession.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

                    Function update has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                    WebRTCSession.prototype.update = function (extension, userID) {
                        var self = this,
                            ext = typeof extension === 'object' ? extension : {};
                    
                        Helpers.trace('Update, extension: ' + JSON.stringify(extension));
                    Severity: Minor
                    Found in src/modules/webrtc/qbWebRTCSession.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

                    Unexpected console statement.
                    Open

                                console.warn('Peer close error:', e);

                    disallow the use of console (no-console)

                    In JavaScript that is designed to be executed in the browser, it's considered a best practice to avoid using methods on console. Such messages are considered to be for debugging purposes and therefore not suitable to ship to the client. In general, calls using console should be stripped before being pushed to production.

                    console.log("Made it here.");
                    console.error("That shouldn't have happened.");

                    Rule Details

                    This rule disallows calls to methods of the console object.

                    Examples of incorrect code for this rule:

                    /*eslint no-console: "error"*/
                    
                    console.log("Log a debug level message.");
                    console.warn("Log a warn level message.");
                    console.error("Log an error level message.");

                    Examples of correct code for this rule:

                    /*eslint no-console: "error"*/
                    
                    // custom console
                    Console.log("Hello world!");

                    Options

                    This rule has an object option for exceptions:

                    • "allow" has an array of strings which are allowed methods of the console object

                    Examples of additional correct code for this rule with a sample { "allow": ["warn", "error"] } option:

                    /*eslint no-console: ["error", { allow: ["warn", "error"] }] */
                    
                    console.warn("Log a warn level message.");
                    console.error("Log an error level message.");

                    When Not To Use It

                    If you're using Node.js, however, console is used to output information to the user and so is not strictly used for debugging purposes. If you are developing for Node.js then you most likely do not want this rule enabled.

                    Related Rules

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

                        if (type === 'video' && this.localStream.getVideoTracks().length > 0) {
                            this.localStream.getVideoTracks().forEach(function (track) {
                                track.enabled = !!bool;
                            });
                            return;
                    Severity: Major
                    Found in src/modules/webrtc/qbWebRTCSession.js and 1 other location - About 2 hrs to fix
                    src/modules/webrtc/qbWebRTCSession.js on lines 1151..1156

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

                    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 (type === 'audio' && this.localStream.getAudioTracks().length > 0) {
                            this.localStream.getAudioTracks().forEach(function (track) {
                                track.enabled = !!bool;
                            });
                            return;
                    Severity: Major
                    Found in src/modules/webrtc/qbWebRTCSession.js and 1 other location - About 2 hrs to fix
                    src/modules/webrtc/qbWebRTCSession.js on lines 1158..1163

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

                    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

                        Object.keys(self.peerConnections).forEach(function (key) {
                            var peerConnection = self.peerConnections[key];
                            self.signalingProvider.sendMessage(
                                peerConnection.userID,
                                ext,
                    Severity: Major
                    Found in src/modules/webrtc/qbWebRTCSession.js and 1 other location - About 1 hr to fix
                    src/modules/webrtc/qbWebRTCSession.js on lines 505..512

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

                    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

                        Object.keys(self.peerConnections).forEach(function (key) {
                            var peerConnection = self.peerConnections[key];
                            self.signalingProvider.sendMessage(
                                peerConnection.userID,
                                ext,
                    Severity: Major
                    Found in src/modules/webrtc/qbWebRTCSession.js and 1 other location - About 1 hr to fix
                    src/modules/webrtc/qbWebRTCSession.js on lines 470..477

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

                    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

                    WebRTCSession.prototype._clearAnswerTimer = function () {
                        if (this.answerTimer) {
                            Helpers.trace("_clearAnswerTimer");
                            clearTimeout(this.answerTimer);
                            this.answerTimer = null;
                    Severity: Major
                    Found in src/modules/webrtc/qbWebRTCSession.js and 1 other location - About 1 hr to fix
                    src/modules/webrtc/qbWebRTCSession.js on lines 1192..1198

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

                    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

                    WebRTCSession.prototype._clearWaitingOfferOrAnswerTimer = function () {
                        if (this.waitingOfferOrAnswerTimer) {
                            Helpers.trace("_clearWaitingOfferOrAnswerTimer");
                            clearTimeout(this.waitingOfferOrAnswerTimer);
                            this.waitingOfferOrAnswerTimer = null;
                    Severity: Major
                    Found in src/modules/webrtc/qbWebRTCSession.js and 1 other location - About 1 hr to fix
                    src/modules/webrtc/qbWebRTCSession.js on lines 1166..1172

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

                    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

                        this.opponentsIDs.forEach(function (userID, i, arr) {
                            if (userID != self.currentUserID) {
                                opponents.push(parseInt(userID));
                            }
                        });
                    Severity: Minor
                    Found in src/modules/webrtc/qbWebRTCSession.js and 1 other location - About 55 mins to fix
                    src/modules/webrtc/qbWebRTCSession.js on lines 1231..1235

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

                    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

                        this.opponentsIDs.forEach(function (userID, i, arr) {
                            if (userID != self.currentUserID) {
                                opponents.push(parseInt(userID));
                            }
                        });
                    Severity: Minor
                    Found in src/modules/webrtc/qbWebRTCSession.js and 1 other location - About 55 mins to fix
                    src/modules/webrtc/qbWebRTCSession.js on lines 1244..1248

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

                    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