freedomjs/freedom

View on GitHub

Showing 177 of 262 total issues

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

ModuleInternal.prototype.generateEnv = function (manifest, items) {
  return this.binder.bindDefault(this.port, this.api, manifest, true).then(
    function (binding) {
      var i = 0;
      binding.port.api = binding.external.api;
Severity: Minor
Found in src/moduleinternal.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 onMessage has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

FileServer.prototype.onMessage = function (val) {
  // Try parsing message
  try {
    val.msgStr = this.social.ab2str(val.data);
    val.msg = JSON.parse(val.msgStr);
Severity: Minor
Found in demo/filedrop/freedom-modules/fileserver.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 flushQueue has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

IndexedDBStorageProvider.prototype.flushQueue = function () {
  var i, elt;
  for (i = 0; i < this.queue.length; i += 1) {
    elt = this.queue[i];
    if (elt.cmd === "keys") {
Severity: Minor
Found in providers/storage/indexeddb/storage.indexeddb.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 _flushQueue has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

IsolatedStorageProvider.prototype._flushQueue = function() {
  var i, elt;
  for (i = 0; i < this.queue.length; i += 1) {
    elt = this.queue[i];
    if (elt.cmd === "keys") {
Severity: Minor
Found in providers/storage/isolated/storage.isolated.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 (this.dependantChannels.indexOf(key) < 0) {
            return true;
          }
Severity: Major
Found in src/module.js - About 45 mins to fix

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

Debug.prototype.onMessage = function (source, message) {
  if (source === 'control' && message.channel && !this.emitChannel) {
    this.emitChannel = message.channel;
    this.config = message.config;
    if (!this.config.global.console) {
Severity: Minor
Found in src/debug.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 bindDefault has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

ProxyBinder.prototype.bindDefault = function (port, api, manifest, internal) {
  'use strict';
  var metadata = {
    name: manifest.name,
    icon: manifest.icon,
Severity: Minor
Found in src/proxybinder.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 createLink has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

Manager.prototype.createLink = function (port, name, destination, destName,
                                         toDest) {
  if (!this.config.global) {
    this.once('config',
      this.createLink.bind(this, port, name, destination, destName));
Severity: Minor
Found in src/manager.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 start has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

function start(LogClient) {
  var logClient = new LogClient(),
    input = document.getElementById('msg-input');

  input.focus();
Severity: Minor
Found in demo/advancedlogging/page.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 (k) {
              if (y !== 0) {
                y--;
              } else {
                x -= 2;
Severity: Major
Found in demo/connections/third-party/qr/qr.js - About 45 mins to fix

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

var record = function (level, source, message) {
  'use strict';
  var formatted = '<span style="';
  if (level === 'debug') {
    formatted += "color:#888;";
Severity: Minor
Found in demo/advancedlogging/logger.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 WS has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

var WS = function (cap, dispatchEvent, url, protocols, socket) {
Severity: Minor
Found in providers/core/core.websocket.js - About 35 mins to fix

Function open has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

XhrProvider.prototype.open = function(method, url, async, user, password) {
Severity: Minor
Found in providers/core/core.xhr.js - About 35 mins to fix

Function onOpen has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

  onOpen: function (id, name, page, resources, postMessage) {
Severity: Minor
Found in providers/core/core.view.js - About 35 mins to fix

Function PeerConnection has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

function PeerConnection(portModule, dispatchEvent,
                        RTCPeerConnection, RTCSessionDescription,
                        RTCIceCandidate) {
Severity: Minor
Found in providers/core/core.peerconnection.js - About 35 mins to fix

Function conform has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

Consumer.conform = function (template, from, externals, separate, debug) {
Severity: Minor
Found in src/consumer.js - About 35 mins to fix

Function onOpen has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

  this.onOpen = function (id, name, page, resources, postMessage) {
Severity: Minor
Found in demo/connections/heightCustomViewProvider.js - About 35 mins to fix

Function setup has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

PeerConnection.prototype.setup = function (signallingChannelId, peerName,
                                           stunServers, initiateConnection,
                                           continuation) {
Severity: Minor
Found in providers/core/core.peerconnection.js - About 35 mins to fix

Function createLink has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

Manager.prototype.createLink = function (port, name, destination, destName,
                                         toDest) {
Severity: Minor
Found in src/manager.js - About 35 mins to fix

Function exports has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

module.exports = function (grunt) {
  'use strict';
  /**
   * GRUNT CONFIG
   **/
Severity: Minor
Found in Gruntfile.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

Severity
Category
Status
Source
Language