freedomjs/freedom

View on GitHub

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

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

IsolatedStorageProvider.prototype._flushQueue = function() {
  var i, elt;
  for (i = 0; i < this.queue.length; i += 1) {
    elt = this.queue[i];
    if (elt.cmd === "keys") {
Severity: Major
Found in providers/storage/isolated/storage.isolated.js and 1 other location - About 1 day to fix
providers/storage/indexeddb/storage.indexeddb.js on lines 259..278

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

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

IndexedDBStorageProvider.prototype.flushQueue = function () {
  var i, elt;
  for (i = 0; i < this.queue.length; i += 1) {
    elt = this.queue[i];
    if (elt.cmd === "keys") {
Severity: Major
Found in providers/storage/indexeddb/storage.indexeddb.js and 1 other location - About 1 day to fix
providers/storage/isolated/storage.isolated.js on lines 101..121

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

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

  var GALOIS_EXPONENT = [
    0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1d, 0x3a, 0x74, 0xe8, 0xcd, 0x87, 0x13, 0x26,
    0x4c, 0x98, 0x2d, 0x5a, 0xb4, 0x75, 0xea, 0xc9, 0x8f, 0x03, 0x06, 0x0c, 0x18, 0x30, 0x60, 0xc0,
    0x9d, 0x27, 0x4e, 0x9c, 0x25, 0x4a, 0x94, 0x35, 0x6a, 0xd4, 0xb5, 0x77, 0xee, 0xc1, 0x9f, 0x23,
    0x46, 0x8c, 0x05, 0x0a, 0x14, 0x28, 0x50, 0xa0, 0x5d, 0xba, 0x69, 0xd2, 0xb9, 0x6f, 0xde, 0xa1,
Severity: Major
Found in demo/connections/third-party/qr/qr.js and 1 other location - About 1 day to fix
demo/connections/third-party/qr/qr.js on lines 105..122

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

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

  var GALOIS_LOG = [
    0xff, 0x00, 0x01, 0x19, 0x02, 0x32, 0x1a, 0xc6, 0x03, 0xdf, 0x33, 0xee, 0x1b, 0x68, 0xc7, 0x4b,
    0x04, 0x64, 0xe0, 0x0e, 0x34, 0x8d, 0xef, 0x81, 0x1c, 0xc1, 0x69, 0xf8, 0xc8, 0x08, 0x4c, 0x71,
    0x05, 0x8a, 0x65, 0x2f, 0xe1, 0x24, 0x0f, 0x21, 0x35, 0x93, 0x8e, 0xda, 0xf0, 0x12, 0x82, 0x45,
    0x1d, 0xb5, 0xc2, 0x7d, 0x6a, 0x27, 0xf9, 0xb9, 0xc9, 0x9a, 0x09, 0x78, 0x4d, 0xe4, 0x72, 0xa6,
Severity: Major
Found in demo/connections/third-party/qr/qr.js and 1 other location - About 1 day to fix
demo/connections/third-party/qr/qr.js on lines 86..103

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

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

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

    for (i = -2; i < 2; i++) {
      frameBuffer[(x + i)     + width * (y - 2)]     = 1;
      frameBuffer[(x - 2)     + width * (y + i + 1)] = 1;
      frameBuffer[(x + 2)     + width * (y + i)]     = 1;
      frameBuffer[(x + i + 1) + width * (y + 2)]     = 1;
Severity: Major
Found in demo/connections/third-party/qr/qr.js and 1 other location - About 4 hrs to fix
demo/connections/third-party/qr/qr.js on lines 654..659

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

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 (x = 2; x < 4; x++) {
        frameBuffer[(y + x) + width * (k + 2)] = 1;
        frameBuffer[(y + 2) + width * (k + x + 1)] = 1;
        frameBuffer[(y + 4) + width * (k + x)] = 1;
        frameBuffer[(y + x + 1) + width * (k + 4)] = 1;
Severity: Major
Found in demo/connections/third-party/qr/qr.js and 1 other location - About 4 hrs to fix
demo/connections/third-party/qr/qr.js on lines 302..307

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

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 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
Severity
Category
Status
Source
Language