trailofbits/tubertc

View on GitHub

Showing 56 of 226 total issues

Function Chat has 283 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var Chat = function(roomName) {
    // @todo (input): make sure that roomName is sanitized

    // An Object storing mappings of peerId : String => userName : String
    var _peerIdMap = {};
Severity: Major
Found in public/js/chat.js - About 1 day to fix

    Function Chat has a Cognitive Complexity of 60 (exceeds 5 allowed). Consider refactoring.
    Open

    var Chat = function(roomName) {
        // @todo (input): make sure that roomName is sanitized
    
        // An Object storing mappings of peerId : String => userName : String
        var _peerIdMap = {};
    Severity: Minor
    Found in public/js/chat.js - About 1 day to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function vtcMain has 203 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    var vtcMain = function(params) {
        // @todo XXX(debug): If debugging mode is enabled (DebugConsole is a valid function),
        // instantiate a new instance of DebugConsole
        var dbgListener = null;
        if (typeof DebugConsole === 'object' && typeof DebugConsole.Listener === 'function') {
    Severity: Major
    Found in public/js/room.js - About 1 day to fix

      Function Dashboard has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
      Open

      var Dashboard = function() {
          // @todo For hangoutsMode, make the all non-primary video clickable
          this.container = null;
          this.elem = null;
          this.orientation = 0;
      Severity: Minor
      Found in public/js/viewports.js - About 7 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 Dashboard has 167 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      var Dashboard = function() {
          // @todo For hangoutsMode, make the all non-primary video clickable
          this.container = null;
          this.elem = null;
          this.orientation = 0;
      Severity: Major
      Found in public/js/viewports.js - About 6 hrs to fix

        Function Viewport has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
        Open

        var Viewport = function(peerName, dashboard) {
            // This indicates that the viewport is that of itself
            this.isSelf = false;
        
            // @todo In the future, make use of peerName by utilizing it as a label. However,
        Severity: Minor
        Found in public/js/viewports.js - About 6 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 Viewport has 153 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        var Viewport = function(peerName, dashboard) {
            // This indicates that the viewport is that of itself
            this.isSelf = false;
        
            // @todo In the future, make use of peerName by utilizing it as a label. However,
        Severity: Major
        Found in public/js/viewports.js - About 6 hrs to fix

          Function initialize has 127 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              initialize: function(config) {
                  var _this = this;
                  if (typeof config.cameraBtn !== 'object' ||
                      typeof config.micBtn !== 'object' ||
                      typeof config.dashBtn !== 'object') {
          Severity: Major
          Found in public/js/login.js - About 5 hrs to fix

            Function parse has 108 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function parse(s, env) {
                var chunker = new RegExp([
                    '(' + CONTROL + ')', // control chars
                    '(' + BAREWORD + '|' + SINGLE_QUOTE + '|' + DOUBLE_QUOTE + ')*'
                ].join('|'), 'g');
            Severity: Major
            Found in public/js/shell-quote.js - About 4 hrs to fix

              Function StatefulButton has 105 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              var StatefulButton = function(id, selected) {
                  var idSel = $(id);
                  var _kSelectedColor = '#009966';
                  var _kUnselectedColor = '#cc0033';
                  var _buttonIsEnabled = true;
              Severity: Major
              Found in public/js/navbar.js - About 4 hrs to fix

                File viewports.js has 334 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                /**
                 * @file Defines the dashboard and viewport UI components.
                 */
                
                'use strict';
                Severity: Minor
                Found in public/js/viewports.js - About 4 hrs to fix

                  Function Client has 97 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      Client: function() {
                          /**
                           * Gets the room list associated with the VTC client.
                           *
                           * @returns {Array<String>} An array of peerIDs
                  Severity: Major
                  Found in public/telemetry/debug.js - About 3 hrs to fix

                    File login.js has 312 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    /**
                     * @file This handles the following:
                     *   + Parsing of the query string for a roomName (if it exists)
                     *   + Checking localStorage to determine the following information:
                     *     - Is a userName key set with a valid value? If so, autopopulate the username field with this
                    Severity: Minor
                    Found in public/js/login.js - About 3 hrs to fix

                      Function connect has 86 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          connect: function(userName, roomName, successFn) {
                              if (!this._validateConfig()) {
                                  ErrorMetric.log('VTCCore.connect => config changed somehow...');
                                  ErrorMetric.log('                => ' + JSON.stringify(this.config));
                      
                      
                      Severity: Major
                      Found in public/js/vtc.js - About 3 hrs to fix

                        Function Listener has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                        Open

                            Listener: function() {
                                this.handlePeerMessage = function(client, peerId, content) {
                                    if (typeof content.opcode === 'string') {
                                        if (content.opcode === 'testP2PConnection' &&
                                            typeof content.id === 'number') {
                        Severity: Minor
                        Found in public/telemetry/debug.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

                        File chat.js has 304 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        /**
                         * @file Defines the chat panel UI elements.
                         *
                         * @requires Handlebars.js
                         * @requires module:js/chat-cmds
                        Severity: Minor
                        Found in public/js/chat.js - About 3 hrs to fix

                          Function initialize has 73 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              this.initialize = function(peerId, userName, sendMessageFn) {
                                  var _this = this;
                          
                                  this.peerId = peerId;
                                  this.userName = userName;
                          Severity: Major
                          Found in public/js/chat.js - About 2 hrs to fix

                            Function _toggleCmdExecute has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                            Open

                            var _toggleCmdExecute = function(toggle, name, btn) {
                                /**
                                 * Changes the a toggle's state.
                                 *
                                 * @param {Object} chatObj - The chat object.
                            Severity: Minor
                            Found in public/js/chat-cmds.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 VTCClient has 68 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            var VTCClient = function(myId, roomName, onErrorFn) {
                                var _id = myId;
                                var _room = roomName;
                            
                                /**
                            Severity: Major
                            Found in public/js/vtc.js - About 2 hrs to fix

                              Function StatefulButton has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                              Open

                              var StatefulButton = function(id, selected) {
                                  var idSel = $(id);
                                  var _kSelectedColor = '#009966';
                                  var _kUnselectedColor = '#cc0033';
                                  var _buttonIsEnabled = true;
                              Severity: Minor
                              Found in public/js/navbar.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

                              Severity
                              Category
                              Status
                              Source
                              Language