Showing 86 of 86 total issues
Method root_for_backtrace_filtering
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
Open
def root_for_backtrace_filtering(sub_path = nil)
if defined?(Rails) && Rails.respond_to?(:root)
(sub_path ? Rails.root.join(sub_path) : Rails.root).to_s
else
root = if defined?(RAILS_ROOT)
- 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 trigger
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
trigger: function( event, data, elem, bubbling ) {
// Event object or event type
var type = event.type || event;
if( !bubbling ){
Function onreadystatechange
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var onreadystatechange = function(isTimeout){
// The request was aborted, clear the interval and decrement jQuery.active
if (xhr.readyState == 0) {
if (ival) {
// clear poll interval
Function animate
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
animate: function( prop, speed, easing, callback ) {
var optall = jQuery.speed(speed, easing, callback);
return this[ optall.queue === false ? "each" : "queue" ](function(){
Function add
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
add: function(elem, types, handler, data) {
if ( elem.nodeType == 3 || elem.nodeType == 8 )
return;
// For whatever reason, IE has trouble passing the window object
Function CHILD
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
CHILD: function(elem, match){
var type = match[1], node = elem;
switch (type) {
case 'only':
case 'first':
Function dirCheck
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
var sibDir = dir == "previousSibling" && !isXML;
for ( var i = 0, l = checkSet.length; i < l; i++ ) {
var elem = checkSet[i];
if ( elem ) {
Function curCSS
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
curCSS: function( elem, name, force ) {
var ret, style = elem.style;
// We need to handle opacity special in IE
if ( name == "opacity" && !jQuery.support.opacity ) {
Function load
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
load: function( url, params, callback ) {
if ( typeof url !== "string" )
return this._load( url );
var off = url.indexOf(" ");
Consider simplifying this complex logical expression. Open
Open
if ( match[1] == "nth" ) {
// parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'
var test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec(
match[2] == "even" && "2n" || match[2] == "odd" && "2n+1" ||
!/\D/.test( match[2] ) && "0n+" + match[2] || match[2]);
Function step
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
step: function(gotoEnd){
var t = now();
if ( gotoEnd || t >= this.options.duration + this.startTime ) {
this.now = this.end;
Function init
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
init: function( selector, context ) {
// Make sure that a selection was provided
selector = selector || document;
// Handle $(DOMElement)
Function offset
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
jQuery.fn.offset = function() {
if ( !this[0] ) return { top: 0, left: 0 };
if ( this[0] === this[0].ownerDocument.body ) return jQuery.offset.bodyOffset( this[0] );
jQuery.offset.initialized || jQuery.offset.initialize();
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 dirNodeCheck
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
var sibDir = dir == "previousSibling" && !isXML;
for ( var i = 0, l = checkSet.length; i < l; i++ ) {
var elem = checkSet[i];
if ( elem ) {
Function clone
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
clone: function( events ) {
// Do the clone
var ret = this.map(function(){
if ( !jQuery.support.noCloneEvent && !jQuery.isXMLDoc(this) ) {
// IE copies events bound via attachEvent when
Function bindReady
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function bindReady(){
if ( readyBound ) return;
readyBound = true;
// Mozilla, Opera and webkit nightlies currently support this event
Function fix
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
fix: function(event) {
if ( event[expando] )
return event;
// store a copy of the original event object
Function extend
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
jQuery.extend = jQuery.fn.extend = function() {
// copy reference to target object
var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options;
// Handle a deep copy situation
Function show
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
show: function(speed,callback){
if ( speed ) {
return this.animate( genFx("show", 3), speed, callback);
} else {
for ( var i = 0, l = this.length; i < l; i++ ){