Showing 321 of 611 total issues
Function propFilter
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function propFilter( props, specialEasing ) {
var index, name, easing, value, hooks;
// camelCase, specialEasing and expand cssHook pass
for ( index in props ) {
Function off
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
off(element, originalTypeEvent, handler, delegationFunction) {
if (typeof originalTypeEvent !== "string" || !element) {
return;
}
const [isDelegated, callable, typeEvent] = normalizeParameters(originalTypeEvent, handler, delegationFunction);
Function hide
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
hide() {
if (this._isTransitioning || !this._isShown()) {
return;
}
const startEvent = EventHandler.trigger(this._element, EVENT_HIDE$6);
Function handleEvent
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
}, handleEvent: function(t3) {
switch (t3.stopImmediatePropagation(), t3.type) {
case "DOMAttrModified":
var e3 = t3.attrName, n3 = t3.relatedNode.namespaceURI, i2 = t3.target, o2 = new c("attributes", i2);
o2.attributeName = e3, o2.attributeNamespace = n3;
Function offset
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
offset: function( options ) {
if ( arguments.length ) {
return options === undefined ?
this :
this.each( function( i ) {
Function getWidthOrHeight
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function getWidthOrHeight( elem, name, extra ) {
// Start with offset property, which is equivalent to the border-box value
var valueIsBorderBox = true,
val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
Function arrow
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function arrow(_ref) {
var _state$modifiersData$;
var state = _ref.state, name = _ref.name, options = _ref.options;
var arrowElement = state.elements.arrow;
var popperOffsets2 = state.modifiersData.popperOffsets;
Function _observerCallback
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
_observerCallback(entries) {
const targetElement = (entry) => this._targetLinks.get(`#${entry.target.id}`);
const activate = (entry) => {
this._previousScrollData.visibleEntryTop = entry.target.offsetTop;
this._process(targetElement(entry));
Consider simplifying this complex logical expression. Open
Open
if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
support.getById && context.nodeType === 9 && documentIsHTML &&
Expr.relative[ tokens[1].type ] ) {
context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
Consider simplifying this complex logical expression. Open
Open
if ( support.matchesSelector && documentIsHTML &&
!compilerCache[ expr + " " ] &&
( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
Consider simplifying this complex logical expression. Open
Open
*/},{key:"_showMenu",value:function _showMenu(t,i){var n=this;var s=this.$element.find('li[aria-expanded="true"] > ul[data-submenu]');s.each((function(){n._setHideSubMenuClasses(e(this))}));this.$currentMenu=t;if(t.is("[data-drilldown]")){true===i&&t.find("li > a").first().focus();this.options.autoHeight&&this.$wrapper.css("height",t.data("calcHeight"))}else{var a=t.children().first().parentsUntil("[data-drilldown]","[data-submenu]");a.each((function(s){0===s&&n.options.autoHeight&&n.$wrapper.css("height",e(this).data("calcHeight"));var o=s===a.length-1;true===o&&e(this).one(transitionend(e(this)),(function(){true===i&&t.find("li > a").first().focus()}));n._setShowSubMenuClasses(e(this),o)}))}}
Function addMutationEventsListener
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
Open
*/function animate(t,i,n,s){i=e(i).eq(0);if(i.length){var a=t?c[0]:c[1];var o=t?h[0]:h[1];reset();i.addClass(n).css("transition","none");requestAnimationFrame((function(){i.addClass(a);t&&i.show()}));requestAnimationFrame((function(){i[0].offsetWidth;i.css("transition","").addClass(o)}));i.one(transitionend(i),finish)}function finish(){t||i.hide();reset();s&&s.apply(i)}function reset(){i[0].style.transitionDuration=0;i.removeClass("".concat(a," ").concat(o," ").concat(n))}}var u={Feather:function Feather(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zf";t.attr("role","menubar");t.find("a").attr({role:"menuitem"});var n=t.find("li").attr({role:"none"}),s="is-".concat(i,"-submenu"),a="".concat(s,"-item"),o="is-".concat(i,"-submenu-parent"),r="accordion"!==i;n.each((function(){var t=e(this),n=t.children("ul");if(n.length){t.addClass(o);if(r){var l=t.children("a:first");l.attr({"aria-haspopup":true,"aria-label":l.attr("aria-label")||l.text()});"drilldown"===i&&t.attr({"aria-expanded":false})}n.addClass("submenu ".concat(s)).attr({"data-submenu":"",role:"menubar"});"drilldown"===i&&n.attr({"aria-hidden":true})}t.parent("[data-submenu]").length&&t.addClass("is-submenu-item ".concat(a))}))},Burn:function Burn(e,t){var i="is-".concat(t,"-submenu"),n="".concat(i,"-item"),s="is-".concat(t,"-submenu-parent");e.find(">li, > li > ul, .menu, .menu > li, [data-submenu] > li").removeClass("".concat(i," ").concat(n," ").concat(s," is-submenu-item submenu is-active")).removeAttr("data-submenu").css("display","")}};function Timer(e,t,i){var n,s,a=this,o=t.duration,r=Object.keys(e.data())[0]||"timer",l=-1;this.isPaused=false;this.restart=function(){l=-1;clearTimeout(s);this.start()};this.start=function(){this.isPaused=false;clearTimeout(s);l=l<=0?o:l;e.data("paused",false);n=Date.now();s=setTimeout((function(){t.infinite&&a.restart();i&&"function"===typeof i&&i()}),l);e.trigger("timerstart.zf.".concat(r))};this.pause=function(){this.isPaused=true;clearTimeout(s);e.data("paused",true);var t=Date.now();l-=t-n;e.trigger("timerpaused.zf.".concat(r))}}var f={};var p,v,g,m,y=false,_=false;function onTouchEnd(t){this.removeEventListener("touchmove",onTouchMove);this.removeEventListener("touchend",onTouchEnd);if(!_){var i=e.Event("tap",m||t);e(this).trigger(i)}m=null;y=false;_=false}function onTouchMove(t){true===e.spotSwipe.preventDefault&&t.preventDefault();if(y){var i=t.touches[0].pageX;var n=p-i;var s;_=true;g=(new Date).getTime()-v;Math.abs(n)>=e.spotSwipe.moveThreshold&&g<=e.spotSwipe.timeThreshold&&(s=n>0?"left":"right");if(s){t.preventDefault();onTouchEnd.apply(this,arguments);e(this).trigger(e.Event("swipe",Object.assign({},t)),s).trigger(e.Event("swipe".concat(s),Object.assign({},t)))}}}function onTouchStart(t){if(1===t.touches.length){p=t.touches[0].pageX;m=t;y=true;_=false;v=(new Date).getTime();this.addEventListener("touchmove",onTouchMove,{passive:true===e.spotSwipe.preventDefault});this.addEventListener("touchend",onTouchEnd,false)}}function init(){this.addEventListener&&this.addEventListener("touchstart",onTouchStart,{passive:true})}var b=function(){function SpotSwipe(){_classCallCheck(this,SpotSwipe);this.version="1.0.0";this.enabled="ontouchstart"in document.documentElement;this.preventDefault=false;this.moveThreshold=75;this.timeThreshold=200;this._init()}_createClass(SpotSwipe,[{key:"_init",value:function _init(){e.event.special.swipe={setup:init};e.event.special.tap={setup:init};e.each(["left","up","down","right"],(function(){e.event.special["swipe".concat(this)]={setup:function setup(){e(this).on("swipe",e.noop)}}}))}}]);return SpotSwipe}();f.setupSpotSwipe=function(){e.spotSwipe=new b(e)};f.setupTouchHandler=function(){e.fn.addTouch=function(){this.each((function(i,n){e(n).bind("touchstart touchmove touchend touchcancel",(function(e){t(e)}))}));var t=function handleTouch(e){var t,i=e.changedTouches,n=i[0],s={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup"},a=s[e.type];if("MouseEvent"in window&&"function"===typeof window.MouseEvent)t=new window.MouseEvent(a,{bubbles:true,cancelable:true,screenX:n.screenX,screenY:n.screenY,clientX:n.clientX,clientY:n.clientY});else{t=document.createEvent("MouseEvent");t.initMouseEvent(a,true,true,window,1,n.screenX,n.screenY,n.clientX,n.clientY,false,false,false,false,0,null)}n.target.dispatchEvent(t)}}};f.init=function(){if("undefined"===typeof e.spotSwipe){f.setupSpotSwipe(e);f.setupTouchHandler(e)}};var w=function(){var e=["WebKit","Moz","O","Ms",""];for(var t=0;t<e.length;t++)if("".concat(e[t],"MutationObserver")in window)return window["".concat(e[t],"MutationObserver")];return false}();var $=function triggers(t,i){t.data(i).split(" ").forEach((function(n){e("#".concat(n))["close"===i?"trigger":"triggerHandler"]("".concat(i,".zf.trigger"),[t])}))};var k={Listeners:{Basic:{},Global:{}},Initializers:{}};k.Listeners.Basic={openListener:function openListener(){$(e(this),"open")},closeListener:function closeListener(){var t=e(this).data("close");t?$(e(this),"close"):e(this).trigger("close.zf.trigger")},toggleListener:function toggleListener(){var t=e(this).data("toggle");t?$(e(this),"toggle"):e(this).trigger("toggle.zf.trigger")},closeableListener:function closeableListener(t){var i=e(this).data("closable");t.stopPropagation();""!==i?d.animateOut(e(this),i,(function(){e(this).trigger("closed.zf")})):e(this).fadeOut().trigger("closed.zf")},toggleFocusListener:function toggleFocusListener(){var t=e(this).data("toggle-focus");e("#".concat(t)).triggerHandler("toggle.zf.trigger",[e(this)])}};k.Initializers.addOpenListener=function(e){e.off("click.zf.trigger",k.Listeners.Basic.openListener);e.on("click.zf.trigger","[data-open]",k.Listeners.Basic.openListener)};k.Initializers.addCloseListener=function(e){e.off("click.zf.trigger",k.Listeners.Basic.closeListener);e.on("click.zf.trigger","[data-close]",k.Listeners.Basic.closeListener)};k.Initializers.addToggleListener=function(e){e.off("click.zf.trigger",k.Listeners.Basic.toggleListener);e.on("click.zf.trigger","[data-toggle]",k.Listeners.Basic.toggleListener)};k.Initializers.addCloseableListener=function(e){e.off("close.zf.trigger",k.Listeners.Basic.closeableListener);e.on("close.zf.trigger","[data-closeable], [data-closable]",k.Listeners.Basic.closeableListener)};k.Initializers.addToggleFocusListener=function(e){e.off("focus.zf.trigger blur.zf.trigger",k.Listeners.Basic.toggleFocusListener);e.on("focus.zf.trigger blur.zf.trigger","[data-toggle-focus]",k.Listeners.Basic.toggleFocusListener)};k.Listeners.Global={resizeListener:function resizeListener(t){w||t.each((function(){e(this).triggerHandler("resizeme.zf.trigger")}));t.attr("data-events","resize")},scrollListener:function scrollListener(t){w||t.each((function(){e(this).triggerHandler("scrollme.zf.trigger")}));t.attr("data-events","scroll")},closeMeListener:function closeMeListener(t,i){var n=t.namespace.split(".")[0];var s=e("[data-".concat(n,"]")).not('[data-yeti-box="'.concat(i,'"]'));s.each((function(){var t=e(this);t.triggerHandler("close.zf.trigger",[t])}))}};k.Initializers.addClosemeListener=function(t){var i=e("[data-yeti-box]"),n=["dropdown","tooltip","reveal"];t&&("string"===typeof t?n.push(t):"object"===_typeof(t)&&"string"===typeof t[0]?n=n.concat(t):console.error("Plugin names must be strings"));if(i.length){var s=n.map((function(e){return"closeme.zf.".concat(e)})).join(" ");e(window).off(s).on(s,k.Listeners.Global.closeMeListener)}};function debounceGlobalListener(t,i,n){var s,a=Array.prototype.slice.call(arguments,3);e(window).on(i,(function(){s&&clearTimeout(s);s=setTimeout((function(){n.apply(null,a)}),t||10)}))}k.Initializers.addResizeListener=function(t){var i=e("[data-resize]");i.length&&debounceGlobalListener(t,"resize.zf.trigger",k.Listeners.Global.resizeListener,i)};k.Initializers.addScrollListener=function(t){var i=e("[data-scroll]");i.length&&debounceGlobalListener(t,"scroll.zf.trigger",k.Listeners.Global.scrollListener,i)};k.Initializers.addMutationEventsListener=function(t){if(!w)return false;var i=t.find("[data-resize], [data-scroll], [data-mutate]");var n=function listeningElementsMutation(t){var i=e(t[0].target);switch(t[0].type){case"attributes":"scroll"===i.attr("data-events")&&"data-events"===t[0].attributeName&&i.triggerHandler("scrollme.zf.trigger",[i,window.pageYOffset]);"resize"===i.attr("data-events")&&"data-events"===t[0].attributeName&&i.triggerHandler("resizeme.zf.trigger",[i]);if("style"===t[0].attributeName){i.closest("[data-mutate]").attr("data-events","mutate");i.closest("[data-mutate]").triggerHandler("mutateme.zf.trigger",[i.closest("[data-mutate]")])}break;case"childList":i.closest("[data-mutate]").attr("data-events","mutate");i.closest("[data-mutate]").triggerHandler("mutateme.zf.trigger",[i.closest("[data-mutate]")]);break;default:return false}};if(i.length)for(var s=0;s<=i.length-1;s++){var a=new w(n);a.observe(i[s],{attributes:true,childList:true,characterData:false,subtree:true,attributeFilter:["data-events","style"]})}};k.Initializers.addSimpleListeners=function(){var t=e(document);k.Initializers.addOpenListener(t);k.Initializers.addCloseListener(t);k.Initializers.addToggleListener(t);k.Initializers.addCloseableListener(t);k.Initializers.addToggleFocusListener(t)};k.Initializers.addGlobalListeners=function(){var t=e(document);k.Initializers.addMutationEventsListener(t);k.Initializers.addResizeListener(250);k.Initializers.addScrollListener();k.Initializers.addClosemeListener()};k.init=function(t,i){onLoad(e(window),(function(){if(true!==e.triggersInitialized){k.Initializers.addSimpleListeners();k.Initializers.addGlobalListeners();e.triggersInitialized=true}}));if(i){i.Triggers=k;i.IHearYou=k.Initializers.addGlobalListeners}};var C=function(){function Plugin(e,t){_classCallCheck(this,Plugin);this._setup(e,t);var i=getPluginName(this);this.uuid=GetYoDigits(6,i);this.$element.attr("data-".concat(i))||this.$element.attr("data-".concat(i),this.uuid);this.$element.data("zfPlugin")||this.$element.data("zfPlugin",this);this.$element.trigger("init.zf.".concat(i))}_createClass(Plugin,[{key:"destroy",value:function destroy(){this._destroy();var e=getPluginName(this);this.$element.removeAttr("data-".concat(e)).removeData("zfPlugin").trigger("destroyed.zf.".concat(e));for(var t in this)this.hasOwnProperty(t)&&(this[t]=null)}}]);return Plugin}();function hyphenate$1(e){return e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function getPluginName(e){return hyphenate$1(e.className)}var z=function(t){_inherits(Abide,t);var i=_createSuper(Abide);function Abide(){_classCallCheck(this,Abide);return i.apply(this,arguments)}_createClass(Abide,[{key:"_setup",value:
- 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
Method execute_search
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
Open
def execute_search
@response = Paper.search(@search_definition.to_definition)
@papers = @response.page(params[:page]).results
@sub = {}
@papers.each do |paper|
- 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 access
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
Function GetExplicitOffsets
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
*/function GetExplicitOffsets(e,t,i,n,s,a,o){var r=GetDimensions(e),l=t?GetDimensions(t):null;var c,h;if(null!==l){switch(i){case"top":c=l.offset.top-(r.height+s);break;case"bottom":c=l.offset.top+l.height+s;break;case"left":h=l.offset.left-(r.width+a);break;case"right":h=l.offset.left+l.width+a;break}switch(i){case"top":case"bottom":switch(n){case"left":h=l.offset.left+a;break;case"right":h=l.offset.left-r.width+l.width-a;break;case"center":h=o?a:l.offset.left+l.width/2-r.width/2+a;break}break;case"right":case"left":switch(n){case"bottom":c=l.offset.top-s+l.height-r.height;break;case"top":c=l.offset.top+s;break;case"center":c=l.offset.top+s+l.height/2-r.height/2;break}break}}return{top:c,left:h}}
Avoid deeply nested control flow statements. Open
Open
} else if ( copy !== undefined ) {
target[ name ] = copy;
}
Avoid deeply nested control flow statements. Open
Open
if ( !selector ) {
push.apply( results, seed );
return results;
}
Function setMatcher
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
Function init
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
init: function( elem, options, prop, end, easing, unit ) {
Avoid deeply nested control flow statements. Open
Open
if ( ( ofType ?
node.nodeName.toLowerCase() === name :
node.nodeType === 1 ) &&
++diff ) {