hakimel/reveal.js

View on GitHub

Showing 210 of 210 total issues

Function updateSlides has 72 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function updateSlides( selector, index ) {

        // Select all slides and convert the NodeList result to
        // an array
        let slides = Util.queryAll( dom.wrapper, selector ),
Severity: Major
Found in js/reveal.js - About 2 hrs to fix

    File plugin.js has 284 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /*!
     * The reveal.js markdown plugin. Handles parsing of
     * markdown inside of presentations as well as loading
     * of external markdown documents.
     */
    Severity: Minor
    Found in plugin/markdown/plugin.js - About 2 hrs to fix

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

                      else if( deltaX < -SWIPE_THRESHOLD && Math.abs( deltaX ) > Math.abs( deltaY ) ) {
                          this.touchCaptured = true;
                          if( config.navigationMode === 'linear' ) {
                              if( config.rtl ) {
                                  this.Reveal.prev();
      Severity: Major
      Found in js/controllers/touch.js and 1 other location - About 2 hrs to fix
      js/controllers/touch.js on lines 142..187

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

      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

                      if( deltaX > SWIPE_THRESHOLD && Math.abs( deltaX ) > Math.abs( deltaY ) ) {
                          this.touchCaptured = true;
                          if( config.navigationMode === 'linear' ) {
                              if( config.rtl ) {
                                  this.Reveal.next();
      Severity: Major
      Found in js/controllers/touch.js and 1 other location - About 2 hrs to fix
      js/controllers/touch.js on lines 156..187

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

      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 onTouchMove has 69 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          onTouchMove( event ) {
      
              if( this.isSwipePrevented( event.target ) ) return true;
      
              let config = this.Reveal.getConfig();
      Severity: Major
      Found in js/controllers/touch.js - About 2 hrs to fix

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

            function disablePreviewLinks( selector = 'a' ) {
        
                Array.from( dom.wrapper.querySelectorAll( selector ) ).forEach( element => {
                    if( /^(http|www)/gi.test( element.getAttribute( 'href' ) ) ) {
                        element.removeEventListener( 'click', onPreviewLinkClicked, false );
        Severity: Major
        Found in js/reveal.js and 1 other location - About 2 hrs to fix
        js/reveal.js on lines 782..790

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

        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

            function enablePreviewLinks( selector = 'a' ) {
        
                Array.from( dom.wrapper.querySelectorAll( selector ) ).forEach( element => {
                    if( /^(http|www)/gi.test( element.getAttribute( 'href' ) ) ) {
                        element.addEventListener( 'click', onPreviewLinkClicked, false );
        Severity: Major
        Found in js/reveal.js and 1 other location - About 2 hrs to fix
        js/reveal.js on lines 795..803

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

        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

            onPointerMove( event ) {
        
                if( event.pointerType === event.MSPOINTER_TYPE_TOUCH || event.pointerType === "touch" )  {
                    event.touches = [{ clientX: event.clientX, clientY: event.clientY }];
                    this.onTouchMove( event );
        Severity: Major
        Found in js/controllers/touch.js and 1 other location - About 2 hrs to fix
        js/controllers/touch.js on lines 228..235

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

        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 KaTeX has 65 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

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

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

              onPointerDown( event ) {
          
                  if( event.pointerType === event.MSPOINTER_TYPE_TOUCH || event.pointerType === "touch" ) {
                      event.touches = [{ clientX: event.clientX, clientY: event.clientY }];
                      this.onTouchStart( event );
          Severity: Major
          Found in js/controllers/touch.js and 1 other location - About 2 hrs to fix
          js/controllers/touch.js on lines 242..249

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

          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 slidecontent.js has 273 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import { extend, queryAll, closest, getMimeTypeFromFile, encodeRFC3986URI } from '../utils/util.js'
          import { isMobile } from '../utils/device.js'
          
          import fitty from 'fitty';
          
          
          Severity: Minor
          Found in js/controllers/slidecontent.js - About 2 hrs to fix

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

                onNavigateLeftClicked( event ) {
            
                    event.preventDefault();
                    this.Reveal.onUserInput();
            
            
            Severity: Major
            Found in js/controllers/controls.js and 1 other location - About 2 hrs to fix
            js/controllers/controls.js on lines 220..232

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

            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

                onNavigateRightClicked( event ) {
            
                    event.preventDefault();
                    this.Reveal.onUserInput();
            
            
            Severity: Major
            Found in js/controllers/controls.js and 1 other location - About 2 hrs to fix
            js/controllers/controls.js on lines 206..218

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

            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 sync has 63 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                sync( slide ) {
            
                    const element = slide.slideBackgroundElement,
                        contentElement = slide.slideBackgroundContentElement;
            
            
            Severity: Major
            Found in js/controllers/backgrounds.js - About 2 hrs to fix

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

                              if( this.Reveal.getConfig().rtl ) {
              
                                  if( !this.Reveal.hasNavigatedHorizontally() && routes.left && indices.v === 0 ) {
                                      this.controlsLeftArrow.classList.add( 'highlight' );
                                  }
              Severity: Major
              Found in js/controllers/controls.js and 1 other location - About 2 hrs to fix
              js/controllers/controls.js on lines 183..191

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

              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

                              } else {
              
                                  if( !this.Reveal.hasNavigatedHorizontally() && routes.right && indices.v === 0 ) {
                                      this.controlsRightArrow.classList.add( 'highlight' );
                                  }
              Severity: Major
              Found in js/controllers/controls.js and 1 other location - About 2 hrs to fix
              js/controllers/controls.js on lines 174..183

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

              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 activate has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
              Open

                  activate() {
              
                      if( this.active ) return;
              
                      const stateBeforeActivation = this.Reveal.getState();
              Severity: Minor
              Found in js/controllers/scrollview.js - About 2 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 update has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
              Open

                  update( includeAll = false ) {
              
                      let config = this.Reveal.getConfig();
                      let currentSlide = this.Reveal.getCurrentSlide();
                      let indices = this.Reveal.getIndices();
              Severity: Minor
              Found in js/controllers/backgrounds.js - About 2 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

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

                                  if( typeof action === 'function' ) {
                                      action.apply( null, [ event ] );
                                  }
                                  // String shortcuts to reveal.js API
                                  else if( typeof action === 'string' && typeof this.Reveal[ action ] === 'function' ) {
              Severity: Major
              Found in js/controllers/keyboard.js and 1 other location - About 2 hrs to fix
              js/controllers/keyboard.js on lines 214..220

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

              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

                              if( event.shiftKey ) {
                                  this.Reveal.slide( undefined, Number.MAX_VALUE );
                              }
                              else if( !this.Reveal.overview.isActive() && useLinearMode ) {
                                  this.Reveal.next({skipFragments: event.altKey});
              Severity: Major
              Found in js/controllers/keyboard.js and 1 other location - About 2 hrs to fix
              js/controllers/keyboard.js on lines 304..312

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

              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