Showing 157 of 179 total issues
Function _Deferred
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
_Deferred: function() {
var // callbacks list
callbacks = [],
// stored [ context , args ]
fired,
Function liveHandler
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function liveHandler( event ) {
var stop, maxLevel, related, match, handleObj, elem, j, i, l, data, close, namespace, ret,
elems = [],
selectors = [],
events = jQuery._data( this, "events" );
Function Deferred
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Deferred: function( func ) {
var deferred = jQuery._Deferred(),
failDeferred = jQuery._Deferred(),
promise;
// Add errorDeferred methods, then and promise
Function ajaxConvert
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function ajaxConvert( s, response ) {
// Apply the dataFilter if provided
if ( s.dataFilter ) {
response = s.dataFilter( response, s.dataType );
Method create
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
Open
def create
@domain = Domain.new( params[:domain] )
unless @domain.slave?
@zone_template = ZoneTemplate.find(params[:domain][:zone_template_id]) unless params[:domain][:zone_template_id].blank?
- 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 offset
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
jQuery.fn.offset = function( options ) {
var elem = this[0];
if ( options ) {
return this.each(function( i ) {
Class AuthToken
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class AuthToken < ActiveRecord::Base
class Denied < ::Exception
end
Method create
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def create
if params[:auth_token].blank?
render :status => 422, :xml => <<-EOS
<error>#{t(:message_token_missing_parametr)}</error>
EOS
Function name
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
jQuery.fn[ name ] = function( types, data, fn, origSelector /* Internal Use Only */ ) {
var type, i = 0, match, namespaces, preType,
selector = origSelector || this.selector,
context = origSelector ? this : jQuery( this.context );
Function ajaxHandleResponses
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function ajaxHandleResponses( s, jqXHR, responses ) {
var contents = s.contents,
dataTypes = s.dataTypes,
responseFields = s.responseFields,
Function domManip
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
domManip: function( args, table, callback ) {
var results, first, fragment, parent,
value = args[0],
scripts = [];
Function closest
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
closest: function( selectors, context ) {
var ret = [], i, l, cur = this[0];
// Array
if ( jQuery.isArray( selectors ) ) {
Function removeData
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
removeData: function( elem, name, pvt /* Internal Use Only */ ) {
if ( !jQuery.acceptData( elem ) ) {
return;
}
Function CHILD
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
CHILD: function( elem, match ) {
var type = match[1],
node = elem;
switch ( type ) {
Function data
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
data: function( elem, name, data, pvt /* Internal Use Only */ ) {
if ( !jQuery.acceptData( elem ) ) {
return;
}
Function load
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
load: function( url, params, callback ) {
if ( typeof url !== "string" && _load ) {
return _load.apply( this, arguments );
// Don't do a request if no elements are being requested
Function step
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
step: function( gotoEnd ) {
var t = fxNow || createFxNow(),
done = true,
elem = this.elem,
options = this.options,
Function handleRemote
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
handleRemote: function(element) {
var method, url, data,
crossDomain = element.data('cross-domain') || null,
dataType = element.data('type') || ($.ajaxSettings && $.ajaxSettings.dataType);
Function data
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
data: function( key, value ) {
var data = null;
if ( typeof key === "undefined" ) {
if ( this.length ) {
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,