Showing 8 of 30 total issues

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

/* ===================================================
 * bootstrap-transition.js v2.1.1
 * http://twitter.github.com/bootstrap/javascript.html#transitions
 * ===================================================
 * Copyright 2012 Twitter, Inc.
Severity: Major
Found in public/bootstrap/js/bootstrap.js - About 3 days to fix

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

    class User < ActiveRecord::Base
    
      devise :database_authenticatable, :registerable,
             :recoverable, :rememberable, :trackable, :validatable
    
    
    Severity: Minor
    Found in app/models/user.rb - About 2 hrs to fix

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

        , show: function () {
            var $tip
              , inside
              , pos
              , actualWidth
      Severity: Minor
      Found in public/bootstrap/js/bootstrap.js - About 1 hr to fix

        Method query has 39 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def query
            message = parse_xml_to_hash(params[:xml])
            case message.content
              when '1'
                books = Book.order("RANDOM()").limit(5)
        Severity: Minor
        Found in app/controllers/wei_xin_controller.rb - About 1 hr to fix

          Function slide has 36 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            , slide: function (type, next) {
                var $active = this.$element.find('.item.active')
                  , $next = next || $active[type]()
                  , isCycling = this.interval
                  , direction = type == 'next' ? 'left' : 'right'
          Severity: Minor
          Found in public/bootstrap/js/bootstrap.js - About 1 hr to fix

            Function showBooks has 34 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                var showBooks = function (json) {
                    $('.books').empty().append('<p>共<b>' + json.count + '</b>条结果</p>');
                    var books = json.books;
                    books = $.isArray(books) ? books : books.toArray()
                    for (var i = 0; i < books.length; i++) {
            Severity: Minor
            Found in app/assets/javascripts/add-book.js - About 1 hr to fix

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

                  , show: function () {
                      var that = this
                        , e = $.Event('show')
              
                      this.$element.trigger(e)
              Severity: Minor
              Found in public/bootstrap/js/bootstrap.js - About 1 hr to fix

                Method storeBooks has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  def storeBooks(json, user)
                    collections = json['collections']
                    collections.each { |collection, index|
                      book = collection['book']
                      if book['isbn13'] != nil
                Severity: Minor
                Found in app/workers/douban_books_worker.rb - About 25 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