freedomjs/freedom

View on GitHub

Showing 177 of 262 total issues

File qr.js has 808 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// [qr.js](http://neocotic.com/qr.js)  
// (c) 2013 Alasdair Mercer  
// Freely distributable under the MIT license.  
// Based on [jsqrencode](http://code.google.com/p/jsqrencode/)  
// (c) 2010 tz@execpc.com  
Severity: Major
Found in demo/connections/third-party/qr/qr.js - About 1 day to fix

Function exports has 370 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function (grunt) {
  'use strict';
  /**
   * GRUNT CONFIG
   **/
Severity: Major
Found in Gruntfile.js - About 1 day to fix

Function generateFrame has 277 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  function generateFrame(str) {
    var i, j, k, m, t, v, x, y;

    // Find the smallest version that fits the string.
    t = str.length;
Severity: Major
Found in demo/connections/third-party/qr/qr.js - About 1 day to fix

Function saveAs has 182 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  (function (view) {
      'use strict';
      var doc = view.document,
      // only get URL when necessary in case BlobBuilder.js hasn't overridden it yet
          get_URL = function () {
Severity: Major
Found in demo/filedrop/FileSaver.js - About 7 hrs to fix

Function saveAs has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
Open

  (function (view) {
      'use strict';
      var doc = view.document,
      // only get URL when necessary in case BlobBuilder.js hasn't overridden it yet
          get_URL = function () {
Severity: Minor
Found in demo/filedrop/FileSaver.js - About 6 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 41 (exceeds 5 allowed). Consider refactoring.
Open

Module.prototype.onMessage = function (flow, message) {
  if (this.failed && message.to) {
    // We've attempted to load the module and failed, so short-circuit any
    // messages bound for the provider, and respond with an error reply instead.
    // This error is handled in Consumer, resulting in triggering the
Severity: Minor
Found in src/module.js - About 6 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 Gruntfile.js has 405 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*jslint node:true*/
/**
 * Gruntfile for freedom.js
 *
 * Here are the common tasks used:
Severity: Minor
Found in Gruntfile.js - About 5 hrs to fix

Function getProvider has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
Open

Provider.prototype.getProvider = function (source, identifier, args) {
  if (!this.providerCls) {
    this.debug.error('Cannot instantiate provider, since it is not provided');
    return {instance: undefined, onmsg: undefined};
  }
Severity: Minor
Found in src/provider.js - About 5 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 conform has a Cognitive Complexity of 34 (exceeds 5 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: Minor
Found in src/consumer.js - About 5 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 module.js has 375 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*jslint indent:2,node:true,sloppy:true */
var util = require('./util');
var Provider = require('./provider');

/**
Severity: Minor
Found in src/module.js - About 5 hrs to fix

File core.peerconnection.js has 363 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*globals console, RTCPeerConnection, webkitRTCPeerConnection */
/*globals mozRTCPeerConnection, RTCSessionDescription, RTCIceCandidate */
/*globals mozRTCSessionDescription, mozRTCIceCandidate */
/*globals ArrayBuffer, Blob */
/*jslint indent:2,sloppy:true,node:true */
Severity: Minor
Found in providers/core/core.peerconnection.js - About 4 hrs to fix

Function getProvider has 111 lines of code (exceeds 25 allowed). Consider refactoring.
Open

Provider.prototype.getProvider = function (source, identifier, args) {
  if (!this.providerCls) {
    this.debug.error('Cannot instantiate provider, since it is not provided');
    return {instance: undefined, onmsg: undefined};
  }
Severity: Major
Found in src/provider.js - About 4 hrs to fix

Function FileSaver has 108 lines of code (exceeds 25 allowed). Consider refactoring.
Open

          FileSaver = function (blob, name) {
            // First try a.download, then web filesystem, then object URLs
            var filesaver = this,
                type = blob.type,
                blob_changed = false,
Severity: Major
Found in demo/filedrop/FileSaver.js - About 4 hrs to fix

Function ApiInterface has 104 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var ApiInterface = function(def, onMsg, emit, debug) {
  var inflight = {},
      events = null,
      emitter = null,
      reqId = 0,
Severity: Major
Found in src/proxy/apiInterface.js - About 4 hrs to fix

Function handleEvents has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

util.handleEvents = function(obj) {
  var eventState = {
    DEBUG_BACKREF: obj,
    multiple: {},
    maybemultiple: [],
Severity: Minor
Found in src/util.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 setup has 96 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var setup = function (context, manifest, config) {
  'use strict';
  var debug = new Debug(),
    hub = new Hub(debug),
    resource = new Resource(debug),
Severity: Major
Found in src/entry.js - About 3 hrs to fix

File moduleinternal.js has 318 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*jslint indent:2, node:true,sloppy:true */
var PromiseCompat = require('es6-promise').Promise;

var ApiInterface = require('./proxy/apiInterface');
var Provider = require('./provider');
Severity: Minor
Found in src/moduleinternal.js - About 3 hrs to fix

Function onMessage has a Cognitive Complexity of 25 (exceeds 5 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: 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

Function emitMessage has a Cognitive Complexity of 25 (exceeds 5 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: Minor
Found in src/module.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 onMessage has 89 lines of code (exceeds 25 allowed). Consider refactoring.
Open

Module.prototype.onMessage = function (flow, message) {
  if (this.failed && message.to) {
    // We've attempted to load the module and failed, so short-circuit any
    // messages bound for the provider, and respond with an error reply instead.
    // This error is handled in Consumer, resulting in triggering the
Severity: Major
Found in src/module.js - About 3 hrs to fix
Severity
Category
Status
Source
Language