freedomjs/freedom

View on GitHub

Showing 177 of 262 total issues

Function get has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

Policy.prototype.get = function(lineage, id) {
  
  // Make sure that a module isn't getting located twice at the same time.
  // This is resolved by delaying if it until we see it in a 'moduleAdd' event.
  if (this.pending[id]) {
Severity: Minor
Found in src/policy.js - About 1 hr to fix

Function send has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

WebRTCTransportProvider.prototype.send = function(tag, data, continuation) {
  // console.log("TransportProvider.send." + this.name);
  if(!this._setup) {
    continuation(undefined, {
      "errcode": "NOTREADY",
Severity: Minor
Found in providers/transport/webrtc/transport.webrtc.js - About 1 hr to fix

Function format has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

Debug.prototype.format = function (severity, source, args) {
  var i, alist = [], argarr;
  if (typeof args === "string" && source) {
    try {
      argarr = JSON.parse(args);
Severity: Minor
Found in src/debug.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 register has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

Api.prototype.register = function(name, constructor, style, flags) {
  var i,
    args;

  this.providers[name] = {
Severity: Minor
Found in src/api.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 checkWin has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

Board.prototype.checkWin = function () {
  'use strict';
  var sets = ["012", "345", "678", "036", "147", "258", "048", "246"],
    s,
    set,
Severity: Minor
Found in demo/tictak/main.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 changeRoster has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

WSSocialProvider.prototype.changeRoster = function(id, stat) {
  var newStatus, result = {
    userId: id,
    clientId: id,
    lastUpdated: (this.clients.hasOwnProperty(id)) ? this.clients[id].lastUpdated: (new Date()).getTime(),
Severity: Minor
Found in providers/social/websocket-server/social.ws.js - About 1 hr to fix

Function removeLink has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

Manager.prototype.removeLink = function (port, name) {
  var reverse = this.hub.getDestination(name),
    rflow = this.reverseFlowMap[name],
    i;

Severity: Minor
Found in src/manager.js - About 1 hr to fix

Function onNegotiationNeeded has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

SimpleDataPeer.prototype.onNegotiationNeeded = function (e) {
  //console.log(this.peerName + ": " + "onNegotiationNeeded",
  //            JSON.stringify(this._pc), e);
  if (this.pcState !== SimpleDataPeerState.DISCONNECTED) {
    // Negotiation messages are falsely requested for new data channels.
Severity: Minor
Found in providers/core/core.peerconnection.js - About 1 hr to fix

Function httpResolver has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

Resource.prototype.httpResolver = function (manifest, url, resolve, reject) {
  var protocols = ["http", "https", "chrome", "chrome-extension", "resource",
                   "app", "gopher"],
    dirname,
    protocolIdx,
Severity: Minor
Found in src/resource.js - About 1 hr to fix

Function negotiateState has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var negotiateState = function (text, button, channel) {
  var state = {at: 0, text: text, button: button, channel: channel};
  button.innerText = 'CreateOffer';
  channel.on('ice', function (ice) {
    state.text.value += '\n' + ice;
Severity: Minor
Found in demo/datachannels/page.js - About 1 hr to fix

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

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

Function layout has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

User.prototype.layout = function () {
  if (this.phase !== 'entered') {
    return this.el;
  }
  var idx = uqueue.indexOf(this),
Severity: Minor
Found in demo/connections/view.js - About 1 hr to fix

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

module.exports = function (config) {
  'use strict';
  config.set({

    // base path that will be used to resolve all patterns (eg. files, exclude)
Severity: Minor
Found in karma.conf.js - About 1 hr to fix

Function _handleData has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

WebRTCTransportProvider.prototype._handleData = function(tag, buffer) {
  var currentTag;
  if (tag in this._chunks) {
    currentTag = this._chunks[tag];
    currentTag.buffers.push(buffer);
Severity: Minor
Found in providers/transport/webrtc/transport.webrtc.js - About 1 hr to fix

Function remove has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

IndexedDBStorageProvider.prototype.remove = function (key, continuation) {
  if (this.handle.initializing) {
    this.pushQueue("remove", key, null, continuation);
    return;
  } else if (this.handle.db === null) {
Severity: Minor
Found in providers/storage/indexeddb/storage.indexeddb.js - About 1 hr to fix

Function add has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

Policy.prototype.add = function(port, policy) {
  var runtime = {
    manager: port,
    modules: []
  };
Severity: Minor
Found in src/policy.js - About 1 hr to fix

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

Function checkWin has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

Board.prototype.checkWin = function () {
  'use strict';
  var sets = ["012", "345", "678", "036", "147", "258", "048", "246"],
    s,
    set,
Severity: Minor
Found in demo/tictak/main.js - About 1 hr to fix

Function sendMessage has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

SocialTransport.prototype.sendMessage = function (to, tag, msg) {
  if (!this.clients.hasOwnProperty(to)) {
    return this.createReject('SEND_INVALIDDESTINATION');
  } else if (this.clients[to].status === this.STATUS.OFFLINE) {
    return this.createReject('OFFLINE');
Severity: Minor
Found in demo/filedrop/freedom-modules/social-transport.js - About 1 hr to fix
Severity
Category
Status
Source
Language