hakimel/reveal.js

View on GitHub

Showing 210 of 210 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
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 and 1 other location - About 2 hrs to fix
js/controllers/keyboard.js on lines 316..324

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( typeof value === 'function' ) {
                        value.apply( null, [ event ] );
                    }
                    // String shortcuts to reveal.js API
                    else if( typeof value === 'string' && typeof this.Reveal[ value ] === 'function' ) {
Severity: Major
Found in js/controllers/keyboard.js and 1 other location - About 2 hrs to fix
js/controllers/keyboard.js on lines 241..247

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

File backgrounds.js has 264 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { queryAll } from '../utils/util.js'
import { colorToRgb, colorBrightness } from '../utils/color.js'

/**
 * Creates and updates slide backgrounds.
Severity: Minor
Found in js/controllers/backgrounds.js - About 2 hrs to fix

    Function update has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        update( index, fragments, slide = this.Reveal.getCurrentSlide() ) {
    
            let changedFragments = {
                shown: [],
                hidden: []
    Severity: Minor
    Found in js/controllers/fragments.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 sync has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        sync( slide ) {
    
            const element = slide.slideBackgroundElement,
                contentElement = slide.slideBackgroundContentElement;
    
    
    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

                queryAll( element, 'iframe[src*="player.vimeo.com/"]' ).forEach( el => {
                    if( !el.hasAttribute( 'data-ignore' ) && el.contentWindow && typeof el.contentWindow.postMessage === 'function' ) {
                        el.contentWindow.postMessage( '{"method":"pause"}', '*' );
                    }
                });
    Severity: Major
    Found in js/controllers/slidecontent.js and 1 other location - About 2 hrs to fix
    js/controllers/slidecontent.js on lines 463..467

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

    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

                queryAll( element, 'iframe[src*="youtube.com/embed/"]' ).forEach( el => {
                    if( !el.hasAttribute( 'data-ignore' ) && el.contentWindow && typeof el.contentWindow.postMessage === 'function' ) {
                        el.contentWindow.postMessage( '{"event":"command","func":"pauseVideo","args":""}', '*' );
                    }
                });
    Severity: Major
    Found in js/controllers/slidecontent.js and 1 other location - About 2 hrs to fix
    js/controllers/slidecontent.js on lines 470..474

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

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

        function configure( options ) {
    
            const oldConfig = { ...config }
    
            // New config options may be passed when this method
    Severity: Major
    Found in js/reveal.js - About 2 hrs to fix

      Function pages has 54 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              this.pages = pageElements.map( pageElement => {
                  const page = this.createPage({
                      pageElement,
                      slideElement: pageElement.querySelector( 'section' ),
                      stickyElement: pageElement.querySelector( '.scroll-page-sticky' ),
      Severity: Major
      Found in js/controllers/scrollview.js - About 2 hrs to fix

        File gulpfile.js has 256 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        const pkg = require('./package.json')
        const glob = require('glob')
        const yargs = require('yargs')
        const through = require('through2');
        const qunit = require('node-qunit-puppeteer')
        Severity: Minor
        Found in gulpfile.js - About 2 hrs to fix

          Function updateSlidesVisibility has 53 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function updateSlidesVisibility() {
          
                  // Select all slides and convert the NodeList result to
                  // an array
                  let horizontalSlides = getHorizontalSlides(),
          Severity: Major
          Found in js/reveal.js - About 2 hrs to fix

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

                focus() {
            
                    if( this.state !== STATE_FOCUS ) {
                        this.Reveal.getRevealElement().classList.add( 'focused' );
                        document.addEventListener( 'pointerdown', this.onDocumentPointerDown, false );
            Severity: Major
            Found in js/controllers/focus.js and 1 other location - About 2 hrs to fix
            js/controllers/focus.js on lines 65..74

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

            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

                blur() {
            
                    if( this.state !== STATE_BLUR ) {
                        this.Reveal.getRevealElement().classList.remove( 'focused' );
                        document.removeEventListener( 'pointerdown', this.onDocumentPointerDown, false );
            Severity: Major
            Found in js/controllers/focus.js and 1 other location - About 2 hrs to fix
            js/controllers/focus.js on lines 54..63

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

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

                getHash( slide ) {
            
                    let url = '/';
            
                    // Attempt to create a named link based on the slide's ID
            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

            Function goto has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
            Open

                goto( index, offset = 0 ) {
            
                    let currentSlide = this.Reveal.getCurrentSlide();
                    if( currentSlide && this.Reveal.getConfig().fragments ) {
            
            
            Severity: Minor
            Found in js/controllers/fragments.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 getSlideNumber has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
            Open

                getSlideNumber( slide = this.Reveal.getCurrentSlide() ) {
            
                    let config = this.Reveal.getConfig();
                    let value;
                    let format = SLIDE_NUMBER_FORMAT_HORIZONTAL_DOT_VERTICAL;
            Severity: Minor
            Found in js/controllers/slidenumber.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 startEmbeddedContent has 50 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                startEmbeddedContent( element ) {
            
                    if( element && !this.Reveal.isSpeakerNotes() ) {
            
                        // Restart GIFs
            Severity: Minor
            Found in js/controllers/slidecontent.js - About 2 hrs to fix

              Function MathJax3 has 50 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export const MathJax3 = () => {
              
                  // The reveal.js instance this plugin is attached to
                  let deck;
              
              
              Severity: Minor
              Found in plugin/math/mathjax3.js - About 2 hrs to fix

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

                    disable() {
                
                        queryAll( this.Reveal.getSlidesElement(), '.fragment' ).forEach( element => {
                            element.classList.add( 'visible' );
                            element.classList.remove( 'current-fragment' );
                Severity: Major
                Found in js/controllers/fragments.js and 1 other location - About 2 hrs to fix
                js/controllers/fragments.js on lines 47..54

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

                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

                    enable() {
                
                        queryAll( this.Reveal.getSlidesElement(), '.fragment' ).forEach( element => {
                            element.classList.remove( 'visible' );
                            element.classList.remove( 'current-fragment' );
                Severity: Major
                Found in js/controllers/fragments.js and 1 other location - About 2 hrs to fix
                js/controllers/fragments.js on lines 34..41

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

                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