illinois-cs241/illinois-cs241.github.io

View on GitHub

Showing 33 of 33 total issues

Function RevealMenu has a Cognitive Complexity of 505 (exceeds 5 allowed). Consider refactoring.
Open

var RevealMenu = window.RevealMenu || (function(){
    var config = Reveal.getConfig();
    var options = config.menu || {};
    options.path = options.path || scriptPath() || 'plugin/menu/';
    if (!options.path.endsWith('/')) {
Severity: Minor
Found in js/reveal.js/menu/menu.js - About 1 wk 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 RevealMenu has 769 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var RevealMenu = window.RevealMenu || (function(){
    var config = Reveal.getConfig();
    var options = config.menu || {};
    options.path = options.path || scriptPath() || 'plugin/menu/';
    if (!options.path.endsWith('/')) {
Severity: Major
Found in js/reveal.js/menu/menu.js - About 3 days to fix

    Function loadPlugin has 668 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function loadPlugin() {
            // does not support IE8 or below
            var initialise = !ieVersion || ieVersion >= 9;
    
            // do not load the menu in the upcoming slide panel in the speaker notes
    Severity: Major
    Found in js/reveal.js/menu/menu.js - About 3 days to fix

      File menu.js has 771 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /*
       * Reveal.js menu plugin
       * MIT licensed
       * (c) Greg Denehy 2015
       */
      Severity: Major
      Found in js/reveal.js/menu/menu.js - About 1 day to fix

        Function init has 286 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                    function init() {
                        if (!initialised) {
                            var parent = select('.reveal').parentElement;
                            var top = create('div', { 'class': 'slide-menu-wrapper'});
                            parent.appendChild(top);
        Severity: Major
        Found in js/reveal.js/menu/menu.js - About 1 day to fix

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

                                  case 75: case 38:
                                      var currItem = select('.active-menu-panel .slide-menu-items li.selected') || select('.active-menu-panel .slide-menu-items li.active');
                                      if (currItem) {
                                          selectAll('.active-menu-panel .slide-menu-items li').forEach(function(item) { item.classList.remove('selected') });
                                          var nextItem = select('.active-menu-panel .slide-menu-items li[data-item="' + (parseInt(currItem.getAttribute('data-item')) - 1) + '"]') || currItem;
          Severity: Major
          Found in js/reveal.js/menu/menu.js and 1 other location - About 5 hrs to fix
          js/reveal.js/menu/menu.js on lines 189..199

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

          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

                                  case 74: case 40:
                                      var currItem = select('.active-menu-panel .slide-menu-items li.selected') || select('.active-menu-panel .slide-menu-items li.active');
                                      if (currItem) {
                                          selectAll('.active-menu-panel .slide-menu-items li').forEach(function(item) { item.classList.remove('selected') });
                                          var nextItem = select('.active-menu-panel .slide-menu-items li[data-item="' + (parseInt(currItem.getAttribute('data-item')) + 1) + '"]') || currItem;
          Severity: Major
          Found in js/reveal.js/menu/menu.js and 1 other location - About 5 hrs to fix
          js/reveal.js/menu/menu.js on lines 177..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 141.

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

                      function onDocumentKeyDown(event) {
                          // opening menu is handled by registering key binding with Reveal below
                          if (isOpen()) {
                              event.stopImmediatePropagation();
                              switch( event.keyCode ) {
          Severity: Major
          Found in js/reveal.js/menu/menu.js - About 3 hrs to fix

            Function generateItem has 66 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                                function generateItem(type, section, i, h, v) {
                                    var link = '/#/' + h;
                                    if (typeof v === 'number' && !isNaN( v )) link += '/' + v;
            
                                    function text(selector, parent) {
            Severity: Major
            Found in js/reveal.js/menu/menu.js - About 2 hrs to fix

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

                                      case 35:
                                          selectAll('.active-menu-panel .slide-menu-items li').forEach(function(item) { item.classList.remove('selected') });
                                          var item = select('.active-menu-panel .slide-menu-items:last-of-type li:last-of-type');
                                          if (item) {
                                              item.classList.add('selected');
              Severity: Major
              Found in js/reveal.js/menu/menu.js and 1 other location - About 2 hrs to fix
              js/reveal.js/menu/menu.js on lines 251..258

              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

                                      case 36:
                                          selectAll('.active-menu-panel .slide-menu-items li').forEach(function(item) { item.classList.remove('selected') });
                                          var item = select('.active-menu-panel .slide-menu-items li:first-of-type');
                                          if (item) {
                                              item.classList.add('selected');
              Severity: Major
              Found in js/reveal.js/menu/menu.js and 1 other location - About 2 hrs to fix
              js/reveal.js/menu/menu.js on lines 260..267

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

              var speechUtteranceChunker = function (utt, settings, callback) {
                  settings = settings || {};
                  var newUtt;
                  var txt = (settings && settings.offset !== undefined ? utt.text.substring(settings.offset) : utt.text);
                  if (utt.voice && utt.voice.voiceURI === 'native') { // Not part of the spec
              Severity: Minor
              Found in js/speech.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

              Method auto_section has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
              Open

                def auto_section(wrap = "<div class='card'>", stops = %w[hr], levels = %w[h1 h2 h4 h5 h6])
                  levels = Hash[levels.zip(0...levels.length)]
                  stops &&= Hash[stops.product([true])]
                  stack = []
                  children.each do |node|
              Severity: Minor
              Found in _plugins/content_style.rb - 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

              Method check_spelling has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
              Open

              def check_spelling(md_file, dicts)
                man_set = load_man_pages
                markdown = Redcarpet::Markdown.new(Redcarpet::Render::BareMinimum)
                f = File.open(md_file)
                content = f.read
              Severity: Minor
              Found in _scripts/spell_check.rb - 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 speechUtteranceChunker has 49 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              var speechUtteranceChunker = function (utt, settings, callback) {
                  settings = settings || {};
                  var newUtt;
                  var txt = (settings && settings.offset !== undefined ? utt.text.substring(settings.offset) : utt.text);
                  if (utt.voice && utt.voice.voiceURI === 'native') { // Not part of the spec
              Severity: Minor
              Found in js/speech.js - About 1 hr to fix

                Consider simplifying this complex logical expression.
                Open

                        if (initialise) {
                            //
                            // Set option defaults
                            //
                            var side = options.side || 'left';    // 'left' or 'right'
                Severity: Critical
                Found in js/reveal.js/menu/menu.js - About 1 hr to fix

                  Function speak has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  const speak = function(){
                      if(!('speechSynthesis' in window)){
                          return;
                      }
                      if(speaking == true){
                  Severity: Minor
                  Found in js/speech.js - About 1 hr to fix

                    Method check_spelling has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    def check_spelling(md_file, dicts)
                      man_set = load_man_pages
                      markdown = Redcarpet::Markdown.new(Redcarpet::Render::BareMinimum)
                      f = File.open(md_file)
                      content = f.read
                    Severity: Minor
                    Found in _scripts/spell_check.rb - About 1 hr to fix

                      Function createSlideMenu has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                                          function createSlideMenu() {
                                              if ( !document.querySelector('section[data-markdown]:not([data-markdown-parsed])') ) {
                                                  var panel = create('div', {
                                                      'data-panel': 'Slides',
                                                      'class': 'slide-menu-panel active-menu-panel'
                      Severity: Minor
                      Found in js/reveal.js/menu/menu.js - About 1 hr to fix

                        Function openItem has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                    function openItem(item, force) {
                                        var h = parseInt(item.getAttribute('data-slide-h'));
                                        var v = parseInt(item.getAttribute('data-slide-v'));
                                        var theme = item.getAttribute('data-theme');
                                        var transition = item.getAttribute('data-transition');
                        Severity: Minor
                        Found in js/reveal.js/menu/menu.js - About 1 hr to fix
                          Severity
                          Category
                          Status
                          Source
                          Language