hakimel/reveal.js

View on GitHub

Showing 210 of 210 total issues

Function load has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
Open

    load( slide, options = {} ) {

        // Show the slide element
        slide.style.display = this.Reveal.getConfig().display;

Severity: Minor
Found in js/controllers/slidecontent.js - About 5 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 zoom has 132 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var zoom = (function(){

    // The current zoom level (scale)
    var level = 1;

Severity: Major
Found in plugin/zoom/plugin.js - About 5 hrs to fix

    Function activate has 121 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        async activate() {
    
            const config = this.Reveal.getConfig();
            const slides = queryAll( this.Reveal.getRevealElement(), SLIDES_SELECTOR )
    
    
    Severity: Major
    Found in js/controllers/printview.js - About 4 hrs to fix

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

                      if( event.shiftKey ) {
                          this.Reveal.slide( this.Reveal.getHorizontalSlides().length - 1 );
                      }
                      else if( !this.Reveal.overview.isActive() && useLinearMode ) {
                          if( config.rtl ) {
      Severity: Major
      Found in js/controllers/keyboard.js and 1 other location - About 4 hrs to fix
      js/controllers/keyboard.js on lines 270..283

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

      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( 0 );
                      }
                      else if( !this.Reveal.overview.isActive() && useLinearMode ) {
                          if( config.rtl ) {
      Severity: Major
      Found in js/controllers/keyboard.js and 1 other location - About 4 hrs to fix
      js/controllers/keyboard.js on lines 287..300

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

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

          syncPages() {
      
              const config = this.Reveal.getConfig();
      
              const slideSize = this.Reveal.getComputedSlideSize( window.innerWidth, window.innerHeight );
      Severity: Minor
      Found in js/controllers/scrollview.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 slide has 102 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function slide( h, v, f, origin ) {
      
              // Dispatch an event before the slide
              const slidechange = dispatchEvent({
                  type: 'beforeslidechange',
      Severity: Major
      Found in js/reveal.js - About 4 hrs to fix

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

                    if( this.Reveal.isVerticalSlide( currentSlide ) ) {
                        if( fragmentsRoutes.prev ) this.controlsUp.forEach( el => { el.classList.add( 'fragmented', 'enabled' ); el.removeAttribute( 'disabled' ); } );
                        if( fragmentsRoutes.next ) this.controlsDown.forEach( el => { el.classList.add( 'fragmented', 'enabled' ); el.removeAttribute( 'disabled' ); } );
                    }
        Severity: Major
        Found in js/controllers/controls.js and 1 other location - About 4 hrs to fix
        js/controllers/controls.js on lines 155..158

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

        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( fragmentsRoutes.prev ) this.controlsLeft.forEach( el => { el.classList.add( 'fragmented', 'enabled' ); el.removeAttribute( 'disabled' ); } );
                        if( fragmentsRoutes.next ) this.controlsRight.forEach( el => { el.classList.add( 'fragmented', 'enabled' ); el.removeAttribute( 'disabled' ); } );
                    }
        Severity: Major
        Found in js/controllers/controls.js and 1 other location - About 4 hrs to fix
        js/controllers/controls.js on lines 151..154

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

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

        import { queryAll, extend, createStyleSheet, matches, closest } from '../utils/util.js'
        import { FRAGMENT_STYLE_REGEX } from '../utils/constants.js'
        
        // Counter used to generate unique IDs for auto-animated elements
        let autoAnimateCounter = 0;
        Severity: Minor
        Found in js/controllers/autoanimate.js - About 3 hrs to fix

          ScrollView has 31 functions (exceeds 20 allowed). Consider refactoring.
          Open

          export default class ScrollView {
          
              constructor( Reveal ) {
          
                  this.Reveal = Reveal;
          Severity: Minor
          Found in js/controllers/scrollview.js - About 3 hrs to fix

            Function load has 92 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                load( slide, options = {} ) {
            
                    // Show the slide element
                    slide.style.display = this.Reveal.getConfig().display;
            
            
            Severity: Major
            Found in js/controllers/slidecontent.js - About 3 hrs to fix

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

                  activate() {
              
                      if( this.active ) return;
              
                      const stateBeforeActivation = this.Reveal.getState();
              Severity: Major
              Found in js/controllers/scrollview.js - About 3 hrs to fix

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

                    syncPages() {
                
                        const config = this.Reveal.getConfig();
                
                        const slideSize = this.Reveal.getComputedSlideSize( window.innerWidth, window.innerHeight );
                Severity: Major
                Found in js/controllers/scrollview.js - About 3 hrs to fix

                  Function update has 76 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      update( index, fragments, slide = this.Reveal.getCurrentSlide() ) {
                  
                          let changedFragments = {
                              shown: [],
                              hidden: []
                  Severity: Major
                  Found in js/controllers/fragments.js - About 3 hrs to fix

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

                        update( includeAll = false ) {
                    
                            let config = this.Reveal.getConfig();
                            let currentSlide = this.Reveal.getCurrentSlide();
                            let indices = this.Reveal.getIndices();
                    Severity: Major
                    Found in js/controllers/backgrounds.js - About 3 hrs to fix

                      Function Hilitor has 74 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          function Hilitor(id, tag) {
                      
                              var targetNode = document.getElementById(id) || document.body;
                              var hiliteTag = tag || "EM";
                              var skipTags = new RegExp("^(?:" + hiliteTag + "|SCRIPT|FORM)$");
                      Severity: Major
                      Found in plugin/search/plugin.js - About 2 hrs to fix

                        Function autoAnimateElements has 73 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            autoAnimateElements( from, to, elementOptions, animationOptions, id ) {
                        
                                // 'from' elements are given a data-auto-animate-target with no value,
                                // 'to' elements are are given a data-auto-animate-target with an ID
                                from.dataset.autoAnimateTarget = '';
                        Severity: Major
                        Found in js/controllers/autoanimate.js - About 2 hrs to fix

                          Function layout has 73 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              function layout() {
                          
                                  if( dom.wrapper && !printView.isActive() ) {
                          
                                      const viewportWidth = dom.viewport.offsetWidth;
                          Severity: Major
                          Found in js/reveal.js - About 2 hrs to fix

                            Function getIndicesFromHash has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                            Open

                                getIndicesFromHash( hash=window.location.hash, options={} ) {
                            
                                    // Attempt to parse the hash as either an index or name
                                    let name = hash.replace( /^#\/?/, '' );
                                    let bits = name.split( '/' );
                            Severity: Minor
                            Found in js/controllers/location.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

                            Severity
                            Category
                            Status
                            Source
                            Language