Showing 58 of 126 total issues
Function events
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
events: function() {
var self = this;
//combine titles selector from settings for click event binding
var click_title_selectors = [],
Function css
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
css : function (dropdown, target) {
var offset_parent = dropdown.offsetParent();
// if (offset_parent.length > 0 && /body/i.test(dropdown.offsetParent()[0].nodeName)) {
var position = target.offset();
position.top -= offset_parent.offset().top;
Function pos_phone
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
pos_phone : function (init) {
var tip_height = this.outerHeight(this.settings.$next_tip),
tip_offset = this.settings.$next_tip.offset(),
target_height = this.outerHeight(this.settings.$target),
$nub = $('.joyride-nub', this.settings.$next_tip),
Function refresh_custom_select
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
refresh_custom_select: function ($select, force_refresh) {
var self = this;
var maxWidth = 0,
$customSelect = $select.next(),
$options = $select.find('option'),
Function cookie
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var config = $.cookie = function (key, value, options) {
// write
if (value !== undefined) {
options = $.extend({}, config.defaults, options);
Function indexOf
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Array.prototype.indexOf = function (searchElement /*, fromIndex */ ) {
"use strict";
if (this == null) {
throw new TypeError();
}
Consider simplifying this complex logical expression. Open
Open
} else if (region.hasClass(self.settings.active_class) && self.is_accordion(section) || !settings.one_up && (self.small(section) || self.is_vertical_nav(section) || self.is_horizontal_nav(section) || self.is_accordion(section))) {
region.removeClass(self.settings.active_class);
region.trigger('closed.fndtn.section');
}
Avoid deeply nested control flow statements. Open
Open
if (this.settings.timer > 0) {
this.settings.$next_tip
.fadeIn(this.settings.tipAnimationFadeSpeed)
.show();
Avoid deeply nested control flow statements. Open
Open
if (!region.hasClass(self.settings.active_class))
region.addClass(self.settings.active_class);
Avoid deeply nested control flow statements. Open
Open
if (placeholder !== elem.getAttribute(ATTR_CURRENT_VAL) || (elem.type === "password" && !elem.getAttribute(ATTR_INPUT_TYPE))) {
// Attempt to change the type of password inputs (fails in IE < 9)
if (elem.type === "password" && !elem.getAttribute(ATTR_INPUT_TYPE) && Utils.changeType(elem, "text")) {
elem.setAttribute(ATTR_INPUT_TYPE, "password");
Avoid deeply nested control flow statements. Open
Open
if ($customRadio.length === 0) {
$customRadio = $associatedElement.add(this).siblings('span.custom.radio').first();
}
Function init
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
init : function (scope, libraries, method, options, response, /* internal */ nc) {
Avoid deeply nested control flow statements. Open
Open
if (!elem.getAttribute(ATTR_EVENTS_BOUND)) {
newElement(elem);
}
Avoid deeply nested control flow statements. Open
Open
if ($(klass).hasClass('fixed')) {
$(klass).removeClass('fixed');
$('body').removeClass('f-topbar-fixed');
}
Avoid too many return
statements within this function. Open
Open
return $(this.scope).width() < settings.small_breakpoint;
Avoid too many return
statements within this function. Open
Open
return el.show();
Avoid too many return
statements within this function. Open
Open
return el.hide();
Function write
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
Board.prototype.write = function(data) {
data.board.forEach(function(space) {
dom_space = getSpaceById(space.id);
dom_space.prop('title', space.value);
if (space.winning_space === true) {
- 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"