hakimel/reveal.js

View on GitHub

Showing 142 of 210 total issues

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

    function sync() {

        // Subscribe to input
        removeEventListeners();
        addEventListeners();
Severity: Minor
Found in js/reveal.js - About 1 hr to fix

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

        function loadExternalMarkdown( section ) {
    
            return new Promise( function( resolve, reject ) {
    
                const xhr = new XMLHttpRequest(),
    Severity: Minor
    Found in plugin/markdown/plugin.js - About 1 hr to fix

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

          sort( fragments, grouped = false ) {
      
              fragments = Array.from( fragments );
      
              let ordered = [],
      Severity: Minor
      Found in js/controllers/fragments.js - About 1 hr to fix

        Consider simplifying this complex logical expression.
        Open

                    if( autoSlide && !autoSlidePaused && !isPaused() && !overview.isActive() && ( !isLastSlide() || fragments.availableRoutes().next || config.loop === true ) ) {
                        autoSlideTimeout = setTimeout( () => {
                            if( typeof config.autoSlideMethod === 'function' ) {
                                config.autoSlideMethod()
                            }
        Severity: Major
        Found in js/reveal.js - About 1 hr to fix

          Function scrollHighlightedLineIntoView has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              scrollHighlightedLineIntoView: function( block, scrollState, skipAnimation ) {
          
                  cancelAnimationFrame( scrollState.animationFrameID );
          
                  // Match the scroll position of the currently visible
          Severity: Minor
          Found in plugin/highlight/plugin.js - About 55 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Function init has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              init: function( reveal ) {
          
                  reveal.getRevealElement().addEventListener( 'mousedown', function( event ) {
                      var defaultModifier = /Linux/.test( window.navigator.platform ) ? 'ctrl' : 'alt';
          
          
          Severity: Minor
          Found in plugin/zoom/plugin.js - About 55 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Function writeURL has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              writeURL( delay ) {
          
                  let config = this.Reveal.getConfig();
                  let currentSlide = this.Reveal.getCurrentSlide();
          
          
          Severity: Minor
          Found in js/controllers/location.js - About 55 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Function onSlideClicked has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              onSlideClicked( event ) {
          
                  if( this.isActive() ) {
                      event.preventDefault();
          
          
          Severity: Minor
          Found in js/controllers/overview.js - About 55 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Function registerPlugin has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              registerPlugin( plugin ) {
          
                  // Backwards compatibility to make reveal.js ~3.9.0
                  // plugins work with reveal.js 4.0.0
                  if( arguments.length === 2 && typeof arguments[0] === 'string' ) {
          Severity: Minor
          Found in js/controllers/plugins.js - About 55 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Function KaTeX has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          export const KaTeX = () => {
              let deck;
          
              let defaultOptions = {
                  version: 'latest',
          Severity: Minor
          Found in plugin/math/katex.js - About 55 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Avoid deeply nested control flow statements.
          Open

                          else if( i === index && config.fragments ) {
                              if( loopedForwards ) {
                                  hideFragmentsIn( element );
                              }
                              else if( loopedBackwards ) {
          Severity: Major
          Found in js/reveal.js - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                if( config.navigationMode === 'linear' ) {
                                    if( config.rtl ) {
                                        this.Reveal.prev();
                                    }
                                    else {
            Severity: Major
            Found in js/controllers/touch.js - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                  if( isMobile ) {
                                      video.muted = true;
                                      video.setAttribute( 'playsinline', '' );
                                  }
              Severity: Major
              Found in js/controllers/slidecontent.js - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                        if( slide.classList.contains( 'stack' ) ) {
                                            slide.style.top = 0;
                                        }
                                        else {
                                            slide.style.top = Math.max( ( size.height - slide.scrollHeight ) / 2, 0 ) + 'px';
                Severity: Major
                Found in js/reveal.js - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                          if( type ) {
                                              sourceElement.setAttribute( 'type', type );
                                          }
                  Severity: Major
                  Found in js/controllers/slidecontent.js - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                    if( event.shiftKey ) {
                                        this.Reveal.slide( undefined, 0 );
                                    }
                                    else if( !this.Reveal.overview.isActive() && useLinearMode ) {
                                        this.Reveal.prev({skipFragments: event.altKey});
                    Severity: Major
                    Found in js/controllers/keyboard.js - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                          if( config.fragments ) {
                                              // Hide all fragments in future slides
                                              hideFragmentsIn( element );
                                          }
                      Severity: Major
                      Found in js/reveal.js - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                                if ( typeof aPreviousChildElement.setAttribute === 'function' && aPreviousChildElement.tagName !== "BR" ) {
                                                    previousParentElement = aPreviousChildElement;
                                                    break;
                                                }
                        Severity: Major
                        Found in plugin/markdown/plugin.js - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                      else if( keyCode === 74 || keyCode === 40 ) {
                                          if( event.shiftKey ) {
                                              this.Reveal.slide( undefined, Number.MAX_VALUE );
                                          }
                                          else if( !this.Reveal.overview.isActive() && useLinearMode ) {
                          Severity: Major
                          Found in js/controllers/keyboard.js - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                                    if( distanceX + distanceY < viewDistance ) {
                                                        slideContent.load( verticalSlide );
                                                    }
                                                    else {
                                                        slideContent.unload( verticalSlide );
                            Severity: Major
                            Found in js/reveal.js - About 45 mins to fix
                              Severity
                              Category
                              Status
                              Source
                              Language