yippie-io/iUPB

View on GitHub

Showing 49 of 49 total issues

Function addToHome has a Cognitive Complexity of 112 (exceeds 5 allowed). Consider refactoring.
Open

var addToHome = (function (w) {
    var nav = w.navigator,
        isIDevice = 'platform' in nav && (/iphone|ipod|ipad/gi).test(nav.platform),
        isIPad,
        isRetina,
Severity: Minor
Found in public/scripts/add2home.js - About 2 days 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

Function addToHome has 267 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var addToHome = (function (w) {
    var nav = w.navigator,
        isIDevice = 'platform' in nav && (/iphone|ipod|ipad/gi).test(nav.platform),
        isIPad,
        isRetina,
Severity: Major
Found in public/scripts/add2home.js - About 1 day to fix

    Function expander has 225 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      $.fn.expander = function(options) {
        var meth = 'init';
    
        if (typeof options == 'string') {
          meth = options;
    Severity: Major
    Found in app/assets/javascripts/libs/jquery.expander.js - About 1 day to fix

      Function init has 130 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            init: function() {
              this.each(function() {
                var i, l, tmp, newChar, summTagless, summOpens, summCloses,
                    lastCloseTag, detailText, detailTagless,
                    $thisDetails, $readMore,
      Severity: Major
      Found in app/assets/javascripts/libs/jquery.expander.js - About 5 hrs to fix

        File bootstrap-datepicker.js has 359 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        /* =========================================================
         * bootstrap-datepicker.js 
         * http://www.eyecon.ro/bootstrap-datepicker
         * =========================================================
         * Copyright 2012 Stefan Petre
        Severity: Minor
        Found in app/assets/javascripts/libs/bootstrap-datepicker.js - About 4 hrs to fix

          Method get_menu_data has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
          Open

            def self.get_menu_data(csv_uri)
              old_locale = I18n.locale
              I18n.locale = :de
              
              csv = Rails.cache.fetch("iUPB.restaurant_csv", :expires_in => 2.hours) do
          Severity: Minor
          Found in lib/restaurant_helper.rb - About 3 hrs 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

          Method get_menu_data has 70 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def self.get_menu_data(csv_uri)
              old_locale = I18n.locale
              I18n.locale = :de
              
              csv = Rails.cache.fetch("iUPB.restaurant_csv", :expires_in => 2.hours) do
          Severity: Major
          Found in lib/restaurant_helper.rb - About 2 hrs to fix

            Function dateFormat has 65 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            var dateFormat = function () {
                var    token = /d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZ]|"[^"]*"|'[^']*'/g,
                    timezone = /\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,
                    timezoneClip = /[^-+\dA-Z]/g,
                    pad = function (val, len) {
            Severity: Major
            Found in app/assets/javascripts/libs/date.format.js - About 2 hrs to fix

              Function retrieveJSON has 64 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  $.retrieveJSON = function(url, data, fn) {
                    // allow jQuery.retrieveJSON(url, fn)
                    if ($.isFunction(data)) {
                      fn = data;
                      data = {};
              Severity: Major
              Found in app/assets/javascripts/libs/jquery.offline.js - About 2 hrs to fix

                File add2home.js has 269 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                /*!
                 * Add to Homescreen v2.0 ~ Copyright (c) 2012 Matteo Spinelli, http://cubiq.org
                 * Released under MIT license, http://cubiq.org/license
                 */
                var addToHome = (function (w) {
                Severity: Minor
                Found in public/scripts/add2home.js - About 2 hrs to fix

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

                          fill: function() {
                              var d = new Date(this.viewDate),
                                  year = d.getFullYear(),
                                  month = d.getMonth(),
                                  currentDate = this.date.valueOf();
                  Severity: Major
                  Found in app/assets/javascripts/libs/bootstrap-datepicker.js - About 2 hrs to fix

                    Function show has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        function show () {
                            var duration,
                                iPadXShift = 160;
                    
                            // Set the initial position
                    Severity: Major
                    Found in public/scripts/add2home.js - About 2 hrs to fix

                      File spin.js has 257 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      //fgnass.github.com/spin.js#v1.2.5
                      (function(window, document, undefined) {
                      
                      /**
                       * Copyright (c) 2011 Felix Gnass [fgnass at neteye dot de]
                      Severity: Minor
                      Found in app/assets/javascripts/libs/spin.js - About 2 hrs to fix

                        File jquery.expander.js has 257 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        /*!
                         * jQuery Expander Plugin v1.4.3
                         *
                         * Date: Tue Jun 19 11:54:00 2012 EDT
                         * Requires: jQuery v1.3+
                        Severity: Minor
                        Found in app/assets/javascripts/libs/jquery.expander.js - About 2 hrs to fix

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

                                  click: function(e) {
                                      e.stopPropagation();
                                      e.preventDefault();
                                      var target = $(e.target).closest('span, td, th');
                                      if (target.length == 1) {
                          Severity: Major
                          Found in app/assets/javascripts/libs/bootstrap-datepicker.js - About 2 hrs to fix

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

                              def index
                                @categories = AdCategory.where(parent_id: params[:category]||nil).asc(:name)
                                if params[:category]
                                  @category = AdCategory.find(params[:category])
                                end
                            Severity: Minor
                            Found in app/controllers/ads_controller.rb - About 1 hr 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

                            Method facebook_events has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                            Open

                              def self.facebook_events(id)
                                graph = Koala::Facebook::API.new(Facebook::TOKEN)
                                events = graph.get_connections(id.to_s, "events").map do |event|
                                  begin
                                    event["start_time"] = event["start_time"] + "T21:00:00" if event["start_time"].length <= 10
                            Severity: Minor
                            Found in lib/facebook_helper.rb - About 1 hr 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

                            Function loaded has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                function loaded () {
                                    w.removeEventListener('load', loaded, false);
                            
                                    if ( !overrideChecks && (!isSafari || !isExpired || isSessionActive || isStandalone || !isReturningVisitor) ) return;
                            
                            
                            Severity: Minor
                            Found in public/scripts/add2home.js - About 1 hr to fix

                              Function close has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  function close () {
                                      clearInterval( positionInterval );
                                      clearTimeout( closeTimeout );
                                      closeTimeout = null;
                              
                              
                              Severity: Minor
                              Found in public/scripts/add2home.js - About 1 hr to fix

                                Method index has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                  def index
                                    @categories = AdCategory.where(parent_id: params[:category]||nil).asc(:name)
                                    if params[:category]
                                      @category = AdCategory.find(params[:category])
                                    end
                                Severity: Minor
                                Found in app/controllers/ads_controller.rb - About 1 hr to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language