zurb/foundation

View on GitHub

Showing 137 of 233 total issues

File foundation.abide.js has 492 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import $ from 'jquery';
import { Plugin } from './foundation.core.plugin';
import { GetYoDigits } from './foundation.core.utils';

/**
Severity: Minor
Found in js/foundation.abide.js - About 7 hrs to fix

    Function _events has 155 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      _events() {
        var _this = this,
            hasTouch = 'ontouchstart' in window || (typeof window.ontouchstart !== 'undefined'),
            parClass = 'is-dropdown-submenu-parent';
    
    
    Severity: Major
    Found in js/foundation.dropdownMenu.js - About 6 hrs to fix

      File foundation.slider.js has 386 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import $ from 'jquery';
      import { Keyboard } from './foundation.util.keyboard';
      import { Move } from './foundation.util.motion';
      import { GetYoDigits, rtl as Rtl } from './foundation.core.utils';
      
      
      Severity: Minor
      Found in js/foundation.slider.js - About 5 hrs to fix

        Function changeSlide has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
        Open

          changeSlide(isLTR, chosenSlide, idx) {
            if (!this.$slides) {return; } // Don't freak out if we're in the middle of cleanup
            var $curSlide = this.$slides.filter('.is-active').eq(0);
        
            if (/mui/g.test($curSlide[0].className)) { return false; } //if the slide is currently animating, kick out of the function
        Severity: Minor
        Found in js/foundation.orbit.js - About 4 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

        File foundation.offcanvas.js has 364 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import $ from 'jquery';
        import { Plugin } from './foundation.core.plugin';
        import { onLoad, transitionend, RegExpEscape } from './foundation.core.utils';
        import { Keyboard } from './foundation.util.keyboard';
        import { MediaQuery } from './foundation.util.mediaQuery';
        Severity: Minor
        Found in js/foundation.offcanvas.js - About 4 hrs to fix

          File foundation.drilldown.js has 357 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import $ from 'jquery';
          import { Keyboard } from './foundation.util.keyboard';
          import { Nest } from './foundation.util.nest';
          import { GetYoDigits, transitionend } from './foundation.core.utils';
          import { Box } from './foundation.util.box';
          Severity: Minor
          Found in js/foundation.drilldown.js - About 4 hrs to fix

            File foundation.reveal.js has 353 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import $ from 'jquery';
            import { Plugin } from './foundation.core.plugin';
            import { onLoad } from './foundation.core.utils';
            import { Keyboard } from './foundation.util.keyboard';
            import { MediaQuery } from './foundation.util.mediaQuery';
            Severity: Minor
            Found in js/foundation.reveal.js - About 4 hrs to fix

              Function _updateActive has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
              Open

                _updateActive(/*evt, elem, scrollPos*/) {
                  if(this._inTransition) return;
              
                  const newScrollPos = parseInt(window.pageYOffset, 10);
                  const isScrollingUp = this.scrollPos > newScrollPos;
              Severity: Minor
              Found in js/foundation.magellan.js - About 4 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 _setHandlePos has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
              Open

                _setHandlePos($hndl, location, cb) {
                  // don't move if the slider has been disabled since its initialization
                  if (this.$element.hasClass(this.options.disabledClass)) {
                    return;
                  }
              Severity: Minor
              Found in js/foundation.slider.js - About 4 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 _init has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
              Open

                _init() {
                  var _this = this;
                  this._isInitializing = true;
              
                  this.$element.attr({'role': 'tablist'});
              Severity: Minor
              Found in js/foundation.tabs.js - About 3 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 _init has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
              Open

                _init() {
                  this._isInitializing = true;
              
                  this.$tabs = this.$element.children('[data-accordion-item]');
              
              
              Severity: Minor
              Found in js/foundation.accordion.js - About 3 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 close has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
              Open

                close() {
                  if (!this.isActive || !this.$element.is(':visible')) {
                    return false;
                  }
                  var _this = this;
              Severity: Minor
              Found in js/foundation.reveal.js - About 3 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 _handleEvent has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
              Open

                _handleEvent(e, $handle, val) {
                  var value;
                  if (!val) {//click or drag events
                    e.preventDefault();
                    var _this = this,
              Severity: Minor
              Found in js/foundation.slider.js - About 3 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 open has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
              Open

                open() {
                  // either update or replace browser history
                  const hash = `#${this.id}`;
                  if (this.options.deepLink && window.location.hash !== hash) {
              
              
              Severity: Minor
              Found in js/foundation.reveal.js - About 3 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 _init has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
              Open

                _init() {
                  var id = this.$element.attr('id');
              
                  this.$element.attr('aria-hidden', 'true');
              
              
              Severity: Minor
              Found in js/foundation.offcanvas.js - About 3 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 _events has 81 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                _events() {
                  var _this = this;
              
                  this.$element.find('li').each(function() {
                    var $submenu = $(this).children('[data-submenu]');
              Severity: Major
              Found in js/foundation.accordionMenu.js - About 3 hrs to fix

                File foundation.dropdownMenu.js has 301 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import $ from 'jquery';
                import { Plugin } from './foundation.core.plugin';
                import { rtl as Rtl, ignoreMousedisappear } from './foundation.core.utils';
                import { Keyboard } from './foundation.util.keyboard';
                import { Nest } from './foundation.util.nest';
                Severity: Minor
                Found in js/foundation.dropdownMenu.js - About 3 hrs to fix

                  Abide has 27 functions (exceeds 20 allowed). Consider refactoring.
                  Open

                  class Abide extends Plugin {
                    /**
                     * Creates a new instance of Abide.
                     * @class
                     * @name Abide
                  Severity: Minor
                  Found in js/foundation.abide.js - About 3 hrs to fix

                    Function _eventsForHandle has 77 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      _eventsForHandle($handle) {
                        var _this = this,
                            curHandle;
                    
                          const handleChangeEvent = function(e) {
                    Severity: Major
                    Found in js/foundation.slider.js - About 3 hrs to fix

                      Function open has 77 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        open() {
                          // either update or replace browser history
                          const hash = `#${this.id}`;
                          if (this.options.deepLink && window.location.hash !== hash) {
                      
                      
                      Severity: Major
                      Found in js/foundation.reveal.js - About 3 hrs to fix
                        Severity
                        Category
                        Status
                        Source
                        Language