teco-kit/PointAndControl

View on GitHub
IGS/Resources/HttpRoot/js/adapter.js

Summary

Maintainability
D
2 days
Test Coverage

File adapter.js has 434 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*
 *  Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
 *
 *  Use of this source code is governed by a BSD-style license
 *  that can be found in the LICENSE file in the root of the source
Severity: Minor
Found in IGS/Resources/HttpRoot/js/adapter.js - About 6 hrs to fix

    Function RTCPeerConnection has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
    Open

      window.RTCPeerConnection = function(pcConfig, pcConstraints) {
        if (webrtcDetectedVersion < 38) {
          // .urls is not supported in FF < 38.
          // create RTCIceServers with a single url.
          if (pcConfig && pcConfig.iceServers) {
    Severity: Minor
    Found in IGS/Resources/HttpRoot/js/adapter.js - About 4 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 constraintsToChrome has 48 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      var constraintsToChrome = function(c) {
        if (typeof c !== 'object' || c.mandatory || c.optional) {
          return c;
        }
        var cc = {};
    Severity: Minor
    Found in IGS/Resources/HttpRoot/js/adapter.js - About 1 hr to fix

      Function RTCPeerConnection has 45 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        window.RTCPeerConnection = function(pcConfig, pcConstraints) {
          // Translate iceTransportPolicy to iceTransports,
          // see https://code.google.com/p/webrtc/issues/detail?id=4869
          if (pcConfig && pcConfig.iceTransportPolicy) {
            pcConfig.iceTransports = pcConfig.iceTransportPolicy;
      Severity: Minor
      Found in IGS/Resources/HttpRoot/js/adapter.js - About 1 hr to fix

        Function constraintsToFF37 has 41 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            var constraintsToFF37 = function(c) {
              if (typeof c !== 'object' || c.require) {
                return c;
              }
              var require = [];
        Severity: Minor
        Found in IGS/Resources/HttpRoot/js/adapter.js - About 1 hr to fix

          Function getStats has 37 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              pc.getStats = function(selector, successCallback, errorCallback) { // jshint ignore: line
                var self = this;
                var args = arguments;
          
                // If selector is a function then we are in the old style stats so just
          Severity: Minor
          Found in IGS/Resources/HttpRoot/js/adapter.js - About 1 hr to fix

            Function RTCPeerConnection has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

              window.RTCPeerConnection = function(pcConfig, pcConstraints) {
                // Translate iceTransportPolicy to iceTransports,
                // see https://code.google.com/p/webrtc/issues/detail?id=4869
                if (pcConfig && pcConfig.iceTransportPolicy) {
                  pcConfig.iceTransports = pcConfig.iceTransportPolicy;
            Severity: Minor
            Found in IGS/Resources/HttpRoot/js/adapter.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

            Avoid deeply nested control flow statements.
            Open

                      if (server.hasOwnProperty('urls')) {
                        for (var j = 0; j < server.urls.length; j++) {
                          var newServer = {
                            url: server.urls[j]
                          };
            Severity: Major
            Found in IGS/Resources/HttpRoot/js/adapter.js - About 45 mins to fix

              There are no issues that match your filters.

              Category
              Status