Showing 203 of 346 total issues
Function appendCustomSelect
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function appendCustomSelect(sel) {
var $this = $(sel),
$customSelect = $this.next('div.custom.dropdown'),
$options = $this.find('option'),
maxWidth = 0,
Function normalizeRules
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
normalizeRules: function(rules, element) {
// handle dependency check
$.each(rules, function(prop, val) {
// ignore rule when param is explicitly false, eg. required:false
if (val === false) {
Function toggle
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
toggle: function() {
var self = this;
var topbar = $('.top-bar, [data-topbar]'),
section = topbar.find('section, .section');
Function set_active_from_hash
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
set_active_from_hash: function() {
var self = Foundation.libs.section,
hash = window.location.hash.substring(1),
sections = $(self.settings.section_selector);
Function un_expose
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
un_expose : function () {
var exposeId,
el,
expose ,
origCSS,
Function set_up_html
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Chosen.prototype.set_up_html = function() {
var container_div, dd_top, dd_width, sf_width;
this.container_id = this.form_field.id.length ? this.form_field.id.replace(/(:|\.)/g, '_') : this.generate_field_id();
this.container_id += "_chzn";
this.f_width = this.form_field_jq.outerWidth() + 60;
Function init
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function init() {
id = ''; nameSpace = '';
if (options.id) {
id = 'id="'+options.id+'"';
} else if ($$.attr("id")) {
Function keyPressed
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function keyPressed(e) {
shiftKey = e.shiftKey;
altKey = e.altKey;
ctrlKey = (!(e.altKey && e.ctrlKey)) ? (e.ctrlKey || e.metaKey) : false;
Function dropMenus
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function dropMenus(markupSet) {
var ul = $('<ul></ul>'), i = 0;
$('li:hover > ul', ul).css('display', 'block');
$.each(markupSet, function() {
var button = this, t = '', title, li, j;
Function remote
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
remote: function(value, element, param) {
if ( this.optional(element) )
return "dependency-mismatch";
var previous = this.previousValue(element);
Function show
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
show : function (el, css) {
// is modal
if (css) {
if (el.parent('body').length === 0) {
var placeholder = el.wrap('<div style="display: none;" />').parent();
Function attr
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
jQuery.attr = function( elem, name, value, pass ) {
var lowerName = name.toLowerCase(),
nType = elem && elem.nodeType;
if ( pass ) {
Function init
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
init: function (element, options) {
var $imageSlides,
imagesLoadedCount = 0,
self = this;
Function _goto
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
self._goto = function(next_idx, start_timer) {
// if (locked) {return false;}
if (next_idx === idx) {return false;}
if (typeof timer === 'object') {timer.restart();}
var slides = slides_container.children();
Function register_observers
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Chosen.prototype.register_observers = function() {
this.container.mousedown(__bind(function(evt) {
return this.container_mousedown(evt);
}, this));
this.container.mouseup(__bind(function(evt) {
Function Timer
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var Timer = function(el, settings, callback) {
var self = this,
duration = settings.timer_speed,
progress = el.find('.'+settings.timer_progress_class),
start,
Function init
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
init : function (section, method, options) {
Foundation.inherit(this, 'data_options addCustomRule');
var self = this;
if (typeof method === 'object') {
Function closeAnimation
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function closeAnimation() {
if (!locked) {
lockModal();
modal.removeClass("open");
if (options.animation === "fadeAndPop") {
Function open
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
open : function (target, ajax_settings) {
if (target) {
if (typeof target.selector !== 'undefined') {
var modal = $('#' + target.data('reveal-id'));
} else {
Method update
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
Open
def update
@order = find_or_create_order
@order.ip_address = request.remote_ip
@credit_card ||= ActiveMerchant::Billing::CreditCard.new(cc_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"