AgileVentures/WebsiteOne

View on GitHub

Showing 197 of 206 total issues

File bootstrap-datepicker.js has 1769 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* =========================================================
 * bootstrap-datepicker.js
 * Repo: https://github.com/uxsolutions/bootstrap-datepicker/
 * Demo: https://eternicode.github.io/bootstrap-datepicker/
 * Docs: https://bootstrap-datepicker.readthedocs.org/
Severity: Major
Found in app/assets/javascripts/bootstrap-datepicker.js - About 4 days to fix

File typeahead.jquery.js has 1684 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*!
 * typeahead.js 1.3.1
 * https://github.com/corejavascript/typeahead.js
 * Copyright 2013-2020 Twitter, Inc. and other contributors; Licensed MIT
 */
Severity: Major
Found in app/assets/javascripts/typeahead.jquery.js - About 4 days to fix

Function Typeahead has 292 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    var Typeahead = function() {
        "use strict";
        function Typeahead(o, www) {
            var onFocused, onBlurred, onEnterKeyed, onTabKeyed, onEscKeyed, onUpKeyed, onDownKeyed, onLeftKeyed, onRightKeyed, onQueryChanged, onWhitespaceChanged;
            o = o || {};
Severity: Major
Found in app/assets/javascripts/typeahead.jquery.js - About 1 day to fix

Function Input has 229 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    var Input = function() {
        "use strict";
        var specialKeyCodeMap;
        specialKeyCodeMap = {
            9: "tab",
Severity: Major
Found in app/assets/javascripts/typeahead.jquery.js - About 1 day to fix

Function Dataset has 211 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    var Dataset = function() {
        "use strict";
        var keys, nameGenerator;
        keys = {
            dataset: "tt-selectable-dataset",
Severity: Major
Found in app/assets/javascripts/typeahead.jquery.js - About 1 day to fix

Function fill has 151 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        fill: function(){
            var d = new Date(this.viewDate),
                year = d.getUTCFullYear(),
                month = d.getUTCMonth(),
                startYear = this.o.startDate !== -Infinity ? this.o.startDate.getUTCFullYear() : -Infinity,
Severity: Major
Found in app/assets/javascripts/bootstrap-datepicker.js - About 6 hrs to fix

Method 'keydown' has a complexity of 43.
Open

        keydown: function(e){

Limit Cyclomatic Complexity (complexity)

Cyclomatic complexity measures the number of linearly independent paths through a program's source code. This rule allows setting a cyclomatic complexity threshold.

function a(x) {
    if (true) {
        return x; // 1st path
    } else if (false) {
        return x+1; // 2nd path
    } else {
        return 4; // 3rd path
    }
}

Rule Details

This rule is aimed at reducing code complexity by capping the amount of cyclomatic complexity allowed in a program. As such, it will warn when the cyclomatic complexity crosses the configured threshold (default is 20).

Examples of incorrect code for a maximum of 2:

/*eslint complexity: ["error", 2]*/

function a(x) {
    if (true) {
        return x;
    } else if (false) {
        return x+1;
    } else {
        return 4; // 3rd path
    }
}

Examples of correct code for a maximum of 2:

/*eslint complexity: ["error", 2]*/

function a(x) {
    if (true) {
        return x;
    } else {
        return 4;
    }
}

Options

Optionally, you may specify a max object property:

"complexity": ["error", 2]

is equivalent to

"complexity": ["error", { "max": 2 }]

Deprecated: the object property maximum is deprecated. Please use the property max instead.

When Not To Use It

If you can't determine an appropriate complexity limit for your code, then it's best to disable this rule.

Further Reading

Related Rules

  • [max-depth](max-depth.md)
  • [max-len](max-len.md)
  • [max-nested-callbacks](max-nested-callbacks.md)
  • [max-params](max-params.md)
  • [max-statements](max-statements.md) Source: http://eslint.org/docs/rules/

Function Menu has 144 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    var Menu = function() {
        "use strict";
        function Menu(o, www) {
            var that = this;
            o = o || {};
Severity: Major
Found in app/assets/javascripts/typeahead.jquery.js - About 5 hrs to fix

Function _ has 140 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    var _ = function() {
        "use strict";
        return {
            isMsie: function() {
                return /(msie|trident)/i.test(navigator.userAgent) ? navigator.userAgent.match(/(msie |rv:)(\d+(.\d+)?)/i)[2] : false;
Severity: Major
Found in app/assets/javascripts/typeahead.jquery.js - About 5 hrs to fix

Method 'fill' has a complexity of 39.
Open

        fill: function(){

Limit Cyclomatic Complexity (complexity)

Cyclomatic complexity measures the number of linearly independent paths through a program's source code. This rule allows setting a cyclomatic complexity threshold.

function a(x) {
    if (true) {
        return x; // 1st path
    } else if (false) {
        return x+1; // 2nd path
    } else {
        return 4; // 3rd path
    }
}

Rule Details

This rule is aimed at reducing code complexity by capping the amount of cyclomatic complexity allowed in a program. As such, it will warn when the cyclomatic complexity crosses the configured threshold (default is 20).

Examples of incorrect code for a maximum of 2:

/*eslint complexity: ["error", 2]*/

function a(x) {
    if (true) {
        return x;
    } else if (false) {
        return x+1;
    } else {
        return 4; // 3rd path
    }
}

Examples of correct code for a maximum of 2:

/*eslint complexity: ["error", 2]*/

function a(x) {
    if (true) {
        return x;
    } else {
        return 4;
    }
}

Options

Optionally, you may specify a max object property:

"complexity": ["error", 2]

is equivalent to

"complexity": ["error", { "max": 2 }]

Deprecated: the object property maximum is deprecated. Please use the property max instead.

When Not To Use It

If you can't determine an appropriate complexity limit for your code, then it's best to disable this rule.

Further Reading

Related Rules

  • [max-depth](max-depth.md)
  • [max-len](max-len.md)
  • [max-nested-callbacks](max-nested-callbacks.md)
  • [max-params](max-params.md)
  • [max-statements](max-statements.md) Source: http://eslint.org/docs/rules/

Class Event has 40 methods (exceeds 20 allowed). Consider refactoring.
Open

class Event < ApplicationRecord
  has_many :event_instances
  belongs_to :project, optional: true
  belongs_to :creator, class_name: 'User', optional: true
  has_and_belongs_to_many :slack_channels
Severity: Minor
Found in app/models/event.rb - About 5 hrs to fix

Method 'fill' has too many statements (58). Maximum allowed is 30.
Open

        fill: function(){

enforce a maximum number of statements allowed in function blocks (max-statements)

The max-statements rule allows you to specify the maximum number of statements allowed in a function.

function foo() {
  var bar = 1; // one statement
  var baz = 2; // two statements
  var qux = 3; // three statements
}

Rule Details

This rule enforces a maximum number of statements allowed in function blocks.

Options

This rule has a number or object option:

  • "max" (default 10) enforces a maximum number of statements allows in function blocks

Deprecated: The object property maximum is deprecated; please use the object property max instead.

This rule has an object option:

  • "ignoreTopLevelFunctions": true ignores top-level functions

max

Examples of incorrect code for this rule with the default { "max": 10 } option:

/*eslint max-statements: ["error", 10]*/
/*eslint-env es6*/

function foo() {
  var foo1 = 1;
  var foo2 = 2;
  var foo3 = 3;
  var foo4 = 4;
  var foo5 = 5;
  var foo6 = 6;
  var foo7 = 7;
  var foo8 = 8;
  var foo9 = 9;
  var foo10 = 10;

  var foo11 = 11; // Too many.
}

let foo = () => {
  var foo1 = 1;
  var foo2 = 2;
  var foo3 = 3;
  var foo4 = 4;
  var foo5 = 5;
  var foo6 = 6;
  var foo7 = 7;
  var foo8 = 8;
  var foo9 = 9;
  var foo10 = 10;

  var foo11 = 11; // Too many.
};

Examples of correct code for this rule with the default { "max": 10 } option:

/*eslint max-statements: ["error", 10]*/
/*eslint-env es6*/

function foo() {
  var foo1 = 1;
  var foo2 = 2;
  var foo3 = 3;
  var foo4 = 4;
  var foo5 = 5;
  var foo6 = 6;
  var foo7 = 7;
  var foo8 = 8;
  var foo9 = 9;
  var foo10 = 10;
  return function () {

    // The number of statements in the inner function does not count toward the
    // statement maximum.

    return 42;
  };
}

let foo = () => {
  var foo1 = 1;
  var foo2 = 2;
  var foo3 = 3;
  var foo4 = 4;
  var foo5 = 5;
  var foo6 = 6;
  var foo7 = 7;
  var foo8 = 8;
  var foo9 = 9;
  var foo10 = 10;
  return function () {

    // The number of statements in the inner function does not count toward the
    // statement maximum.

    return 42;
  };
}

ignoreTopLevelFunctions

Examples of additional correct code for this rule with the { "max": 10 }, { "ignoreTopLevelFunctions": true } options:

/*eslint max-statements: ["error", 10, { "ignoreTopLevelFunctions": true }]*/

function foo() {
  var foo1 = 1;
  var foo2 = 2;
  var foo3 = 3;
  var foo4 = 4;
  var foo5 = 5;
  var foo6 = 6;
  var foo7 = 7;
  var foo8 = 8;
  var foo9 = 9;
  var foo10 = 10;
  var foo11 = 11;
}

Related Rules

  • [complexity](complexity.md)
  • [max-depth](max-depth.md)
  • [max-len](max-len.md)
  • [max-nested-callbacks](max-nested-callbacks.md)
  • [max-params](max-params.md) Source: http://eslint.org/docs/rules/

Method '_process_options' has a complexity of 31.
Open

        _process_options: function(opts){

Limit Cyclomatic Complexity (complexity)

Cyclomatic complexity measures the number of linearly independent paths through a program's source code. This rule allows setting a cyclomatic complexity threshold.

function a(x) {
    if (true) {
        return x; // 1st path
    } else if (false) {
        return x+1; // 2nd path
    } else {
        return 4; // 3rd path
    }
}

Rule Details

This rule is aimed at reducing code complexity by capping the amount of cyclomatic complexity allowed in a program. As such, it will warn when the cyclomatic complexity crosses the configured threshold (default is 20).

Examples of incorrect code for a maximum of 2:

/*eslint complexity: ["error", 2]*/

function a(x) {
    if (true) {
        return x;
    } else if (false) {
        return x+1;
    } else {
        return 4; // 3rd path
    }
}

Examples of correct code for a maximum of 2:

/*eslint complexity: ["error", 2]*/

function a(x) {
    if (true) {
        return x;
    } else {
        return 4;
    }
}

Options

Optionally, you may specify a max object property:

"complexity": ["error", 2]

is equivalent to

"complexity": ["error", { "max": 2 }]

Deprecated: the object property maximum is deprecated. Please use the property max instead.

When Not To Use It

If you can't determine an appropriate complexity limit for your code, then it's best to disable this rule.

Further Reading

Related Rules

  • [max-depth](max-depth.md)
  • [max-len](max-len.md)
  • [max-nested-callbacks](max-nested-callbacks.md)
  • [max-params](max-params.md)
  • [max-statements](max-statements.md) Source: http://eslint.org/docs/rules/

Function parseDate has 114 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        parseDate: function(date, format, language, assumeNearby){
            if (!date)
                return undefined;
            if (date instanceof Date)
                return date;
Severity: Major
Found in app/assets/javascripts/bootstrap-datepicker.js - About 4 hrs to fix

Method '_process_options' has too many statements (48). Maximum allowed is 30.
Open

        _process_options: function(opts){

enforce a maximum number of statements allowed in function blocks (max-statements)

The max-statements rule allows you to specify the maximum number of statements allowed in a function.

function foo() {
  var bar = 1; // one statement
  var baz = 2; // two statements
  var qux = 3; // three statements
}

Rule Details

This rule enforces a maximum number of statements allowed in function blocks.

Options

This rule has a number or object option:

  • "max" (default 10) enforces a maximum number of statements allows in function blocks

Deprecated: The object property maximum is deprecated; please use the object property max instead.

This rule has an object option:

  • "ignoreTopLevelFunctions": true ignores top-level functions

max

Examples of incorrect code for this rule with the default { "max": 10 } option:

/*eslint max-statements: ["error", 10]*/
/*eslint-env es6*/

function foo() {
  var foo1 = 1;
  var foo2 = 2;
  var foo3 = 3;
  var foo4 = 4;
  var foo5 = 5;
  var foo6 = 6;
  var foo7 = 7;
  var foo8 = 8;
  var foo9 = 9;
  var foo10 = 10;

  var foo11 = 11; // Too many.
}

let foo = () => {
  var foo1 = 1;
  var foo2 = 2;
  var foo3 = 3;
  var foo4 = 4;
  var foo5 = 5;
  var foo6 = 6;
  var foo7 = 7;
  var foo8 = 8;
  var foo9 = 9;
  var foo10 = 10;

  var foo11 = 11; // Too many.
};

Examples of correct code for this rule with the default { "max": 10 } option:

/*eslint max-statements: ["error", 10]*/
/*eslint-env es6*/

function foo() {
  var foo1 = 1;
  var foo2 = 2;
  var foo3 = 3;
  var foo4 = 4;
  var foo5 = 5;
  var foo6 = 6;
  var foo7 = 7;
  var foo8 = 8;
  var foo9 = 9;
  var foo10 = 10;
  return function () {

    // The number of statements in the inner function does not count toward the
    // statement maximum.

    return 42;
  };
}

let foo = () => {
  var foo1 = 1;
  var foo2 = 2;
  var foo3 = 3;
  var foo4 = 4;
  var foo5 = 5;
  var foo6 = 6;
  var foo7 = 7;
  var foo8 = 8;
  var foo9 = 9;
  var foo10 = 10;
  return function () {

    // The number of statements in the inner function does not count toward the
    // statement maximum.

    return 42;
  };
}

ignoreTopLevelFunctions

Examples of additional correct code for this rule with the { "max": 10 }, { "ignoreTopLevelFunctions": true } options:

/*eslint max-statements: ["error", 10, { "ignoreTopLevelFunctions": true }]*/

function foo() {
  var foo1 = 1;
  var foo2 = 2;
  var foo3 = 3;
  var foo4 = 4;
  var foo5 = 5;
  var foo6 = 6;
  var foo7 = 7;
  var foo8 = 8;
  var foo9 = 9;
  var foo10 = 10;
  var foo11 = 11;
}

Related Rules

  • [complexity](complexity.md)
  • [max-depth](max-depth.md)
  • [max-len](max-len.md)
  • [max-nested-callbacks](max-nested-callbacks.md)
  • [max-params](max-params.md) Source: http://eslint.org/docs/rules/

Function keydown has 94 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        keydown: function(e){
            if (!this.picker.is(':visible')){
                if (e.keyCode === 40 || e.keyCode === 27) { // allow down to re-show picker
                    this.show();
                    e.stopPropagation();
Severity: Major
Found in app/assets/javascripts/bootstrap-datepicker.js - About 3 hrs to fix

Function _process_options has 93 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        _process_options: function(opts){
            // Store raw options for reference
            this._o = $.extend({}, this._o, opts);
            // Processed options
            var o = this.o = $.extend({}, this._o);
Severity: Major
Found in app/assets/javascripts/bootstrap-datepicker.js - About 3 hrs to fix

Function WWW has 92 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    var WWW = function() {
        "use strict";
        var defaultClassNames = {
            wrapper: "twitter-typeahead",
            input: "tt-input",
Severity: Major
Found in app/assets/javascripts/typeahead.jquery.js - About 3 hrs to fix

Function EventEmitter has 87 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    var EventEmitter = function() {
        "use strict";
        var splitter = /\s+/, nextTick = getNextTick();
        return {
            onSync: onSync,
Severity: Major
Found in app/assets/javascripts/typeahead.jquery.js - About 3 hrs to fix

Function highlight has 85 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    var highlight = function(doc) {
        "use strict";
        var defaults = {
            node: null,
            pattern: null,
Severity: Major
Found in app/assets/javascripts/typeahead.jquery.js - About 3 hrs to fix
Severity
Category
Status
Source
Language