Showing 44 of 61 total issues
File selectize.js
has 2258 lines of code (exceeds 250 allowed). Consider refactoring. Open
/**
* sifter.js
* Copyright (c) 2013 Brian Reavis & contributors
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
Function setup
has 132 lines of code (exceeds 25 allowed). Consider refactoring. Open
setup: function() {
var self = this;
var settings = self.settings;
var eventNS = self.eventNS;
var $window = $(window);
Function selectize
has 105 lines of code (exceeds 25 allowed). Consider refactoring. Open
$.fn.selectize = function(settings_user) {
var defaults = $.fn.selectize.defaults;
var settings = $.extend({}, defaults, settings_user);
var attr_data = settings.dataAttr;
var field_label = settings.labelField;
Method initialize
has 104 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(user)
user ||= User.new
if user.chief?
can :manage, :all
Function refreshOptions
has 94 lines of code (exceeds 25 allowed). Consider refactoring. Open
refreshOptions: function(triggerDropdown) {
var i, j, k, n, groups, groups_order, option, option_html, optgroup, optgroups, html, html_children, has_create_option;
var $active, $active_before, $create;
if (typeof triggerDropdown === 'undefined') {
Method build_server_tree
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def build_server_tree(tree, options= {})
result = ''
tree = Array.wrap tree
opts = {
# node and base node params
- Read upRead up
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 onKeyDown
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
onKeyDown: function(e) {
var isInput = e.target === this.$control_input[0];
var self = this;
if (self.isLocked) {
Function getSortFunction
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
Sifter.prototype.getSortFunction = function(search, options) {
var i, n, self, field, fields, fields_count, multiplier, multipliers, get_field, implicit_score, sort;
self = this;
search = self.prepareSearch(search, options);
Function init_select
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
var init_select = function($input, settings_element) {
var i, n, tagName, $children, order = 0;
var options = settings_element.options;
var readData = function($el) {
Function mixin
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
MicroPlugin.mixin = function(Interface) {
Interface.plugins = {};
/**
* Initializes the listed plugins (with options).
Function getScoreFunction
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
Sifter.prototype.getScoreFunction = function(search, options) {
var self, fields, tokens, token_count;
self = this;
search = self.prepareSearch(search, options);
Function Selectize
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
var Selectize = function($input, settings) {
var key, i, n, dir, input, self = this;
input = $input[0];
input.selectize = self;
Method main_navigation
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def main_navigation
render_navigation renderer: :bootstrap do |primary|
primary.dom_class = 'nav navbar-nav'
primary.selected_class = 'active'
- Read upRead up
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
Method admin_navigation
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def admin_navigation
render_navigation renderer: :bootstrap do |primary|
primary.dom_class = 'nav navbar-nav'
primary.selected_class = 'active'
primary.item :key_1_1, t('navigation.home'), root_path, class: 'item', icon: 'home'
- Read upRead up
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
Method build_server_tree
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
def build_server_tree(tree, options= {})
result = ''
tree = Array.wrap tree
opts = {
# node and base node params
Function setActiveItem
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
setActiveItem: function($item, e) {
var self = this;
var eventName;
var i, idx, begin, end, item, swap;
var $last;
Function autoGrow
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
var autoGrow = function($input) {
var currentWidth = null;
var update = function(e, options) {
var value, keyCode, printable, placeholder, width;
Function deleteSelection
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
deleteSelection: function(e) {
var i, n, direction, selection, values, caret, option_select, $option_select, $tail;
var self = this;
direction = (e && e.keyCode === KEY_BACKSPACE) ? -1 : 1;
Method compare
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def compare
return not_allowed unless history_allowed?
if @page.new_record?
render_template 'no'
- Read upRead up
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 update
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
var update = function(e, options) {
var value, keyCode, printable, placeholder, width;
var shift, character, selection;
e = e || window.event || {};
options = options || {};