CodeforLeipzig/stadtratmonitor

View on GitHub

Showing 321 of 611 total issues

Function ajaxConvert has 59 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function ajaxConvert( s, response, jqXHR, isSuccess ) {
    var conv2, current, conv, tmp, prev,
        converters = {},

        // Work with a copy of dataTypes in case we need to modify it for conversion

    Consider simplifying this complex logical expression.
    Open

              if (i2 && i2.type === "childList" && i2.addedNodes && i2.addedNodes) {
                for (var o2 = i2.addedNodes[0]; o2 && o2 !== document && !o2.host; )
                  o2 = o2.parentNode;
                var r2 = o2 && (o2.URL || o2._URL || o2.host && o2.host.localName) || "";
                r2 = r2.split("/?").shift().split("/").pop();

      Consider simplifying this complex logical expression.
      Open

           */},{key:"open",value:function open(t,i){var n=this;if(!(this.$element.hasClass("is-open")||this.isRevealed||this.isInCanvas)){var s=this;i&&(this.$lastTrigger=i);"top"===this.options.forceTo?window.scrollTo(0,0):"bottom"===this.options.forceTo&&window.scrollTo(0,document.body.scrollHeight);this.options.transitionTime&&"overlap"!==this.options.transition?this.$element.siblings("[data-off-canvas-content]").css("transition-duration",this.options.transitionTime):this.$element.siblings("[data-off-canvas-content]").css("transition-duration","");this.$element.addClass("is-open").removeClass("is-closed");this.$triggers.attr("aria-expanded","true");this.$element.attr("aria-hidden","false");this.$content.addClass("is-open-"+this.position);if(false===this.options.contentScroll){e("body").addClass("is-off-canvas-open").on("touchmove",this._stopScrolling);this.$element.on("touchstart",this._recordScrollable);this.$element.on("touchmove",this,this._preventDefaultAtEdges);this.$element.on("touchstart","[data-off-canvas-scrollbox]",this._recordScrollable);this.$element.on("touchmove","[data-off-canvas-scrollbox]",this,this._scrollboxTouchMoved)}true===this.options.contentOverlay&&this.$overlay.addClass("is-visible");true===this.options.closeOnClick&&true===this.options.contentOverlay&&this.$overlay.addClass("is-closable");true===this.options.autoFocus&&this.$element.one(transitionend(this.$element),(function(){if(s.$element.hasClass("is-open")){var e=s.$element.find("[data-autofocus]");e.length?e.eq(0).focus():s.$element.find("a, button").eq(0).focus()}}));if(true===this.options.trapFocus){this.$content.attr("tabindex","-1");l.trapFocus(this.$element)}"push"===this.options.transition&&this._fixStickyElements();this._addContentClasses();this.$element.trigger("opened.zf.offCanvas");this.$element.one(transitionend(this.$element),(function(){n.$element.trigger("openedEnd.zf.offCanvas")}))}}

        Function validateModifiers has 57 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          function validateModifiers(modifiers) {
            modifiers.forEach(function(modifier) {
              [].concat(Object.keys(modifier), VALID_PROPERTIES).filter(function(value, index, self) {
                return self.indexOf(value) === index;
              }).forEach(function(key) {

          Method definition has 57 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def self.definition(q, options = {})
              Elasticsearch::DSL::Search.search do
                sort do
                  by '_score' if options[:sort_by] == 'score'
                  by :published_at, order: 'desc'
          Severity: Major
          Found in app/models/paper_search.rb - About 2 hrs to fix

            Function G has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

            useMUI:true};var N={dropdown:{cssClass:"dropdown",plugin:H},drilldown:{cssClass:"drilldown",plugin:A},accordion:{cssClass:"accordion-menu",plugin:O}};var G=function(t){_inherits(ResponsiveMenu,t);var n=_createSuper(ResponsiveMenu);function ResponsiveMenu(){_classCallCheck(this,ResponsiveMenu);return n.apply(this,arguments)}_createClass(ResponsiveMenu,[{key:"_setup",value:
            /**
                 * Creates a new instance of a responsive menu.
                 * @class
                 * @name ResponsiveMenu

            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 addToJquery has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

            reflow:function reflow(t,i){"undefined"===typeof i?i=Object.keys(this._plugins):"string"===typeof i&&(i=[i]);var n=this;e.each(i,(function(i,s){var a=n._plugins[s];var o=e(t).find("[data-"+s+"]").addBack("[data-"+s+"]").filter((function(){return"undefined"===typeof e(this).data("zfPlugin")}));o.each((function(){var t=e(this),i={reflow:true};t.attr("data-options")&&t.attr("data-options").split(";").forEach((function(e){var t=e.split(":").map((function(e){return e.trim()}));t[0]&&(i[t[0]]=parseValue(t[1]))}));try{t.data("zfPlugin",new a(e(this),i))}catch(e){console.error(e)}finally{return}}))}))},getFnName:functionName,addToJquery:function addToJquery(){
            /**
                 * The Foundation jQuery method.
                 * @param {String|Array} method - An action to perform on the current jQuery object.
                 */

            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 resolveIfNotPlainOrUrl has 56 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              function resolveIfNotPlainOrUrl (relUrl, parentUrl) {
                // strip off any trailing query params or hashes
                const queryHashIndex = parentUrl.indexOf('?', parentUrl.indexOf('#') === -1 ? parentUrl.indexOf('#') : parentUrl.length);
                if (queryHashIndex !== -1)
                  parentUrl = parentUrl.slice(0, queryHashIndex);

              Function remove has 54 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  remove: function( elem, types, handler, selector, mappedTypes ) {
                      var j, handleObj, tmp,
                          origCount, t, events,
                          special, handlers, type,
                          namespaces, origType,

                Function Piece has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        e.Piece = function(n2) {
                          function i(t3, n3) {
                            n3 == null && (n3 = {}), i.__super__.constructor.apply(this, arguments), this.attributes = e.Hash.box(n3);
                          }
                          return t2(i, n2), i.types = {}, i.registerType = function(t3, e2) {

                  Function GetExplicitOffsets has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                  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}}

                  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 W has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function _setup(t){this.$element=e(t);this.rules=this.$element.data("responsive-menu");this.currentMq=null;this.currentPlugin=null;this.className="ResponsiveMenu";this._init();this._events()}},{key:"_init",value:function _init(){i._init();if("string"===typeof this.rules){var t={};var n=this.rules.split(" ");for(var s=0;s<n.length;s++){var a=n[s].split("-");var o=a.length>1?a[0]:"small";var r=a.length>1?a[1]:a[0];null!==N[r]&&(t[o]=N[r])}this.rules=t}e.isEmptyObject(this.rules)||this._checkMediaQueries();this.$element.attr("data-mutate",this.$element.attr("data-mutate")||GetYoDigits(6,"responsive-menu"))}},{key:"_events",value:function _events(){var t=this;e(window).on("changed.zf.mediaquery",(function(){t._checkMediaQueries()}))}},{key:"_checkMediaQueries",value:function _checkMediaQueries(){var t,n=this;e.each(this.rules,(function(e){i.atLeast(e)&&(t=e)}));if(t&&!(this.currentPlugin instanceof this.rules[t].plugin)){e.each(N,(function(e,t){n.$element.removeClass(t.cssClass)}));this.$element.addClass(this.rules[t].cssClass);this.currentPlugin&&this.currentPlugin.destroy();this.currentPlugin=new this.rules[t].plugin(this.$element,{})}}},{key:"_destroy",value:function _destroy(){this.currentPlugin.destroy();e(window).off(".zf.ResponsiveMenu")}}]);return ResponsiveMenu}(C);G.defaults={};var W=function(t){_inherits(ResponsiveToggle,t);var n=_createSuper(ResponsiveToggle);function ResponsiveToggle(){_classCallCheck(this,ResponsiveToggle);return n.apply(this,arguments)}_createClass(ResponsiveToggle,[{key:"_setup",value:
                  /**
                       * Creates a new instance of Tab Bar.
                       * @class
                       * @name ResponsiveToggle

                  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 A has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                  Open

                  multiOpen:true};var A=function(t){_inherits(Drilldown,t);var i=_createSuper(Drilldown);function Drilldown(){_classCallCheck(this,Drilldown);return i.apply(this,arguments)}_createClass(Drilldown,[{key:"_setup",value:
                  /**
                       * Creates a new instance of a drilldown menu.
                       * @class
                       * @name Drilldown

                  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 ignoreMousedisappear has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                  Open

                   */function ignoreMousedisappear(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=i.ignoreLeaveWindow,s=void 0!==n&&n,a=i.ignoreReappear,o=void 0!==a&&a;return function leaveEventHandler(i){for(var n=arguments.length,a=new Array(n>1?n-1:0),r=1;r<n;r++)a[r-1]=arguments[r];var l=t.bind.apply(t,[this,i].concat(a));if(null!==i.relatedTarget)return l();setTimeout((function leaveEventDebouncer(){if(!s&&document.hasFocus&&!document.hasFocus())return l();o||e(document).one("mouseenter",(function reenterEventHandler(t){if(!e(i.currentTarget).has(t.target).length){i.relatedTarget=t.target;l()}}))}),0)}}var t=Object.freeze({__proto__:null,rtl:rtl,GetYoDigits:GetYoDigits,RegExpEscape:RegExpEscape,transitionend:transitionend,onLoad:onLoad,ignoreMousedisappear:ignoreMousedisappear});window.matchMedia||(window.matchMedia=function(){var e=window.styleMedia||window.media;if(!e){var t=document.createElement("style"),i=document.getElementsByTagName("script")[0],n=null;t.type="text/css";t.id="matchmediajs-test";i?i.parentNode.insertBefore(t,i):document.head.appendChild(t);n="getComputedStyle"in window&&window.getComputedStyle(t,null)||t.currentStyle;e={matchMedium:function matchMedium(e){var i="@media "+e+"{ #matchmediajs-test { width: 1px; } }";t.styleSheet?t.styleSheet.cssText=i:t.textContent=i;return"1px"===n.width}}}return function(t){return{matches:e.matchMedium(t||"all"),media:t||"all"}}}());var i={queries:[],current:"",_init:function _init(){if(true===this.isInitialized)return this;this.isInitialized=true;var t=this;var i=e("meta.foundation-mq");i.length||e('<meta class="foundation-mq" name="foundation-mq" content>').appendTo(document.head);var n=e(".foundation-mq").css("font-family");var s;s=parseStyleToObject(n);t.queries=[];for(var a in s)s.hasOwnProperty(a)&&t.queries.push({name:a,value:"only screen and (min-width: ".concat(s[a],")")});this.current=this._getCurrentSize();this._watcher()},_reInit:function _reInit(){this.isInitialized=false;this._init()},

                  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 V has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                  Open

                  panelActiveClass:"is-active"};var V=function(t){_inherits(Toggler,t);var i=_createSuper(Toggler);function Toggler(){_classCallCheck(this,Toggler);return i.apply(this,arguments)}_createClass(Toggler,[{key:"_setup",value:
                  /**
                       * Creates a new instance of Toggler.
                       * @class
                       * @name Toggler

                  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 InputController has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          t2 = e.handleEvent, n = e.innerElementIsActive, e.InputController = function(o2) {
                            function r(n2) {
                              var i2;
                              this.element = n2, this.mutationObserver = new e.MutationObserver(this.element), this.mutationObserver.delegate = this;
                              for (i2 in this.events)

                    Function computeOffsets has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      function computeOffsets(_ref) {
                        var reference2 = _ref.reference, element = _ref.element, placement = _ref.placement;
                        var basePlacement = placement ? getBasePlacement(placement) : null;
                        var variation = placement ? getVariation(placement) : null;
                        var commonX = reference2.x + reference2.width / 2 - element.width / 2;

                      Consider simplifying this complex logical expression.
                      Open

                                      if ( ( mappedTypes || origType === handleObj.origType ) &&
                                          ( !handler || handler.guid === handleObj.guid ) &&
                                          ( !tmp || tmp.test( handleObj.namespace ) ) &&
                                          ( !selector || selector === handleObj.selector ||
                                              selector === "**" && handleObj.selector ) ) {

                        Function HTMLSanitizer has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                n = e.tagName, i = e.walkTree, t2 = e.nodeIsAttachmentElement, e.HTMLSanitizer = function(r2) {
                                  function u(t3, e2) {
                                    var n2;
                                    n2 = e2 != null ? e2 : {}, this.allowedAttributes = n2.allowedAttributes, this.forbiddenProtocols = n2.forbiddenProtocols, this.forbiddenElements = n2.forbiddenElements, this.allowedAttributes == null && (this.allowedAttributes = c), this.forbiddenProtocols == null && (this.forbiddenProtocols = h), this.forbiddenElements == null && (this.forbiddenElements = l), this.body = p(t3);
                                  }

                          Consider simplifying this complex logical expression.
                          Open

                                    if (t3 = n2(t3), !e3.childList && !e3.attributes && !e3.characterData || e3.attributeOldValue && !e3.attributes || e3.attributeFilter && e3.attributeFilter.length && !e3.attributes || e3.characterDataOldValue && !e3.characterData)
                                      throw new SyntaxError();
                            Severity
                            Category
                            Status
                            Source
                            Language