Showing 203 of 346 total issues
Function init
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
init : function (scope, method, options) {
Foundation.inherit(this, 'data_options');
var self = this;
if (typeof method === 'object') {
Function rules
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
rules: function(command, argument) {
var element = this[0];
if (command) {
var settings = $.data(element.form, 'validator').settings;
Function reposition
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
reposition : function (target, tip, classes) {
var width, nub, nubHeight, nubWidth, column, objPos;
tip.css('visibility', 'hidden').show();
Function add
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function add(value, text, callHandler) {
$option = null;
if ($(value).is('option')) {
$option = $(value);
Function events
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
events : function () {
var self = this;
$(this.scope)
.on('click.joyride', '.joyride-next-tip, .joyride-modal-bg', function (e) {
Function results_build
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Chosen.prototype.results_build = function() {
var content, data, _i, _len, _ref;
this.parsing = true;
this.results_data = root.SelectParser.select_to_array(this.form_field);
if (this.is_multiple && this.choices > 0) {
Function _next
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
_next : function(){
if(this.options.validationEnabled){
if(!this.element.valid()){
this.element.validate().focusInvalid();
return false;
Function start
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
start : function () {
var self = this,
$this = $(this.scope).find('[data-joyride]'),
integer_settings = ['timer', 'scrollSpeed', 'startOffset', 'tipAnimationFadeSpeed', 'cookieExpires'],
int_settings_count = integer_settings.length;
Function anim
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
$.fn.anim = function(properties, duration, ease, callback){
var key, cssValues = {}, cssProperties, transforms = '',
that = this, wrappedCallback, endEvent = $.fx.transitionEnd
if (duration === undefined) duration = 0.4
Function swipe_events
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
swipe_events : function () {
var self = this;
$(this.scope)
.on('touchstart.fndtn.clearing', '.visible-img', function(e) {
Method index
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
Open
def index
# The index action should
if u = User.first
redirect_to root_url and return if !current_user
redirect_to root_url unless current_user.admin?
- 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 setDimentionsFromLargestSlide
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
setDimentionsFromLargestSlide: function () {
//Collect all slides and set slider size of largest image
var self = this,
$fluidPlaceholder;
Function reposition
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
reposition : function (target, tip, classes) {
var width, nub, nubHeight, nubWidth, row, objPos;
width = target.data('width');
nub = tip.children('.nub');
Function events
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
events : function () {
var self = this;
$(this.scope)
.on('click.fndtn.dropdown', '[data-dropdown]', function (e) {
Method update
has 35 lines of code (exceeds 25 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)
Function check
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
check: function( element ) {
element = this.clean( element );
// if radio/checkbox, validate first element in group instead
if (this.checkable(element)) {
Function setCaption
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
setCaption: function () {
var captionLocation = this.currentSlide().attr('data-caption'),
captionHTML;
if (!this.options.captions) {
Consider simplifying this complex logical expression. Open
Open
if (this.nodeName.toLowerCase() != 'fieldset' &&
!this.disabled && type != 'submit' && type != 'reset' && type != 'button' &&
((type != 'radio' && type != 'checkbox') || this.checked))
result.push({
name: el.attr('name'),
Function detect
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function detect(ua){
var os = this.os = {}, browser = this.browser = {},
webkit = ua.match(/WebKit\/([\d.]+)/),
android = ua.match(/(Android)\s+([\d.]+)/),
ipad = ua.match(/(iPad).*OS\s([\d_]+)/),
Function setSelected
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
setSelected : function(d, v, moveToMonth, dispatchEvents)
{
if (v == this.isSelected(d)) // this date is already un/selected
{
return;