JamesChevalier/Little-Corner

View on GitHub

Showing 5 of 18 total issues

File lightbox.js has 283 lines of code (exceeds 250 allowed). Consider refactoring.
Open


/*
Lightbox v2.51
by Lokesh Dhakar - http://www.lokeshdhakar.com

Severity: Minor
Found in app/assets/javascripts/lightbox.js - About 2 hrs to fix

    Function build has 66 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        Lightbox.prototype.build = function() {
          var $lightbox,
            _this = this;
          $("<div>", {
            id: 'lightboxOverlay'
    Severity: Major
    Found in app/assets/javascripts/lightbox.js - About 2 hrs to fix

      Function sizeContainer has 33 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          Lightbox.prototype.sizeContainer = function(imageWidth, imageHeight) {
            var $container, $lightbox, $outerContainer, containerBottomPadding, containerLeftPadding, containerRightPadding, containerTopPadding, newHeight, newWidth, oldHeight, oldWidth,
              _this = this;
            $lightbox = $('#lightbox');
            $outerContainer = $lightbox.find('.lb-outerContainer');
      Severity: Minor
      Found in app/assets/javascripts/lightbox.js - About 1 hr to fix

        Function start has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            Lightbox.prototype.start = function($link) {
              var $lightbox, $window, a, i, imageNumber, left, top, _len, _ref;
              $(window).on("resize", this.sizeOverlay);
              $('select, object, embed').css({
                visibility: "hidden"
        Severity: Minor
        Found in app/assets/javascripts/lightbox.js - About 1 hr to fix

          Method index has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

            def index
              @foursquare_badges      = Rails.cache.fetch('foursquare_badges', expires_in: 12.hours, race_condition_ttl: 10) do
                foursquare_connection = Foursquare2::Client.new(client_id: FOURSQUARE_CLIENT_ID,
                                                                client_secret: FOURSQUARE_CLIENT_SECRET,
                                                                oauth_token: FOURSQUARE_OAUTH_TOKEN,
          Severity: Minor
          Found in app/controllers/foursquare_controller.rb - About 55 mins to fix

          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

          Severity
          Category
          Status
          Source
          Language