freedomjs/freedom

View on GitHub

Showing 262 of 262 total issues

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 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 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 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

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    if (msg.data.src && msg.data.src !== 'out') {
      this.emitMessage(msg.data.flow, msg.data.message);
    }
Severity: Major
Found in src/link/frame.js and 1 other location - About 1 hr to fix
src/link/frame.js on lines 73..75

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 59.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    if (msg.data.src && msg.data.src !== 'in') {
      this.emitMessage(msg.data.flow, msg.data.message);
    }
Severity: Major
Found in src/link/frame.js and 1 other location - About 1 hr to fix
src/link/frame.js on lines 131..133

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 59.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

Identical blocks of code found in 2 locations. Consider refactoring.
Open

          for (r3x = r3y, x = 0; x < width; x++, r3x++) {
            if (r3x === 3) r3x = 0;

            if (!r3x && !isMasked(x, y)) {
              frameBuffer[x + y * width] ^= 1;
Severity: Major
Found in demo/connections/third-party/qr/qr.js and 1 other location - About 1 hr to fix
demo/connections/third-party/qr/qr.js on lines 400..406

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 58.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    for (j = 0; j < neccBlock2; j++) {
      eccBuffer[y++] = stringBuffer[(neccBlock1 * dataBlock) + i + (j * (dataBlock + 1))];
    }
Severity: Major
Found in demo/connections/third-party/qr/qr.js and 1 other location - About 1 hr to fix
demo/connections/third-party/qr/qr.js on lines 860..862

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 58.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

      for (j = 0; j < neccBlock2; j++) {
        eccBuffer[y++] = stringBuffer[(neccBlock1 * dataBlock) + i + (j * (dataBlock + 1))];
      }
Severity: Major
Found in demo/connections/third-party/qr/qr.js and 1 other location - About 1 hr to fix
demo/connections/third-party/qr/qr.js on lines 865..867

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 58.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

          for (r3x = 0, x = 0; x < width; x++, r3x++) {
            if (r3x === 3) r3x = 0;

            if (!r3x && !isMasked(x, y)) {
              frameBuffer[x + y * width] ^= 1;
Severity: Major
Found in demo/connections/third-party/qr/qr.js and 1 other location - About 1 hr to fix
demo/connections/third-party/qr/qr.js on lines 414..420

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 58.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Function format has 28 lines of code (exceeds 25 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

Function XhrProvider has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var XhrProvider = function(cap, dispatchEvent) {
  "use strict";
  if (typeof window !== "undefined" &&
      typeof window.XMLHttpRequest !== "undefined" &&
      XhrClass === null) { // freedom
Severity: Minor
Found in providers/core/core.xhr.js - About 1 hr to fix
Severity
Category
Status
Source
Language