freedomjs/freedom

View on GitHub

Showing 177 of 262 total issues

Function applyMask has 88 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  function applyMask(mask) {
    var x, y, r3x, r3y;

    switch (mask) {
      case 0:
Severity: Major
Found in demo/connections/third-party/qr/qr.js - About 3 hrs to fix

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

util.handleEvents = function(obj) {
  var eventState = {
    DEBUG_BACKREF: obj,
    multiple: {},
    maybemultiple: [],
Severity: Major
Found in src/util.js - About 3 hrs to fix

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

Provider.prototype.getProxyInterface = function () {
  var func = function (p) {
    return p.getInterface();
  }.bind({}, this);

Severity: Minor
Found in src/provider.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 provider.js has 309 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*jslint indent:2, node:true, sloppy:true, browser:true */
var Consumer = require('./consumer');
var util = require('./util');

/**
Severity: Minor
Found in src/provider.js - About 3 hrs to fix

Function start has 85 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function start(ChatClient) {
  var chatClient = new ChatClient(),
    // If messages are going to a specific user, store that here.
    activeBuddylistEntry,
    buddylist,
Severity: Major
Found in demo/chat/page.js - About 3 hrs to fix

File consumer.js has 303 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*globals Blob, ArrayBuffer, DataView */
/*jslint indent:2, node:true, sloppy:true */
var util = require('./util');

/**
Severity: Minor
Found in src/consumer.js - About 3 hrs to fix

Function conform has 78 lines of code (exceeds 25 allowed). Consider refactoring.
Open

Consumer.conform = function (template, from, externals, separate, debug) {
  /* jshint -W086 */
  if (typeof (from) === 'function' && template !== 'proxy') {
    //from = undefined;
    //throw "Trying to conform a function";
Severity: Major
Found in src/consumer.js - About 3 hrs to fix

Function onmsg has 74 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    onmsg: function (port, src, msg) {
      var prop, debug, args, returnPromise, ret;
      if (msg.action === 'method') {
        if (typeof this[msg.type] !== 'function') {
          port.debug.warn("Provider does not implement " + msg.type + "()!");
Severity: Major
Found in src/provider.js - About 2 hrs to fix

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

ModuleInternal.prototype.loadLinks = function (items) {
  var i, proxy, provider, core,
    manifestPredicate = function (name, flow, msg) {
      return flow === 'manifest' && msg.name === name;
    },
Severity: Major
Found in src/moduleinternal.js - About 2 hrs to fix

Function bindChannel has 70 lines of code (exceeds 25 allowed). Consider refactoring.
Open

Core_unprivileged.prototype.bindChannel = function(identifier, continuation, source) {
  var toBind = Core_unprivileged.unboundChannels[identifier],
      newSource = !source;

  // when bindChannel is called directly, source will be undefined.
Severity: Major
Found in providers/core/core.unprivileged.js - About 2 hrs to fix

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

Module.prototype.deregisterFlow = function (flow, internal) {
  var key,
    map = internal ? this.internalPortMap : this.externalPortMap;
  // TODO: this is inefficient, but seems less confusing than a 3rd
  // reverse lookup map.
Severity: Minor
Found in src/module.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 aiMove has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

Board.prototype.aiMove = function () {
  'use strict';
  if (this.playerMove) {
    return;
  }
Severity: Minor
Found in demo/tictak/main.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 emitMessage has 68 lines of code (exceeds 25 allowed). Consider refactoring.
Open

Module.prototype.emitMessage = function (name, message) {
  if (this.internalPortMap[name] === false && message.channel) {
    this.internalPortMap[name] = message.channel;
    this.emit('internalChannelReady');
    return;
Severity: Major
Found in src/module.js - About 2 hrs to fix

Function setup has 65 lines of code (exceeds 25 allowed). Consider refactoring.
Open

PeerConnection.prototype.setup = function (signallingChannelId, peerName,
                                           stunServers, initiateConnection,
                                           continuation) {
  this.peerName = peerName;
  var mocks = {RTCPeerConnection: this.RTCPeerConnection,
Severity: Major
Found in providers/core/core.peerconnection.js - About 2 hrs to fix

Function isRunning has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

Policy.prototype.isRunning = function(runtime, id, from, fullMatch) {
  var i = 0, j = 0, okay;
  for (i = 0; i < runtime.modules.length; i += 1) {
    if (fullMatch && runtime.modules[i].length === from.length + 1) {
      okay = true;
Severity: Minor
Found in src/policy.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 getCore has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

Api.prototype.getCore = function(name, from) {
  return new PromiseCompat(function(resolve, reject) {
    if (this.apis[name]) {
      if (this.providers[name]) {
        var args = {};
Severity: Minor
Found in src/api.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 onMessage has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

Consumer.prototype.onMessage = function (source, message) {
  if (source === 'control' && message.reverse) {
    this.emitChannel = message.channel;
    this.emit(this.emitChannel, {
      type: 'channel announcement',
Severity: Minor
Found in src/consumer.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 mapProxies has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

ModuleInternal.prototype.mapProxies = function (manifest) {
  var proxies = [], seen = ['core'], i, obj;

  if (manifest.permissions) {
    for (i = 0; i < manifest.permissions.length; i += 1) {
Severity: Minor
Found in src/moduleinternal.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 SimpleDataPeer has 59 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function SimpleDataPeer(peerName, stunServers, dataChannelCallbacks, mocks) {
  var constraints,
    config,
    i;
  this.peerName = peerName;
Severity: Major
Found in providers/core/core.peerconnection.js - About 2 hrs to fix

Function start has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

function start(ChatClient) {
  var chatClient = new ChatClient(),
    // If messages are going to a specific user, store that here.
    activeBuddylistEntry,
    buddylist,
Severity: Minor
Found in demo/chat/page.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