Showing 157 of 179 total issues
Function extend
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
jQuery.extend = jQuery.fn.extend = function() {
var options, name, src, copy, copyIsArray, clone,
target = arguments[0] || {},
i = 1,
length = arguments.length,
Function val
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
val: function( value ) {
var hooks, ret,
elem = this[0];
if ( !arguments.length ) {
Function fix
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
fix: function( event ) {
if ( event[ jQuery.expando ] ) {
return event;
}
Consider simplifying this complex logical expression. Open
Open
if ( match[1] === "nth" ) {
if ( !match[2] ) {
Sizzle.error( match[0] );
}
Consider simplifying this complex logical expression. Open
Open
if ( args.length === 1 && typeof args[0] === "string" && args[0].length < 512 && doc === document &&
args[0].charAt(0) === "<" && !rnocache.test( args[0] ) && (jQuery.support.checkClone || !rchecked.test( args[0] )) ) {
cacheable = true;
Function jsAnimateOpacity
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function jsAnimateOpacity(level,callback){
var interval;
var opacity;
if (level === 1) {
Function each
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
each: function( object, callback, args ) {
var name, i = 0,
length = object.length,
isObj = length === undefined || jQuery.isFunction( object );
Function setOffset
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
setOffset: function( elem, options, i ) {
var position = jQuery.css( elem, "position" );
// set position first, in-case top/left are set even on static elem
if ( position === "static" ) {
Method validate_record_template
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Open
def validate_record_template #:nodoc:
unless self.record_type.blank?
record = build
record.errors.each do |k,v|
# skip associations we don't have, validations we don't care about
- 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 when
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
when: function( firstParam ) {
var args = arguments,
i = 0,
length = args.length,
count = length,
Function dirCheck
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
for ( var i = 0, l = checkSet.length; i < l; i++ ) {
var elem = checkSet[i];
if ( elem ) {
Function offset
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
jQuery.fn.offset = function( options ) {
var elem = this[0], box;
if ( options ) {
return this.each(function( i ) {
Function cleanData
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
cleanData: function( elems ) {
var data, id, cache = jQuery.cache, internalKey = jQuery.expando, special = jQuery.event.special,
deleteExpando = jQuery.support.deleteExpando;
for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
Function promise
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
promise: function( type, object ) {
if ( typeof type !== "string" ) {
object = type;
type = undefined;
}
Function find
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
find: function( selector ) {
var self = this,
i, l;
if ( typeof selector !== "string" ) {
Function name
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
jQuery.fn[ name ] = function( type, data, fn ) {
var handler;
// Handle object literals
if ( typeof type === "object" ) {
Function ATTR
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
ATTR: function( elem, match ) {
var name = match[1],
result = Expr.attrHandle[ name ] ?
Expr.attrHandle[ name ]( elem ) :
elem[ name ] != null ?
Function style
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
style: function( elem, name, value, extra ) {
// Don't set styles on text and comment nodes
if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
return;
}
Function addClass
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
addClass: function( value ) {
if ( jQuery.isFunction( value ) ) {
return this.each(function(i) {
var self = jQuery(this);
self.addClass( value.call(this, i, self.attr("class") || "") );
Function html
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
html: function( value ) {
if ( value === undefined ) {
return this[0] && this[0].nodeType === 1 ?
this[0].innerHTML.replace(rinlinejQuery, "") :
null;