trailofbits/tubertc

View on GitHub

Showing 226 of 226 total issues

Function setupIcons has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    this.setupIcons = function() {
        var dimensions = _this.videoDimensions();

        if (dimensions.limitingValue === 'width') {
            var vidHeight = dimensions.dimensions[1];
Severity: Minor
Found in public/js/viewports.js - About 1 hr to fix

    Function handleCommand has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        handleCommand: function(message) {
            if (!message.length) {
                ErrorMetric.log('ChatCommands.handleCommand => message too small');
                ErrorMetric.log('                              msg: "' + message + '"');
                return false;
    Severity: Minor
    Found in public/js/chat-cmds.js - About 1 hr to fix

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

          idSel.hover(function() {
              if (_buttonIsEnabled) {
                  idSel.css('opacity', '0.5');
              }
          }, function() {
      Severity: Major
      Found in public/js/navbar.js and 1 other location - About 1 hr to fix
      public/js/navbar.js on lines 285..293

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

      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

          idSel.hover(function() {
              if (_buttonIsEnabled) {
                  idSel.css('opacity', '0.5');
              }
          }, function() {
      Severity: Major
      Found in public/js/navbar.js and 1 other location - About 1 hr to fix
      public/js/navbar.js on lines 74..82

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

      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

          this.showHangoutsMode = function() {
              this.hangoutsMode = true;
              if (this.viewportArray.length > 1) {
                  this.placeViewports();
              }
      Severity: Major
      Found in public/js/viewports.js and 1 other location - About 1 hr to fix
      public/js/viewports.js on lines 487..492

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

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Function initialize has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          initialize: function(config) {
              var _this = this;
              if (typeof config.cameraBtn !== 'object' ||
                  typeof config.micBtn !== 'object' ||
                  typeof config.dashBtn !== 'object') {
      Severity: Minor
      Found in public/js/login.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

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

          this.showDashMode = function() {
              this.hangoutsMode = false;
              if (this.viewportArray.length > 1) {
                  this.placeViewports();
              }
      Severity: Major
      Found in public/js/viewports.js and 1 other location - About 1 hr to fix
      public/js/viewports.js on lines 500..505

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

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

          this.addMessage = function(peerId, message) {
              if (this.peerId !== null) {
                  var userName = _peerIdMap[peerId];
                  var hsvColor = this.peerColorMap[peerId];
                  if (hsvColor !== undefined && userName !== undefined) {
      Severity: Minor
      Found in public/js/chat.js - About 1 hr to fix

        Function _toggleCmdExecute has 30 lines of code (exceeds 25 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 1 hr to fix

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

              _checkIfNonTlsAndChromeAbove47: function() {
                  var userAgent = navigator.userAgent;
                  if (window.location.protocol !== 'https:' &&
                      (window.location.hostname !== 'localhost' && window.location.hostname !== '127.0.0.1')) {
                      var browserString = null;
          Severity: Minor
          Found in public/js/login.js - About 1 hr to fix

            Function getP2PDiagnosticForPeerId has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    this.getP2PDiagnosticForPeerId = function(peerId, completionFn) {
                        if (peerId === undefined || completionFn === undefined) {
                            console.log('Usage: \n');
                            console.log('  Client.getP2PDiagnosticForPeerId(\n');
                            console.log('    peerId : string,\n');
            Severity: Minor
            Found in public/telemetry/debug.js - About 1 hr to fix

              Function getP2PDiagnostics has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      this.getP2PDiagnostics = function(completionFn) {
                          if (completionFn === undefined) {
                              console.log('Usage: \n');
                              console.log('  Client.getP2PDiagnostics(\n');
                              console.log('    completionFn : function(Object({\n');
              Severity: Minor
              Found in public/telemetry/debug.js - About 1 hr to fix

                Function parseEnvVar has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        function parseEnvVar() {
                            i += 1;
                            var varend;
                            var varname;
                
                
                Severity: Minor
                Found in public/js/shell-quote.js - About 1 hr to fix

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

                  var VTCClient = function(myId, roomName, onErrorFn) {
                      var _id = myId;
                      var _room = roomName;
                  
                      /**
                  Severity: Minor
                  Found in public/js/vtc.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 ListUser has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  var ListUser = function() {
                      this.command = 'who';
                  
                      /**
                       * Help function.
                  Severity: Minor
                  Found in public/js/chat-cmds.js - About 1 hr to fix

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

                        this.bindClick = function() {
                          // @todo FIXME: this sort of feels and looks kludgey, can we fix this?
                            var clickHandler = function() {
                                if (dashboard.hangoutsMode) {
                                    var i = dashboard.viewportArray.indexOf(_this);
                    Severity: Minor
                    Found in public/js/viewports.js - About 1 hr to fix

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

                          this.userLeft = function(peerId) {
                              var _this = this;
                              if (this.peerId !== null) {
                                  var userName = _peerIdMap[peerId];
                      
                      
                      Severity: Minor
                      Found in public/js/chat.js - About 1 hr to fix

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

                                if (userName.length === 0) {
                                    _loginAlert
                                        .html('Please provide a <b>user name</b>.')
                                        .stop(true, false)
                                        .slideDown();
                        Severity: Major
                        Found in public/js/login.js and 1 other location - About 1 hr to fix
                        public/js/login.js on lines 330..337

                        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

                                } else {
                                    this.videoSrc
                                        .stop(true, false)
                                        .fadeOut(function() {
                                            _this.userIcon
                        Severity: Major
                        Found in public/js/viewports.js and 1 other location - About 1 hr to fix
                        public/js/viewports.js on lines 140..148

                        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

                                if (roomName.length === 0) {
                                    _loginAlert
                                        .html('Please provide a <b>room name</b>.')
                                        .stop(true, false)
                                        .slideDown();
                        Severity: Major
                        Found in public/js/login.js and 1 other location - About 1 hr to fix
                        public/js/login.js on lines 321..328

                        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

                        Severity
                        Category
                        Status
                        Source
                        Language