monsij/StudentPortal

View on GitHub
pro1/staticfiles/blog/bootstrap/js/bootstrap.js

Summary

Maintainability
F
8 mos
Test Coverage

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

/*!
  * Bootstrap v4.1.3 (https://getbootstrap.com/)
  * Copyright 2011-2018 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  */
Severity: Major
Found in pro1/staticfiles/blog/bootstrap/js/bootstrap.js - About 1 wk to fix

    Function Tooltip has 515 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      var Tooltip = function ($$$1) {
        /**
         * ------------------------------------------------------------------------
         * Constants
         * ------------------------------------------------------------------------
    Severity: Major
    Found in pro1/staticfiles/blog/bootstrap/js/bootstrap.js - About 2 days to fix

      Function Tooltip has 432 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function () {
            function Tooltip(element, config) {
              /**
               * Check for Popper dependency
               * Popper - https://popper.js.org
      Severity: Major
      Found in pro1/staticfiles/blog/bootstrap/js/bootstrap.js - About 2 days to fix

        Function Modal has 414 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          var Modal = function ($$$1) {
            /**
             * ------------------------------------------------------------------------
             * Constants
             * ------------------------------------------------------------------------
        Severity: Major
        Found in pro1/staticfiles/blog/bootstrap/js/bootstrap.js - About 2 days to fix

          Function Carousel has 368 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            var Carousel = function ($$$1) {
              /**
               * ------------------------------------------------------------------------
               * Constants
               * ------------------------------------------------------------------------
          Severity: Major
          Found in pro1/staticfiles/blog/bootstrap/js/bootstrap.js - About 1 day to fix

            Function Modal has 335 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function () {
                  function Modal(element, config) {
                    this._config = this._getConfig(config);
                    this._element = element;
                    this._dialog = element.querySelector(Selector.DIALOG);
            Severity: Major
            Found in pro1/staticfiles/blog/bootstrap/js/bootstrap.js - About 1 day to fix

              Function Dropdown has 335 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                var Dropdown = function ($$$1) {
                  /**
                   * ------------------------------------------------------------------------
                   * Constants
                   * ------------------------------------------------------------------------
              Severity: Major
              Found in pro1/staticfiles/blog/bootstrap/js/bootstrap.js - About 1 day to fix

                Function Carousel has 292 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    function () {
                      function Carousel(element, config) {
                        this._items = null;
                        this._interval = null;
                        this._activeElement = null;
                Severity: Major
                Found in pro1/staticfiles/blog/bootstrap/js/bootstrap.js - About 1 day to fix

                  Function Collapse has 262 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    var Collapse = function ($$$1) {
                      /**
                       * ------------------------------------------------------------------------
                       * Constants
                       * ------------------------------------------------------------------------
                  Severity: Major
                  Found in pro1/staticfiles/blog/bootstrap/js/bootstrap.js - About 1 day to fix

                    Function Dropdown has 254 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        function () {
                          function Dropdown(element, config) {
                            this._element = element;
                            this._popper = null;
                            this._config = this._getConfig(config);
                    Severity: Major
                    Found in pro1/staticfiles/blog/bootstrap/js/bootstrap.js - About 1 day to fix

                      Function ScrollSpy has 220 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        var ScrollSpy = function ($$$1) {
                          /**
                           * ------------------------------------------------------------------------
                           * Constants
                           * ------------------------------------------------------------------------
                      Severity: Major
                      Found in pro1/staticfiles/blog/bootstrap/js/bootstrap.js - About 1 day to fix

                        Function Collapse has 203 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            function () {
                              function Collapse(element, config) {
                                this._isTransitioning = false;
                                this._element = element;
                                this._config = this._getConfig(config);
                        Severity: Major
                        Found in pro1/staticfiles/blog/bootstrap/js/bootstrap.js - About 1 day to fix

                          Function Tab has 170 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            var Tab = function ($$$1) {
                              /**
                               * ------------------------------------------------------------------------
                               * Constants
                               * ------------------------------------------------------------------------
                          Severity: Major
                          Found in pro1/staticfiles/blog/bootstrap/js/bootstrap.js - About 6 hrs to fix

                            Function ScrollSpy has 161 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                function () {
                                  function ScrollSpy(element, config) {
                                    var _this = this;
                            
                                    this._element = element;
                            Severity: Major
                            Found in pro1/staticfiles/blog/bootstrap/js/bootstrap.js - About 6 hrs to fix

                              Function Popover has 137 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                var Popover = function ($$$1) {
                                  /**
                                   * ------------------------------------------------------------------------
                                   * Constants
                                   * ------------------------------------------------------------------------
                              Severity: Major
                              Found in pro1/staticfiles/blog/bootstrap/js/bootstrap.js - About 5 hrs to fix

                                Function Tab has 127 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    function () {
                                      function Tab(element) {
                                        this._element = element;
                                      } // Getters
                                
                                
                                Severity: Major
                                Found in pro1/staticfiles/blog/bootstrap/js/bootstrap.js - About 5 hrs to fix

                                  Function Alert has 108 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                    var Alert = function ($$$1) {
                                      /**
                                       * ------------------------------------------------------------------------
                                       * Constants
                                       * ------------------------------------------------------------------------
                                  Severity: Major
                                  Found in pro1/staticfiles/blog/bootstrap/js/bootstrap.js - About 4 hrs to fix

                                    Function Button has 105 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                      var Button = function ($$$1) {
                                        /**
                                         * ------------------------------------------------------------------------
                                         * Constants
                                         * ------------------------------------------------------------------------
                                    Severity: Major
                                    Found in pro1/staticfiles/blog/bootstrap/js/bootstrap.js - About 4 hrs to fix

                                      Function Util has 93 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                        var Util = function ($$$1) {
                                          /**
                                           * ------------------------------------------------------------------------
                                           * Private TransitionEnd Helpers
                                           * ------------------------------------------------------------------------
                                      Severity: Major
                                      Found in pro1/staticfiles/blog/bootstrap/js/bootstrap.js - About 3 hrs to fix

                                        Function Popover has 91 lines of code (exceeds 25 allowed). Consider refactoring.
                                        Open

                                            function (_Tooltip) {
                                              _inheritsLoose(Popover, _Tooltip);
                                        
                                              function Popover() {
                                                return _Tooltip.apply(this, arguments) || this;
                                        Severity: Major
                                        Found in pro1/staticfiles/blog/bootstrap/js/bootstrap.js - About 3 hrs to fix

                                          Function Alert has 78 lines of code (exceeds 25 allowed). Consider refactoring.
                                          Open

                                              function () {
                                                function Alert(element) {
                                                  this._element = element;
                                                } // Getters
                                          
                                          
                                          Severity: Major
                                          Found in pro1/staticfiles/blog/bootstrap/js/bootstrap.js - About 3 hrs to fix

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

                                                  _proto.show = function show() {
                                                    var _this = this;
                                            
                                                    if ($$$1(this.element).css('display') === 'none') {
                                                      throw new Error('Please use show on visible elements');
                                            Severity: Major
                                            Found in pro1/staticfiles/blog/bootstrap/js/bootstrap.js - About 3 hrs to fix

                                              Function _slide has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                                              Open

                                                    _proto._slide = function _slide(direction, element) {
                                                      var _this3 = this;
                                              
                                                      var activeElement = this._element.querySelector(Selector.ACTIVE_ITEM);
                                              
                                              
                                              Severity: Major
                                              Found in pro1/staticfiles/blog/bootstrap/js/bootstrap.js - About 2 hrs to fix

                                                Function Button has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                                                Open

                                                    function () {
                                                      function Button(element) {
                                                        this._element = element;
                                                      } // Getters
                                                
                                                
                                                Severity: Major
                                                Found in pro1/staticfiles/blog/bootstrap/js/bootstrap.js - About 2 hrs to fix

                                                  Function _showBackdrop has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                                                  Open

                                                        _proto._showBackdrop = function _showBackdrop(callback) {
                                                          var _this8 = this;
                                                  
                                                          var animate = $$$1(this._element).hasClass(ClassName.FADE) ? ClassName.FADE : '';
                                                  
                                                  
                                                  Severity: Major
                                                  Found in pro1/staticfiles/blog/bootstrap/js/bootstrap.js - About 2 hrs to fix

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

                                                          _proto.show = function show() {
                                                            var _this = this;
                                                    
                                                            if (this._isTransitioning || $$$1(this._element).hasClass(ClassName.SHOW)) {
                                                              return;
                                                    Severity: Minor
                                                    Found in pro1/staticfiles/blog/bootstrap/js/bootstrap.js - About 1 hr to fix

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

                                                            _proto.show = function show() {
                                                              var _this = this;
                                                      
                                                              if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $$$1(this._element).hasClass(ClassName.ACTIVE) || $$$1(this._element).hasClass(ClassName.DISABLED)) {
                                                                return;
                                                      Severity: Minor
                                                      Found in pro1/staticfiles/blog/bootstrap/js/bootstrap.js - About 1 hr to fix

                                                        Function toggle has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                                                        Open

                                                              _proto.toggle = function toggle() {
                                                                if (this._element.disabled || $$$1(this._element).hasClass(ClassName.DISABLED)) {
                                                                  return;
                                                                }
                                                        
                                                        
                                                        Severity: Minor
                                                        Found in pro1/staticfiles/blog/bootstrap/js/bootstrap.js - About 1 hr to fix

                                                          Function _clearMenus has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                                                          Open

                                                                Dropdown._clearMenus = function _clearMenus(event) {
                                                                  if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) {
                                                                    return;
                                                                  }
                                                          
                                                          
                                                          Severity: Minor
                                                          Found in pro1/staticfiles/blog/bootstrap/js/bootstrap.js - About 1 hr to fix

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

                                                                  _proto.hide = function hide(callback) {
                                                                    var _this2 = this;
                                                            
                                                                    var tip = this.getTipElement();
                                                                    var hideEvent = $$$1.Event(this.constructor.Event.HIDE);
                                                            Severity: Minor
                                                            Found in pro1/staticfiles/blog/bootstrap/js/bootstrap.js - About 1 hr to fix

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

                                                                    _proto.show = function show(relatedTarget) {
                                                                      var _this = this;
                                                              
                                                                      if (this._isTransitioning || this._isShown) {
                                                                        return;
                                                              Severity: Minor
                                                              Found in pro1/staticfiles/blog/bootstrap/js/bootstrap.js - About 1 hr to fix

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

                                                                      _proto.hide = function hide() {
                                                                        var _this2 = this;
                                                                
                                                                        if (this._isTransitioning || !$$$1(this._element).hasClass(ClassName.SHOW)) {
                                                                          return;
                                                                Severity: Minor
                                                                Found in pro1/staticfiles/blog/bootstrap/js/bootstrap.js - About 1 hr to fix

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

                                                                        _proto.toggle = function toggle() {
                                                                          var triggerChangeEvent = true;
                                                                          var addAriaPressed = true;
                                                                          var rootElement = $$$1(this._element).closest(Selector.DATA_TOGGLE)[0];
                                                                  
                                                                  
                                                                  Severity: Minor
                                                                  Found in pro1/staticfiles/blog/bootstrap/js/bootstrap.js - About 1 hr to fix

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

                                                                          Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) {
                                                                            // If not input/textarea:
                                                                            //  - And not a key in REGEXP_KEYDOWN => not a dropdown command
                                                                            // If input/textarea:
                                                                            //  - If space key => not a dropdown command
                                                                    Severity: Minor
                                                                    Found in pro1/staticfiles/blog/bootstrap/js/bootstrap.js - About 1 hr to fix

                                                                      Function _showElement has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                      Open

                                                                            _proto._showElement = function _showElement(relatedTarget) {
                                                                              var _this3 = this;
                                                                      
                                                                              var transition = $$$1(this._element).hasClass(ClassName.FADE);
                                                                      
                                                                      
                                                                      Severity: Minor
                                                                      Found in pro1/staticfiles/blog/bootstrap/js/bootstrap.js - About 1 hr to fix

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

                                                                              _proto.hide = function hide(event) {
                                                                                var _this2 = this;
                                                                        
                                                                                if (event) {
                                                                                  event.preventDefault();
                                                                        Severity: Minor
                                                                        Found in pro1/staticfiles/blog/bootstrap/js/bootstrap.js - About 1 hr to fix

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

                                                                                _proto.refresh = function refresh() {
                                                                                  var _this2 = this;
                                                                          
                                                                                  var autoMethod = this._scrollElement === this._scrollElement.window ? OffsetMethod.OFFSET : OffsetMethod.POSITION;
                                                                                  var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
                                                                          Severity: Minor
                                                                          Found in pro1/staticfiles/blog/bootstrap/js/bootstrap.js - About 1 hr to fix

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

                                                                                  _proto._getPopperConfig = function _getPopperConfig() {
                                                                                    var _this2 = this;
                                                                            
                                                                                    var offsetConf = {};
                                                                            
                                                                            
                                                                            Severity: Minor
                                                                            Found in pro1/staticfiles/blog/bootstrap/js/bootstrap.js - About 1 hr to fix

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

                                                                                    _proto._setListeners = function _setListeners() {
                                                                                      var _this3 = this;
                                                                              
                                                                                      var triggers = this.config.trigger.split(' ');
                                                                                      triggers.forEach(function (trigger) {
                                                                              Severity: Minor
                                                                              Found in pro1/staticfiles/blog/bootstrap/js/bootstrap.js - About 1 hr to fix

                                                                                Function _transitionComplete has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                                Open

                                                                                      _proto._transitionComplete = function _transitionComplete(element, active, callback) {
                                                                                        if (active) {
                                                                                          $$$1(active).removeClass(ClassName.SHOW + " " + ClassName.ACTIVE);
                                                                                          var dropdownChild = $$$1(active.parentNode).find(Selector.DROPDOWN_ACTIVE_CHILD)[0];
                                                                                
                                                                                
                                                                                Severity: Minor
                                                                                Found in pro1/staticfiles/blog/bootstrap/js/bootstrap.js - About 1 hr to fix

                                                                                  Avoid deeply nested control flow statements.
                                                                                  Open

                                                                                                  if (activeElement) {
                                                                                                    $$$1(activeElement).removeClass(ClassName.ACTIVE);
                                                                                                  }
                                                                                  Severity: Major
                                                                                  Found in pro1/staticfiles/blog/bootstrap/js/bootstrap.js - About 45 mins to fix

                                                                                    Consider simplifying this complex logical expression.
                                                                                    Open

                                                                                            if (!isActive && (event.which !== ESCAPE_KEYCODE || event.which !== SPACE_KEYCODE) || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) {
                                                                                              if (event.which === ESCAPE_KEYCODE) {
                                                                                                var toggle = parent.querySelector(Selector.DATA_TOGGLE);
                                                                                                $$$1(toggle).trigger('focus');
                                                                                              }
                                                                                    Severity: Major
                                                                                    Found in pro1/staticfiles/blog/bootstrap/js/bootstrap.js - About 40 mins to fix

                                                                                      Consider simplifying this complex logical expression.
                                                                                      Open

                                                                                                if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && $$$1.contains(parent, event.target)) {
                                                                                                  continue;
                                                                                                }
                                                                                      Severity: Major
                                                                                      Found in pro1/staticfiles/blog/bootstrap/js/bootstrap.js - About 40 mins to fix

                                                                                        Consider simplifying this complex logical expression.
                                                                                        Open

                                                                                            if (version[0] < ltMajor && version[1] < minMinor || version[0] === minMajor && version[1] === minMinor && version[2] < minPatch || version[0] >= maxMajor) {
                                                                                              throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0');
                                                                                            }
                                                                                        Severity: Major
                                                                                        Found in pro1/staticfiles/blog/bootstrap/js/bootstrap.js - About 40 mins to fix

                                                                                          Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                          Open

                                                                                          (function (global, factory) {
                                                                                            typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('jquery'), require('popper.js')) :
                                                                                            typeof define === 'function' && define.amd ? define(['exports', 'jquery', 'popper.js'], factory) :
                                                                                            (factory((global.bootstrap = {}),global.jQuery,global.Popper));
                                                                                          }(this, (function (exports,$,Popper) { 'use strict';
                                                                                          Severity: Major
                                                                                          Found in pro1/staticfiles/blog/bootstrap/js/bootstrap.js and 1 other location - About 7 mos to fix
                                                                                          pro1/staticfiles/bootstrap/js/bootstrap.js on lines 6..3943

                                                                                          Duplicated Code

                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                          Tuning

                                                                                          This issue has a mass of 31449.

                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                          Refactorings

                                                                                          Further Reading

                                                                                          There are no issues that match your filters.

                                                                                          Category
                                                                                          Status