twbs/bootstrap

View on GitHub

Showing 778 of 778 total issues

File dropdown.spec.js has 1240 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import Popper from 'popper.js'

import Dropdown from './dropdown'
import EventHandler from '../dom/event-handler'

Severity: Major
Found in js/src/dropdown/dropdown.spec.js - About 3 days to fix

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

      describe('jQueryInterface', () => {
        it('should create a tab', () => {
          fixtureEl.innerHTML = '<div></div>'
    
          const div = fixtureEl.querySelector('div')
    Severity: Major
    Found in js/src/tab/tab.spec.js and 2 other locations - About 3 days to fix
    js/src/scrollspy/scrollspy.spec.js on lines 574..634
    js/src/toast/toast.spec.js on lines 294..354

    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 540.

    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

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

      describe('jQueryInterface', () => {
        it('should create a scrollspy', () => {
          fixtureEl.innerHTML = '<div></div>'
    
          const div = fixtureEl.querySelector('div')
    Severity: Major
    Found in js/src/scrollspy/scrollspy.spec.js and 2 other locations - About 3 days to fix
    js/src/tab/tab.spec.js on lines 340..400
    js/src/toast/toast.spec.js on lines 294..354

    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 540.

    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

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

      describe('jQueryInterface', () => {
        it('should create a toast', () => {
          fixtureEl.innerHTML = '<div></div>'
    
          const div = fixtureEl.querySelector('div')
    Severity: Major
    Found in js/src/toast/toast.spec.js and 2 other locations - About 3 days to fix
    js/src/scrollspy/scrollspy.spec.js on lines 574..634
    js/src/tab/tab.spec.js on lines 340..400

    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 540.

    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

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

      static 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: Major
    Found in js/src/dropdown/dropdown.js and 1 other location - About 2 days to fix
    js/dist/dropdown.js on lines 551..605

    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 454.

    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

    Similar blocks of code found in 2 locations. 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: Major
    Found in js/dist/dropdown.js and 1 other location - About 2 days to fix
    js/src/dropdown/dropdown.js on lines 445..501

    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 454.

    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

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

      function () {
        function Tooltip(element, config) {
          if (typeof Popper === 'undefined') {
            throw new TypeError('Bootstrap\'s tooltips require Popper.js (https://popper.js.org)');
          } // private
    Severity: Major
    Found in js/dist/tooltip.js - About 2 days to fix

      File carousel.spec.js has 941 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import Carousel from './carousel'
      import EventHandler from '../dom/event-handler'
      
      /** Test helpers */
      import { getFixture, clearFixture, createEvent, jQueryMock } from '../../tests/helpers/fixture'
      Severity: Major
      Found in js/src/carousel/carousel.spec.js - About 2 days to fix

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

          describe('jQueryInterface', () => {
            it('should create a dropdown', () => {
              fixtureEl.innerHTML = '<div></div>'
        
              const div = fixtureEl.querySelector('div')
        Severity: Major
        Found in js/src/dropdown/dropdown.spec.js and 1 other location - About 2 days to fix
        js/src/collapse/collapse.spec.js on lines 763..806

        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 389.

        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

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

          describe('jQueryInterface', () => {
            it('should create a collapse', () => {
              fixtureEl.innerHTML = '<div></div>'
        
              const div = fixtureEl.querySelector('div')
        Severity: Major
        Found in js/src/collapse/collapse.spec.js and 1 other location - About 2 days to fix
        js/src/dropdown/dropdown.spec.js on lines 1501..1544

        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 389.

        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

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

          toggle() {
            let triggerChangeEvent = true
            let addAriaPressed = true
        
            const rootElement = SelectorEngine.closest(
        Severity: Major
        Found in js/src/button/button.js and 1 other location - About 2 days to fix
        js/dist/button.js on lines 97..137

        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 388.

        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

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

            _proto.toggle = function toggle() {
              var triggerChangeEvent = true;
              var addAriaPressed = true;
              var rootElement = SelectorEngine.closest(this._element, Selector.DATA_TOGGLE);
        
        
        Severity: Major
        Found in js/dist/button.js and 1 other location - About 2 days to fix
        js/src/button/button.js on lines 65..114

        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 388.

        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

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

          _process() {
            const scrollTop = this._getScrollTop() + this._config.offset
            const scrollHeight = this._getScrollHeight()
            const maxScroll = this._config.offset +
              scrollHeight -
        Severity: Major
        Found in js/src/scrollspy/scrollspy.js and 1 other location - About 2 days to fix
        js/dist/scrollspy.js on lines 325..363

        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 368.

        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

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

            _proto._process = function _process() {
              var scrollTop = this._getScrollTop() + this._config.offset;
        
              var scrollHeight = this._getScrollHeight();
        
        
        Severity: Major
        Found in js/dist/scrollspy.js and 1 other location - About 2 days to fix
        js/src/scrollspy/scrollspy.js on lines 214..252

        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 368.

        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

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

        /*!
          * Bootstrap tooltip.js v4.3.1 (https://getbootstrap.com/)
          * Copyright 2011-2019 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 js/dist/tooltip.js - About 2 days to fix

          Function Carousel has 379 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 js/dist/carousel.js - About 1 day to fix

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

              function () {
                function Modal(element, config) {
                  this._config = this._getConfig(config);
                  this._element = element;
                  this._dialog = SelectorEngine.findOne(Selector.DIALOG, element);
            Severity: Major
            Found in js/dist/modal.js - About 1 day to fix

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

              import Tooltip from './tooltip'
              import EventHandler from '../dom/event-handler'
              import { makeArray, noop } from '../util/index'
              
              /** Test helpers */
              Severity: Major
              Found in js/src/tooltip/tooltip.spec.js - About 1 day to fix

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

                    it('should adjust the inline padding of fixed elements when opening and restore when closing', done => {
                      fixtureEl.innerHTML = [
                        '<div class="fixed-top" style="padding-right: 0px"></div>',
                        '<div class="modal"><div class="modal-dialog" /></div>'
                      ].join('')
                Severity: Major
                Found in js/src/modal/modal.spec.js and 1 other location - About 1 day to fix
                js/src/modal/modal.spec.js on lines 115..144

                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 307.

                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

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

                    it('should adjust the inline margin of sticky elements when opening and restore when closing', done => {
                      fixtureEl.innerHTML = [
                        '<div class="sticky-top" style="margin-right: 0px;"></div>',
                        '<div class="modal"><div class="modal-dialog" /></div>'
                      ].join('')
                Severity: Major
                Found in js/src/modal/modal.spec.js and 1 other location - About 1 day to fix
                js/src/modal/modal.spec.js on lines 84..113

                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 307.

                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

                Severity
                Category
                Status
                Source
                Language