Factlink/factlink-core

View on GitHub

Showing 37 of 52 total issues

File sinon-1.2.0.js has 2078 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 * Sinon.JS 1.2.0, 2011/09/27
 *
 * @author Christian Johansen (christian@cjohansen.no)
 *
Severity: Major
Found in public/javascripts/testing/sinon-1.2.0.js - About 5 days to fix

Function sinon has a Cognitive Complexity of 105 (exceeds 5 allowed). Consider refactoring.
Open

var sinon = (function () {
    var div = typeof document != "undefined" && document.createElement("div");

    function isNode(obj) {
        var success = false;
Severity: Minor
Found in public/javascripts/testing/sinon-1.2.0.js - About 2 days 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 FakeXMLHttpRequest has a Cognitive Complexity of 75 (exceeds 5 allowed). Consider refactoring.
Open

sinon.FakeXMLHttpRequest = (function () {
    /*jsl:ignore*/
    var unsafeHeaders = {
        "Accept-Charset": true,
        "Accept-Encoding": true,
Severity: Minor
Found in public/javascripts/testing/sinon-1.2.0.js - About 1 day 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 clock has a Cognitive Complexity of 61 (exceeds 5 allowed). Consider refactoring.
Open

sinon.clock = (function () {
    var id = 0;

    function addTimer(args, recurring) {
        if (args.length === 0) {
Severity: Minor
Found in public/javascripts/testing/sinon-1.2.0.js - About 1 day 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 fakeServer has a Cognitive Complexity of 61 (exceeds 5 allowed). Consider refactoring.
Open

sinon.fakeServer = (function () {
    var push = [].push;
    function F() {}

    function create(proto) {
Severity: Minor
Found in public/javascripts/testing/sinon-1.2.0.js - About 1 day 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 FakeXMLHttpRequest has 238 lines of code (exceeds 25 allowed). Consider refactoring.
Open

sinon.FakeXMLHttpRequest = (function () {
    /*jsl:ignore*/
    var unsafeHeaders = {
        "Accept-Charset": true,
        "Accept-Encoding": true,
Severity: Major
Found in public/javascripts/testing/sinon-1.2.0.js - About 1 day to fix

Function expectation has 189 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    sinon.expectation = (function () {
        var slice = Array.prototype.slice;
        var _invoke = sinon.spy.invoke;

        function callCountInWords(callCount) {
Severity: Major
Found in public/javascripts/testing/sinon-1.2.0.js - About 7 hrs to fix

Function clock has 171 lines of code (exceeds 25 allowed). Consider refactoring.
Open

sinon.clock = (function () {
    var id = 0;

    function addTimer(args, recurring) {
        if (args.length === 0) {
Severity: Major
Found in public/javascripts/testing/sinon-1.2.0.js - About 6 hrs to fix

Function sinon has 170 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var sinon = (function () {
    var div = typeof document != "undefined" && document.createElement("div");

    function isNode(obj) {
        var success = false;
Severity: Major
Found in public/javascripts/testing/sinon-1.2.0.js - About 6 hrs to fix

Function fakeServer has 131 lines of code (exceeds 25 allowed). Consider refactoring.
Open

sinon.fakeServer = (function () {
    var push = [].push;
    function F() {}

    function create(proto) {
Severity: Major
Found in public/javascripts/testing/sinon-1.2.0.js - About 5 hrs to fix

Method pull has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

def pull(dep)
  required_file = nil # Make sure var is still in scope in rescue block
  begin
    # Loop through all the specified autorequires for the
    # dependency. If there are none, use the dependency's name
Severity: Minor
Found in bin/benchmark.rb - 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 useFakeTimers has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

sinon.useFakeTimers = (function (global) {
    var methods = ["Date", "setTimeout", "setInterval", "clearTimeout", "clearInterval"];

    function restore() {
        var method;
Severity: Minor
Found in public/javascripts/testing/sinon-1.2.0.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 Date has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        Date: (function () {
            var NativeDate = Date;

            function ClockDate(year, month, date, hour, minute, second, ms) {
                // Defensive and verbose to avoid potential harm in passing
Severity: Minor
Found in public/javascripts/testing/sinon-1.2.0.js - About 1 hr to fix

Method dead has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private def dead(activity)
      base_activity_data = {
          action: activity.action,
          created_at: activity.created_at.to_time,
          id: activity.id,
Severity: Minor
Found in app/interactors/backend/activities.rb - About 1 hr to fix

Function deepEqual has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        deepEqual: function deepEqual(a, b) {
            if (typeof a != "object" || typeof b != "object") {
                return a === b;
            }

Severity: Minor
Found in public/javascripts/testing/sinon-1.2.0.js - About 1 hr to fix

Function useFakeTimers has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

sinon.useFakeTimers = (function (global) {
    var methods = ["Date", "setTimeout", "setInterval", "clearTimeout", "clearInterval"];

    function restore() {
        var method;
Severity: Minor
Found in public/javascripts/testing/sinon-1.2.0.js - About 1 hr to fix

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

        wrapMethod: function wrapMethod(object, property, method) {
            if (!object) {
                throw new TypeError("Should wrap property of object");
            }

Severity: Minor
Found in public/javascripts/testing/sinon-1.2.0.js - About 1 hr to fix

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

            verifyCallAllowed: function verifyCallAllowed(thisValue, args) {
                if (receivedMaxCalls(this)) {
                    this.failed = true;
                    sinon.expectation.fail(this.method + " already called " + times(this.maxCalls));
                }
Severity: Minor
Found in public/javascripts/testing/sinon-1.2.0.js - About 1 hr to fix

Method comments has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def comments(output)
    FactData.all.sort_by(&:fact_id).each do |fact_data|
      comment_sorter = lambda do |comment|
        comment.created_at.utc.to_s + comment.content + comment.created_by.username
      end
Severity: Minor
Found in app/classes/export.rb - About 1 hr to fix

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

        setResponseBody: function setResponseBody(body) {
            if (this.readyState == FakeXMLHttpRequest.DONE) {
                throw new Error("Request done");
            }

Severity: Minor
Found in public/javascripts/testing/sinon-1.2.0.js - About 1 hr to fix
Severity
Category
Status
Source
Language