trailofbits/tubertc

View on GitHub
public/telemetry/debug.js

Summary

Maintainability
D
1 day
Test Coverage

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

    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

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

      Function Client has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

          Client: function() {
              /**
               * Gets the room list associated with the VTC client.
               *
               * @returns {Array<String>} An array of peerIDs
      Severity: Minor
      Found in public/telemetry/debug.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 handlePeerMessage has 41 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

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

            There are no issues that match your filters.

            Category
            Status