VaTz88/FFCSonTheGo

View on GitHub

Showing 14 of 44 total issues

File timetable.js has 640 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*
 *  This file contains the events and functions applied to
 *  the timetable
 */

Severity: Major
Found in src/js/timetable.js - About 1 day to fix

    Function initializeTimetable has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
    Open

    window.initializeTimetable = () => {
        var timetable;
        $('#timetable tr').slice(2).hide();
        $('#timetable tr td:not(:first-child)').remove();
    
    
    Severity: Minor
    Found in src/js/timetable.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 initializeTimetable has 100 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    window.initializeTimetable = () => {
        var timetable;
        $('#timetable tr').slice(2).hide();
        $('#timetable tr td:not(:first-child)').remove();
    
    
    Severity: Major
    Found in src/js/timetable.js - About 4 hrs to fix

      Function checkSlotClash has 87 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function checkSlotClash() {
          $('#timetable tr td').removeClass('clash');
          $('#course-list tr').removeClass('table-danger');
      
          const $theoryHours = $('#theory td:not(.lunch)');
      Severity: Major
      Found in src/js/timetable.js - About 3 hrs to fix

        Function addCourseToCourseList has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

        window.addCourseToCourseList = (courseData) => {
            var $courseListItem = $(
                `<tr
                    data-course="course${courseData.courseId}"
                    data-is-project="${courseData.isProject}"
        Severity: Minor
        Found in src/js/course-list.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 initializeQuickVisualization has 55 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function initializeQuickVisualization() {
            /*
                Click event for the quick visualization buttons
             */
            $('.quick-buttons *[class*="-tile"]').on('click', function () {
        Severity: Major
        Found in src/js/timetable.js - About 2 hrs to fix

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

          export function removeTouchHoverCSSRule() {
              if ('createTouch' in document) {
                  try {
                      var ignore = /:hover/;
          
          
          Severity: Minor
          Found in src/js/utils.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 addCourseToCourseList has 43 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          window.addCourseToCourseList = (courseData) => {
              var $courseListItem = $(
                  `<tr
                      data-course="course${courseData.courseId}"
                      data-is-project="${courseData.isProject}"
          Severity: Minor
          Found in src/js/course-list.js - About 1 hr to fix

            Function addSlotButtons has 41 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            window.addSlotButtons = (courseCode) => {
                $('#slot-buttons').html('');
                resetFilters();
            
                var theorySlotGroup = [];
            Severity: Minor
            Found in src/js/course-panel.js - About 1 hr to fix

              Function addTableToPicker has 40 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function addTableToPicker(tableId, tableName) {
                  $('#tt-picker-dropdown').append(
                      `<li>
                          <table class="dropdown-item">
                              <td class="tt-picker-label">
              Severity: Minor
              Found in src/js/timetable.js - About 1 hr to fix

                Function removeCourseFromTimetable has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                window.removeCourseFromTimetable = (course) => {
                    $(`#timetable tr td div[data-course="${course}"]`)
                        .parent()
                        .each(function () {
                            if ($(this).children().length != 1) {
                Severity: Minor
                Found in src/js/timetable.js - About 1 hr 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 appendHeader has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function appendHeader($layout, width) {
                    const $header = $('<div></div>')
                        .css({
                            width: width,
                            'margin-bottom': '1rem',
                Severity: Minor
                Found in src/js/timetable.js - About 1 hr to fix

                  Function removeCourseFromTimetable has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  window.removeCourseFromTimetable = (course) => {
                      $(`#timetable tr td div[data-course="${course}"]`)
                          .parent()
                          .each(function () {
                              if ($(this).children().length != 1) {
                  Severity: Minor
                  Found in src/js/timetable.js - About 1 hr to fix

                    Avoid deeply nested control flow statements.
                    Open

                                        while (index >= $quickButtons.find('tr').length) {
                                            $quickButtons.find('table').append('<tr></tr>');
                                        }
                    Severity: Major
                    Found in src/js/timetable.js - About 45 mins to fix
                      Severity
                      Category
                      Status
                      Source
                      Language