ggarnier/reveal.rb

View on GitHub

Showing 101 of 101 total issues

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

/*!
 * reveal.js
 * http://revealjs.com
 * MIT licensed
 *
Severity: Major
Found in lib/reveal/templates/revealjs/js/reveal.js - About 1 wk to fix

    Function RevealSearch has a Cognitive Complexity of 85 (exceeds 5 allowed). Consider refactoring.
    Open

    var RevealSearch = (function() {
    
        var matchedSlides;
        var currentMatchedIndex;
        var searchboxDirty;
    Severity: Minor
    Found in lib/reveal/templates/revealjs/plugin/search/search.js - About 1 day 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

            [ 'touchstart', 'click' ].forEach( function( eventName ) {
                dom.controlsLeft.forEach( function( el ) { el.removeEventListener( eventName, onNavigateLeftClicked, false ); } );
                dom.controlsRight.forEach( function( el ) { el.removeEventListener( eventName, onNavigateRightClicked, false ); } );
                dom.controlsUp.forEach( function( el ) { el.removeEventListener( eventName, onNavigateUpClicked, false ); } );
                dom.controlsDown.forEach( function( el ) { el.removeEventListener( eventName, onNavigateDownClicked, false ); } );
    Severity: Major
    Found in lib/reveal/templates/revealjs/js/reveal.js and 1 other location - About 1 day to fix
    lib/reveal/templates/revealjs/js/reveal.js on lines 1209..1216

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

    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

            pointerEvents.forEach( function( eventName ) {
                dom.controlsLeft.forEach( function( el ) { el.addEventListener( eventName, onNavigateLeftClicked, false ); } );
                dom.controlsRight.forEach( function( el ) { el.addEventListener( eventName, onNavigateRightClicked, false ); } );
                dom.controlsUp.forEach( function( el ) { el.addEventListener( eventName, onNavigateUpClicked, false ); } );
                dom.controlsDown.forEach( function( el ) { el.addEventListener( eventName, onNavigateDownClicked, false ); } );
    Severity: Major
    Found in lib/reveal/templates/revealjs/js/reveal.js and 1 other location - About 1 day to fix
    lib/reveal/templates/revealjs/js/reveal.js on lines 1253..1260

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

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

    var zoom = (function(){
    
        // The current zoom level (scale)
        var level = 1;
    
    
    Severity: Minor
    Found in lib/reveal/templates/revealjs/plugin/zoom-js/zoom.js - About 7 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 RevealSearch has 159 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    var RevealSearch = (function() {
    
        var matchedSlides;
        var currentMatchedIndex;
        var searchboxDirty;
    Severity: Major
    Found in lib/reveal/templates/revealjs/plugin/search/search.js - About 6 hrs to fix

      Function zoom has 152 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      var zoom = (function(){
      
          // The current zoom level (scale)
          var level = 1;
      
      
      Severity: Major
      Found in lib/reveal/templates/revealjs/plugin/zoom-js/zoom.js - About 6 hrs to fix

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

                        if( i < index ) {
                            // Any element previous to index is given the 'past' class
                            element.classList.add( reverse ? 'future' : 'past' );
        
                            if( config.fragments ) {
        Severity: Major
        Found in lib/reveal/templates/revealjs/js/reveal.js and 1 other location - About 4 hrs to fix
        lib/reveal/templates/revealjs/js/reveal.js on lines 2665..2679

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

        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( i > index ) {
                            // Any element subsequent to index is given the 'future' class
                            element.classList.add( reverse ? 'past' : 'future' );
        
                            if( config.fragments ) {
        Severity: Major
        Found in lib/reveal/templates/revealjs/js/reveal.js and 1 other location - About 4 hrs to fix
        lib/reveal/templates/revealjs/js/reveal.js on lines 2650..2679

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

        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( isVerticalSlide( currentSlide ) ) {
                        if( fragments.prev ) dom.controlsUp.forEach( function( el ) { el.classList.add( 'fragmented', 'enabled' ); el.removeAttribute( 'disabled' ); } );
                        if( fragments.next ) dom.controlsDown.forEach( function( el ) { el.classList.add( 'fragmented', 'enabled' ); el.removeAttribute( 'disabled' ); } );
                    }
        Severity: Major
        Found in lib/reveal/templates/revealjs/js/reveal.js and 1 other location - About 4 hrs to fix
        lib/reveal/templates/revealjs/js/reveal.js on lines 2963..2966

        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( fragments.prev ) dom.controlsLeft.forEach( function( el ) { el.classList.add( 'fragmented', 'enabled' ); el.removeAttribute( 'disabled' ); } );
                        if( fragments.next ) dom.controlsRight.forEach( function( el ) { el.classList.add( 'fragmented', 'enabled' ); el.removeAttribute( 'disabled' ); } );
                    }
        Severity: Major
        Found in lib/reveal/templates/revealjs/js/reveal.js and 1 other location - About 4 hrs to fix
        lib/reveal/templates/revealjs/js/reveal.js on lines 2959..2962

        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

                if( config.rtl ) {
                    if( ( isOverview() || previousFragment() === false ) && availableRoutes().right ) {
                        slide( indexh - 1 );
                    }
                }
        Severity: Major
        Found in lib/reveal/templates/revealjs/js/reveal.js and 1 other location - About 3 hrs to fix
        lib/reveal/templates/revealjs/js/reveal.js on lines 4238..4246

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

        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( config.rtl ) {
                    if( ( isOverview() || nextFragment() === false ) && availableRoutes().left ) {
                        slide( indexh + 1 );
                    }
                }
        Severity: Major
        Found in lib/reveal/templates/revealjs/js/reveal.js and 1 other location - About 3 hrs to fix
        lib/reveal/templates/revealjs/js/reveal.js on lines 4255..4263

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

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

        var RevealNotes = (function() {
        
            function openNotes( notesFilePath ) {
        
                if( !notesFilePath ) {
        Severity: Major
        Found in lib/reveal/templates/revealjs/plugin/notes/notes.js - About 3 hrs to fix

          Function configure has 84 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function configure( options ) {
          
                  var oldTransition = config.transition;
          
                  // New config options may be passed when this method
          Severity: Major
          Found in lib/reveal/templates/revealjs/js/reveal.js - About 3 hrs to fix

            Function slide has 79 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function slide( h, v, f, o ) {
            
                    // Remember where we were at before
                    previousSlide = currentSlide;
            
            
            Severity: Major
            Found in lib/reveal/templates/revealjs/js/reveal.js - About 3 hrs to fix

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

                  function setupPDF() {
              
                      var slideSize = getComputedSlideSize( window.innerWidth, window.innerHeight );
              
                      // Dimensions of the PDF pages
              Severity: Major
              Found in lib/reveal/templates/revealjs/js/reveal.js - About 3 hrs to fix

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

                var RevealNotes = (function() {
                
                    function openNotes( notesFilePath ) {
                
                        if( !notesFilePath ) {
                Severity: Minor
                Found in lib/reveal/templates/revealjs/plugin/notes/notes.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 Hilitor has 72 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function Hilitor(id, tag)
                {
                
                  var targetNode = document.getElementById(id) || document.body;
                  var hiliteTag = tag || "EM";
                Severity: Major
                Found in lib/reveal/templates/revealjs/plugin/search/search.js - About 2 hrs to fix

                  Function loadSlide has 70 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      function loadSlide( slide, options ) {
                  
                          options = options || {};
                  
                          // Show the slide element
                  Severity: Major
                  Found in lib/reveal/templates/revealjs/js/reveal.js - About 2 hrs to fix
                    Severity
                    Category
                    Status
                    Source
                    Language