VaTz88/FFCSonTheGo

View on GitHub

Showing 44 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

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

            html2canvas($layout[0], {
                scrollX: -window.scrollX,
                scrollY: -window.scrollY,
            }).then((canvas) => {
                $layout.remove();
    Severity: Major
    Found in src/js/timetable.js and 1 other location - About 7 hrs to fix
    src/js/timetable.js on lines 218..238

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

    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

            html2canvas($layout[0], {
                scrollX: -window.scrollX,
                scrollY: -window.scrollY,
            }).then((canvas) => {
                $layout.remove();
    Severity: Major
    Found in src/js/timetable.js and 1 other location - About 7 hrs to fix
    src/js/timetable.js on lines 146..166

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

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

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

                    } else if ($('div', this).data('is-theory')) {
                        nextStart = parse(
                            $theoryHours.eq(index + 1).data('start'),
                            'h:mm aa',
                            new Date(),
        Severity: Major
        Found in src/js/timetable.js and 1 other location - About 2 hrs to fix
        src/js/timetable.js on lines 509..537

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

        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 ($('div', $(this).next()).data('is-lab')) {
                        nextStart = parse(
                            $labHours.eq(index + 1).data('start'),
                            'h:mm aa',
                            new Date(),
        Severity: Major
        Found in src/js/timetable.js and 1 other location - About 2 hrs to fix
        src/js/timetable.js on lines 523..537

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

        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 (theorySlots && theorySlots.start && theorySlots.end) {
                    $theoryHour.html(
                        `${theorySlots.start}<br />to<br />${theorySlots.end}`,
                    );
                    $theoryHour.data('start', theorySlots.start);
        Severity: Major
        Found in src/js/timetable.js and 1 other location - About 2 hrs to fix
        src/js/timetable.js on lines 695..699

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

        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 (labSlots && labSlots.start && labSlots.end) {
                    $labHour.html(`${labSlots.start}<br />to<br />${labSlots.end}`);
                    $labHour.data('start', labSlots.start);
                    $labHour.data('end', labSlots.end);
                }
        Severity: Major
        Found in src/js/timetable.js and 1 other location - About 2 hrs to fix
        src/js/timetable.js on lines 687..693

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

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

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

            if (labSlotGroup.length) {
                var $labSlotGroup = $('<optgroup label="Lab"></optgroup>');
        
                labSlotGroup.forEach(function (el) {
                    var $option = $(`<option value="${el}">${el}</option>`);
        Severity: Major
        Found in src/js/course-panel.js and 1 other location - About 2 hrs to fix
        src/js/course-panel.js on lines 316..325

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

        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 (theorySlotGroup.length) {
                var $theorySlotGroup = $('<optgroup label="Theory"></optgroup>');
        
                theorySlotGroup.forEach(function (el) {
                    var $option = $(`<option value="${el}">${el}</option>`);
        Severity: Major
        Found in src/js/course-panel.js and 1 other location - About 2 hrs to fix
        src/js/course-panel.js on lines 330..339

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

        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 ($('div', this).data('is-lab')) {
                        currentEnd = parse(
                            $labHours.eq(index).data('end'),
                            'h:mm aa',
                            new Date(),
        Severity: Major
        Found in src/js/timetable.js and 1 other location - About 2 hrs to fix
        src/js/timetable.js on lines 493..507

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

        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 ($('div', this).data('is-theory')) {
                        currentEnd = parse(
                            $theoryHours.eq(index).data('end'),
                            'h:mm aa',
                            new Date(),
        Severity: Major
        Found in src/js/timetable.js and 1 other location - About 2 hrs to fix
        src/js/timetable.js on lines 479..507

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

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

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

                  if (!isAscending && !isDescending) {
                      $items.sort(function(a, b) {
                          return $(a).text() > $(b).text() ? 1 : -1;
                      });
          
          
          Severity: Major
          Found in src/js/course-list.js and 1 other location - About 1 hr to fix
          src/js/course-list.js on lines 29..46

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

          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 (isAscending && !isDescending) {
                      $items.sort(function(a, b) {
                          return $(a).text() < $(b).text() ? 1 : -1;
                      });
          
          
          Severity: Major
          Found in src/js/course-list.js and 1 other location - About 1 hr to fix
          src/js/course-list.js on lines 23..46

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

          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 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
            Severity
            Category
            Status
            Source
            Language