twbs/bootstrap

View on GitHub

Showing 40 of 123 total issues

Function onload has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring.
Open

window.onload = function () { // wait for load in a dumb way because B-0
  'use strict';

  var cw = '/*!\n' +
           ' * Bootstrap v3.4.0 (https://getbootstrap.com/)\n' +
Severity: Minor
Found in docs/assets/js/src/customizer.js - About 1 day 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

File Gruntfile.js has 407 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*!
 * Bootstrap's Gruntfile
 * https://getbootstrap.com/
 * Copyright 2013-2018 Twitter, Inc.
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
Severity: Minor
Found in Gruntfile.js - About 5 hrs to fix

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

    /* ========================================================================
     * Bootstrap: tooltip.js v3.4.0
     * https://getbootstrap.com/docs/3.4/javascript/#tooltip
     * Inspired by the original jQuery.tipsy by Jason Frame
     * ========================================================================
    Severity: Minor
    Found in js/tooltip.js - About 5 hrs to fix

      File customizer.js has 314 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /*!
       * Bootstrap Customizer (http://getbootstrap.com/customize/)
       * Copyright 2011-2018 Twitter, Inc.
       *
       * Licensed under the Creative Commons Attribution 3.0 Unported License. For
      Severity: Minor
      Found in docs/assets/js/src/customizer.js - About 3 hrs to fix

        File modal.js has 265 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        /* ========================================================================
         * Bootstrap: modal.js v3.4.0
         * https://getbootstrap.com/docs/3.4/javascript/#modals
         * ========================================================================
         * Copyright 2011-2018 Twitter, Inc.
        Severity: Minor
        Found in js/modal.js - About 2 hrs to fix

          Function slide has 46 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 js/carousel.js - About 1 hr to fix

            Function slide has 46 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 docs/dist/js/bootstrap.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 js/modal.js - About 1 hr to fix

                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 js/modal.js - About 1 hr to fix

                  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 docs/dist/js/bootstrap.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 docs/dist/js/bootstrap.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 js/tab.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 docs/dist/js/bootstrap.js - About 1 hr to fix

                          Function _shift has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          Tokenizer.prototype._shift = function () {
                            // returning null signals EOF
                            // returning undefined means the line was ignored
                            if (this._next !== undefined) {
                              var result = this._next;
                          Severity: Minor
                          Found in grunt/bs-lessdoc-parser.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 js/collapse.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 docs/dist/js/bootstrap.js - About 1 hr to fix

                                Function generateCSS has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                  function generateCSS(preamble) {
                                    var promise = $.Deferred()
                                    var oneChecked = false
                                    var lessFileIncludes = {}
                                    $('#less-section input').each(function () {
                                Severity: Minor
                                Found in docs/assets/js/src/customizer.js - About 1 hr to fix

                                  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 js/tooltip.js - About 1 hr to fix

                                    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 docs/dist/js/bootstrap.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 docs/dist/js/bootstrap.js - About 1 hr to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language