hakimel/reveal.js

View on GitHub

Showing 142 of 210 total issues

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

    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

                        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

                            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

                              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

                                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

                                  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

                                    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

                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language