Showing 143 of 169 total issues
Function access
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
var i = 0,
length = elems.length,
bulk = key == null;
Function when
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
when: function( subordinate /* , ..., subordinateN */ ) {
var i = 0,
resolveValues = slice.call( arguments ),
length = resolveValues.length,
Function toggleClass
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
toggleClass: function( value, stateVal ) {
var type = typeof value;
if ( typeof stateVal === "boolean" && type === "string" ) {
return stateVal ? this.addClass( value ) : this.removeClass( value );
Function style
has 37 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 ajaxHandleResponses
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function ajaxHandleResponses( s, jqXHR, responses ) {
var firstDataType, ct, finalDataType, type,
contents = s.contents,
dataTypes = s.dataTypes;
Function dispatch
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
dispatch: function( event ) {
// Make a writable jQuery.Event from the native event object
event = jQuery.event.fix( event );
Function clone
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
clone: function( elem, dataAndEvents, deepDataAndEvents ) {
var destElements, node, clone, i, srcElements,
inPage = jQuery.contains( elem.ownerDocument, elem );
if ( support.html5Clone || jQuery.isXMLDoc( elem ) ||
Function adjustCSS
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function adjustCSS( elem, prop, valueParts, tween ) {
var adjusted,
scale = 1,
maxIterations = 20,
currentValue = tween ?
Function load
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
jQuery.fn.load = function( url, params, callback ) {
if ( typeof url !== "string" && _load ) {
return _load.apply( this, arguments );
}
Function setOffset
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
setOffset: function( elem, options, i ) {
var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
position = jQuery.css( elem, "position" ),
curElem = jQuery( elem ),
props = {};
Function markTheseDataWithoutClearingBefore
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function markTheseDataWithoutClearingBefore(data) {
map = document.map
console.log(data)
for (var i = 0; i < data.length; i++) {
Consider simplifying this complex logical expression. Open
Open
if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
// Trust units reported by jQuery.css
unit = unit || initialInUnit[ 3 ];
Function data
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
data: function( key, value ) {
var i, name, data,
elem = this[ 0 ],
attrs = elem && elem.attributes;
Function initMap
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function initMap() {
if (document.geoReady == undefined) {
return;
}
var map = new google.maps.Map(document.getElementById('map'), {
Function addClickEvents
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
addClickEvents: function () {
var base = this;
base.hidePassword.on("click", function (e) {
var $this = $(this),
Function fixCloneNodeIssues
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function fixCloneNodeIssues( src, dest ) {
var nodeName, e, data;
// We do not need to do anything for non-Elements
if ( dest.nodeType !== 1 ) {
Function cleanData
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
cleanData: function( elems, /* internal */ forceAcceptData ) {
var elem, type, id, data,
i = 0,
internalKey = jQuery.expando,
cache = jQuery.cache,
Function addClickEvents
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
addClickEvents: function () {
var base = this;
base.hidePassword.on("click", function (e) {
var $this = $(this),
Method view
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Open
def view
search = params[:search] != "" ? params[:search] : nil
if search != nil
bird = Bird.where('name LIKE ?', "%#{search}%").first
search_result = bird ? Pin.where(bird_id: bird.id) : nil
- 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 removeClass
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
removeClass: function( value ) {
var classes, elem, cur, curValue, clazz, j, finalValue,
i = 0;
if ( jQuery.isFunction( value ) ) {