lujanfernaud/prevy

View on GitHub

Showing 19 of 1,727 total issues

Function l has a Cognitive Complexity of 274 (exceeds 5 allowed). Consider refactoring.
Open

}(window, function l(window, document) {
    'use strict';
    /*jshint eqnull:true */
    if(!document.getElementsByClassName){return;}

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

}(window, function l(window, document) {
    'use strict';
    /*jshint eqnull:true */
    if(!document.getElementsByClassName){return;}

    File lazysizes-0622dd876a33cdbe06d2c1c01c3e3b9a8ca531f3c3c3ec27639622d535ceeec0.js has 642 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    (function(window, factory) {
        var lazySizes = factory(window, window.document);
        window.lazySizes = lazySizes;
        if(typeof module == 'object' && module.exports){
            module.exports = lazySizes;

      Function loader has 250 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          var loader = (function(){
              var preloadElems, isCompleted, resetPreloadingTimer, loadMode, started;
      
              var eLvW, elvH, eLtop, eLleft, eLright, eLbottom;
      
      

        Consider simplifying this complex logical expression.
        Open

                            } else if(!loadedSomething && isCompleted && !autoLoadElem &&
                                isLoading < 4 && lowRuns < 4 && loadMode > 2 &&
                                (preloadElems[0] || lazySizesConfig.preloadAfterLoad) &&
                                (preloadElems[0] || (!elemExpandVal && ((eLbottom || eLright || eLleft || eLtop) || lazyloadElems[i][_getAttribute](lazySizesConfig.sizesAttr) != 'auto')))){
                                autoLoadElem = preloadElems[0] || lazyloadElems[i];

          Consider simplifying this complex logical expression.
          Open

                              if ((eLbottom = rect.bottom) >= elemNegativeExpand &&
                                  (eLtop = rect.top) <= elvH &&
                                  (eLright = rect.right) >= elemNegativeExpand * hFac &&
                                  (eLleft = rect.left) <= eLvW &&
                                  (eLbottom || eLright || eLleft || eLtop) &&

            Class Group has 27 methods (exceeds 20 allowed). Consider refactoring.
            Open

            class Group < ApplicationRecord
              UPCOMING_EVENTS = 6
              RECENT_MEMBERS  = 8
              TOP_MEMBERS     = 12
              GROUPS_PER_PAGE = 24
            Severity: Minor
            Found in app/models/group.rb - About 3 hrs to fix

              Class Event has 23 methods (exceeds 20 allowed). Consider refactoring.
              Open

              class Event < ApplicationRecord
                RECENT_ATTENDEES = 8
                RANDOM_ATTENDEES = 6
                EVENTS_PER_PAGE  = 15
              
              
              Severity: Minor
              Found in app/models/event.rb - About 2 hrs to fix

                Class TopicsController has 22 methods (exceeds 20 allowed). Consider refactoring.
                Open

                class Groups::TopicsController < ApplicationController
                  include Groups::AuthorizationRedirecter
                
                  before_action :find_group
                  after_action  :verify_authorized, except: [:index, :show]
                Severity: Minor
                Found in app/controllers/groups/topics_controller.rb - About 2 hrs to fix

                  Class Topic has 21 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                  class Topic < ApplicationRecord
                    PRIORITY            = 0
                    MINIMUM_BODY_LENGTH = 20
                    EDITED_OFFSET_TIME  = 600 # 10 minutes
                    POINTS              = 3
                  Severity: Minor
                  Found in app/models/topic.rb - About 2 hrs to fix

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

                            var lazyUnveil = rAFIt(function (elem, detail, isAuto, sizes, isImg){
                                var src, srcset, parent, isPicture, event, firesLoad;
                    
                                if(!(event = triggerEvent(elem, 'lazybeforeunveil', detail)).defaultPrevented){
                    
                    

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

                              var checkElements = function() {
                                  var eLlen, i, rect, autoLoadElem, loadedSomething, elemExpand, elemNegativeExpand, elemExpandVal, beforeExpandVal;
                      
                                  var lazyloadElems = lazysizes.elements;
                      
                      

                        Function autoSizer has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            var autoSizer = (function(){
                                var autosizesElems;
                        
                                var sizeElement = rAFIt(function(elem, parent, event, width){
                                    var sources, i, len;

                          Function throttle has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              var throttle = function(fn){
                                  var running;
                                  var lastTime = 0;
                                  var gDelay = lazySizesConfig.throttleDelay;
                                  var rICTimeout = lazySizesConfig.ricTimeout;

                            Consider simplifying this complex logical expression.
                            Open

                                        if( (isAuto || !isCompleted) && isImg && (elem[_getAttribute]('src') || elem.srcset) && !elem.complete && !hasClass(elem, lazySizesConfig.errorClass) && hasClass(elem, lazySizesConfig.lazyClass)){return;}

                              Function _ has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                          _: function(){
                                              started = Date.now();
                              
                                              lazysizes.elements = document.getElementsByClassName(lazySizesConfig.lazyClass);
                                              preloadElems = document.getElementsByClassName(lazySizesConfig.lazyClass + ' ' + lazySizesConfig.preloadClass);

                                Function rAF has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    var rAF = (function(){
                                        var running, waiting;
                                        var firstFns = [];
                                        var secondFns = [];
                                        var fns = firstFns;

                                  Function lazyUnveil has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                  Open

                                          var lazyUnveil = rAFIt(function (elem, detail, isAuto, sizes, isImg){

                                    Function triggerEvent has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                    Open

                                        var triggerEvent = function(elem, name, detail, noBubbles, noCancelable){
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language