seyhunak/twitter-bootstrap-rails

View on GitHub

Showing 23 of 59 total issues

File tooltip.js has 376 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* ========================================================================
 * Bootstrap: tooltip.js v3.3.6
 * http://getbootstrap.com/javascript/#tooltip
 * Inspired by the original jQuery.tipsy by Jason Frame
 * ========================================================================
Severity: Minor
Found in app/assets/javascripts/twitter/bootstrap/tooltip.js - About 5 hrs to fix

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

        class ThemedGenerator < ::Rails::Generators::Base
          source_root File.expand_path('../templates', __FILE__)
          argument :controller_path,    :type => :string
          argument :model_name,         :type => :string, :required => false
          argument :layout,             :type => :string, :default => "application",
    Severity: Minor
    Found in lib/generators/bootstrap/themed/themed_generator.rb - About 2 hrs to fix

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

        Tooltip.prototype.show = function () {
          var e = $.Event('show.bs.' + this.type)
      
          if (this.hasContent() && this.enabled) {
            this.$element.trigger(e)
      Severity: Major
      Found in app/assets/javascripts/twitter/bootstrap/tooltip.js - About 2 hrs to fix

        Method bootstrap_flash has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

          def bootstrap_flash(options = {})
            flash_messages = []
            flash.each do |type, message|
              # Skip empty messages, e.g. for devise messages set to nothing in a locale file.
              next if message.blank?
        Severity: Minor
        Found in app/helpers/bootstrap_flash_helper.rb - About 2 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

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

          Carousel.prototype.slide = function (type, next) {
            var $active   = this.$element.find('.item.active')
            var $next     = next || this.getItemForDirection(type, $active)
            var isCycling = this.interval
            var direction = type == 'next' ? 'left' : 'right'
        Severity: Minor
        Found in app/assets/javascripts/twitter/bootstrap/carousel.js - About 1 hr to fix

          Method add_bootstrap_breadcrumb has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

                def add_bootstrap_breadcrumb(name, url = '', options = {})
                  @__bs_breadcrumbs ||= []
          
                  class_name = options.delete(:klass) || self.class.name
          
          
          Severity: Minor
          Found in lib/twitter/bootstrap/rails/breadcrumbs.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 show has 39 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            Modal.prototype.show = function (_relatedTarget) {
              var that = this
              var e    = $.Event('show.bs.modal', { relatedTarget: _relatedTarget })
          
              this.$element.trigger(e)
          Severity: Minor
          Found in app/assets/javascripts/twitter/bootstrap/modal.js - About 1 hr to fix

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

              Modal.prototype.backdrop = function (callback) {
                var that = this
                var animate = this.$element.hasClass('fade') ? 'fade' : ''
            
                if (this.isShown && this.options.backdrop) {
            Severity: Minor
            Found in app/assets/javascripts/twitter/bootstrap/modal.js - About 1 hr to fix

              Function activate has 38 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                Tab.prototype.activate = function (element, container, callback) {
                  var $active    = container.find('> .active')
                  var transition = callback
                    && $.support.transition
                    && ($active.length && $active.hasClass('fade') || !!container.find('> .fade').length)
              Severity: Minor
              Found in app/assets/javascripts/twitter/bootstrap/tab.js - About 1 hr to fix

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

                  Collapse.prototype.show = function () {
                    if (this.transitioning || this.$element.hasClass('in')) return
                
                    var activesData
                    var actives = this.$parent && this.$parent.children('.panel').children('.in, .collapsing')
                Severity: Minor
                Found in app/assets/javascripts/twitter/bootstrap/collapse.js - About 1 hr to fix

                  Method uri_state has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def uri_state(uri, options={})
                      return options[:status] if options.key?(:status)
                  
                      root_url = request.host_with_port + '/'
                      root = uri == '/' || uri == root_url
                  Severity: Minor
                  Found in app/helpers/navbar_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 applyPlacement has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    Tooltip.prototype.applyPlacement = function (offset, placement) {
                      var $tip   = this.tip()
                      var width  = $tip[0].offsetWidth
                      var height = $tip[0].offsetHeight
                  
                  
                  Severity: Minor
                  Found in app/assets/javascripts/twitter/bootstrap/tooltip.js - About 1 hr to fix

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

                      Tab.prototype.show = function () {
                        var $this    = this.element
                        var $ul      = $this.closest('ul:not(.dropdown-menu)')
                        var selector = $this.data('target')
                    
                    
                    Severity: Minor
                    Found in app/assets/javascripts/twitter/bootstrap/tab.js - About 1 hr to fix

                      Function checkPosition has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        Affix.prototype.checkPosition = function () {
                          if (!this.$element.is(':visible')) return
                      
                          var height       = this.$element.height()
                          var offset       = this.options.offset
                      Severity: Minor
                      Found in app/assets/javascripts/twitter/bootstrap/affix.js - About 1 hr to fix

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

                            function next() {
                              $active
                                .removeClass('active')
                                .find('> .dropdown-menu > .active')
                                  .removeClass('active')
                        Severity: Minor
                        Found in app/assets/javascripts/twitter/bootstrap/tab.js - About 1 hr to fix

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

                            ScrollSpy.prototype.refresh = function () {
                              var that          = this
                              var offsetMethod  = 'offset'
                              var offsetBase    = 0
                          
                          
                          Severity: Minor
                          Found in app/assets/javascripts/twitter/bootstrap/scrollspy.js - About 1 hr to fix

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

                              Collapse.prototype.hide = function () {
                                if (this.transitioning || !this.$element.hasClass('in')) return
                            
                                var startEvent = $.Event('hide.bs.collapse')
                                this.$element.trigger(startEvent)
                            Severity: Minor
                            Found in app/assets/javascripts/twitter/bootstrap/collapse.js - About 1 hr to fix

                              Method container_div has 6 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                                def container_div(brand, brand_link, responsive, fluid, no_turbolink, &block)
                              Severity: Minor
                              Found in app/helpers/navbar_helper.rb - About 45 mins to fix

                                Method container_div_with_block has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                  def container_div_with_block(brand, brand_link, responsive, no_turbolink, &block)
                                Severity: Minor
                                Found in app/helpers/navbar_helper.rb - About 35 mins to fix

                                  Method add_assets has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                        def add_assets
                                  
                                          js_manifest = 'app/assets/javascripts/application.js'
                                  
                                          if File.exist?(js_manifest)
                                  Severity: Minor
                                  Found in lib/generators/bootstrap/install/install_generator.rb - About 35 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