freedomjs/freedom

View on GitHub

Showing 177 of 262 total issues

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

Manager.prototype.onMessage = function (flow, message) {
  var reverseFlow = this.controlFlows[flow], origin;
  if (!reverseFlow) {
    this.debug.warn("Unknown message source: " + flow);
    return;
Severity: Minor
Found in src/manager.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 56 lines of code (exceeds 25 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: Major
Found in src/moduleinternal.js - About 2 hrs to fix

Function onMessage has 54 lines of code (exceeds 25 allowed). Consider refactoring.
Open

Provider.prototype.onMessage = function (source, message) {
  if (source === 'control' && message.reverse) {
    this.channels[message.name] = message.channel;
    this.emit(message.channel, {
      type: 'channel announcement',
Severity: Major
Found in src/provider.js - About 2 hrs to fix

Function onMessage has 54 lines of code (exceeds 25 allowed). Consider refactoring.
Open

Manager.prototype.onMessage = function (flow, message) {
  var reverseFlow = this.controlFlows[flow], origin;
  if (!reverseFlow) {
    this.debug.warn("Unknown message source: " + flow);
    return;
Severity: Major
Found in src/manager.js - About 2 hrs to fix

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

ModuleInternal.prototype.onMessage = function (flow, message) {
  if (flow === 'control') {
    if (!this.controlChannel && message.channel) {
      this.controlChannel = message.channel;
      util.mixin(this.config, message.config);
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 checkBadness has 51 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  function checkBadness() {
    var b, b1, bad, big, bw, count, h, x, y;
    bad = bw = count = 0;

    // Blocks of same colour.
Severity: Major
Found in demo/connections/third-party/qr/qr.js - About 2 hrs to fix

Function send has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

WS.prototype.send = function (data, continuation) {
  var toSend = data.text || data.binary || data.buffer,
    errcode,
    message;

Severity: Minor
Found in providers/core/core.websocket.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 initialize has 47 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function initialize(fileDrop) {
  FileRead.app = fileDrop;

  fileDrop.on('serve-descriptor', function (val) {
    var displayUrl = window.location + "#" + JSON.stringify(val);
Severity: Minor
Found in demo/filedrop/page.js - About 1 hr to fix

Function WS has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var WS = function (cap, dispatchEvent, url, protocols, socket) {
  var WSImplementation = null,
    error;
  this.isNode = nodeStyle;
  if (typeof socket !== 'undefined') {
Severity: Minor
Found in providers/core/core.websocket.js - About 1 hr to fix

Function boot has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

Chat.prototype.boot = function () {
  this.social.login({
    agent: 'chatdemo',
    version: '0.1',
    url: '',
Severity: Minor
Found in demo/chat/main.js - About 1 hr to fix

Function loadScripts has 44 lines of code (exceeds 25 allowed). Consider refactoring.
Open

ModuleInternal.prototype.loadScripts = function (from, scripts) {
  var importer = function (script, resolve, reject) {
    try {
      this.config.global.importScripts(script);
      resolve(true);
Severity: Minor
Found in src/moduleinternal.js - About 1 hr to fix

Function loadLinks has a Cognitive Complexity of 14 (exceeds 5 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: Minor
Found in src/moduleinternal.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 print has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

Logger_console.prototype.print = function (severity, source, msg) {
  var arr = msg;
  if (typeof this.console === 'undefined' ||
      this.console.freedom === true) {
    return;
Severity: Minor
Found in providers/core/core.console.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 show has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

Core_View.prototype.show = function (name, continuation) {
  if (this.id) {
    return continuation(undefined, {
      errcode: 'ALREADY_OPEN',
      message: 'Cannot show multiple views through one instance.'
Severity: Minor
Found in providers/core/core.view.js - About 1 hr to fix

Function HeightView has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var HeightView = function () {
  'use strict';
  window.addEventListener('message', function (msg, source) {
    if (this.frameWindow === source.source) {
      this.postMessage(msg.data);
Severity: Minor
Found in demo/connections/heightCustomViewProvider.js - About 1 hr to fix

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

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

  onOpen: function (id, name, page, resources, postMessage) {
    var container = document.body,
      root,
      frame;
    
Severity: Minor
Found in providers/core/core.view.js - About 1 hr to fix

Function onMessage has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

ModuleInternal.prototype.onMessage = function (flow, message) {
  if (flow === 'control') {
    if (!this.controlChannel && message.channel) {
      this.controlChannel = message.channel;
      util.mixin(this.config, message.config);
Severity: Minor
Found in src/moduleinternal.js - About 1 hr to fix

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

Function getContents has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

Resource.prototype.getContents = function (url) {
  return new PromiseCompat(function (resolve, reject) {
    var prop;
    if (!url) {
      this.debug.warn("Asked to get contents of undefined URL.");
Severity: Minor
Found in src/resource.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

Severity
Category
Status
Source
Language