VIAplanner/via-timetable

View on GitHub

Showing 102 of 200 total issues

Function fallTutorialCombo has 82 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  const fallTutorialCombo = (courseSection, whichArray2, output2 = []) => {
    fallTutorialCombo.founded = 0;
    const tut2 = searchForSectionIndexAfterprevIndex(
      courseSection,
      'tutorial',
Severity: Major
Found in src/timetable-planner/index.js - About 3 hrs to fix

    `` has 27 functions (exceeds 20 allowed). Consider refactoring.
    Open

      mutations: {
        setDarkMode(state, payload) {
          state.darkMode = payload;
          regenerateColors(state);
          saveState(state);
    Severity: Minor
    Found in src/store/index.js - About 3 hrs to fix

      Function sortCourseSections has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
      Open

      const sortCourseSections = (course, online) => {
        if (online === 'InPerson') {
          course.lecture.sort((a, b) => (a.sectionCode > b.sectionCode ? 1 : -1));
          course.practical.sort((a, b) => (a.sectionCode > b.sectionCode ? 1 : -1));
          course.tutorial.sort((a, b) => (a.sectionCode > b.sectionCode ? 1 : -1));
      Severity: Minor
      Found in src/timetable-planner/index.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 sortCourseSections has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
      Open

      const sortCourseSections = (course, online) => {
        if (online === 'InPerson') {
          course.lecture.sort((a, b) => (a.sectionCode > b.sectionCode ? 1 : -1));
          course.practical.sort((a, b) => (a.sectionCode > b.sectionCode ? 1 : -1));
          course.tutorial.sort((a, b) => (a.sectionCode > b.sectionCode ? 1 : -1));
      Severity: Minor
      Found in src/timetable-planner/index2.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 deleteCourse has 65 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          deleteCourse(context, payload) {
            // resets search bar value if the deleted course is the last searched course
            if (
              context.state.searchBarValue !== null &&
              context.state.searchBarValue.includes(payload.code)
      Severity: Major
      Found in src/store/index.js - About 2 hrs to fix

        Function clearStorage has 65 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            clearStorage(context) {
              context.state.fallLockedHourStatus = {
                '8 AM': false,
                '9 AM': false,
                '10 AM': false,
        Severity: Major
        Found in src/store/index.js - About 2 hrs to fix

          Function lockSection has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
          Open

              lockSection(state, payload) {
                let index;
                if (payload.slice(0, 4) === 'Lock') {
                  if (payload[4] === 'F') {
                    index = state.fallLockedSections.indexOf(payload);
          Severity: Minor
          Found in src/store/index.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 unlockSection has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
          Open

              unlockSection(state, payload) {
                let index;
                if (payload.slice(0, 4) === 'Lock') {
                  // Block hour
                  if (payload[4] === 'F') {
          Severity: Minor
          Found in src/store/index.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 checkNoOverlap has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
          Open

          const checkNoOverlap = (courseTimings1, courseTimings2) => {
            const YEAR = 'Y';
            // Check if (start, end) is in between (start2, end2).
            const existsOverlap = (start, end, start2, end2) =>
              (start >= start2 && start <= end2) || (end >= start2 && end <= end2) || (start2 <= start && end <= end2) || (start <= start2 && end2 <= end);
          Severity: Minor
          Found in src/timetable-planner/index2.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 generateTimetables has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
          Open

          const generateTimetables = (
            fallCourses,
            fallLockSections,
            winterCourses,
            winterLockSections,
          Severity: Minor
          Found in src/timetable-planner/index2.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 tutorialCombo has 50 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                        const tutorialCombo = (
                          // eslint-disable-next-line no-shadow
                          courseSection,
                          whichArray2 = tut,
                          output2 = [],
          Severity: Minor
          Found in src/timetable-planner/index.js - About 2 hrs to fix

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

                                    const tutorialCombo = (
                                      // eslint-disable-next-line no-shadow
                                      courseSection,
                                      // eslint-disable-next-line no-shadow
                                      whichArray2 = tut,
            Severity: Minor
            Found in src/timetable-planner/index.js - About 2 hrs to fix

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

                          const tutorialCombo = (
                            // eslint-disable-next-line no-shadow
                            courseSection,
                            // eslint-disable-next-line no-shadow
                            whichArray2 = tut,
              Severity: Minor
              Found in src/timetable-planner/index.js - About 2 hrs to fix

                Function winterTutorialCombo has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  const winterTutorialCombo = (courseSection, whichArray2, output2 = []) => {
                    winterTutorialCombo.founded = 0;
                    const tut2 = searchForSectionIndexAfterprevIndex(
                      courseSection,
                      'tutorial',
                Severity: Minor
                Found in src/timetable-planner/index.js - About 1 hr to fix

                  Function switchSection has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                  Open

                      switchSection(context, payload) {
                        // Remove old section from locked sections
                        context.commit(
                          'unlockSection',
                          `${payload.old.courseCode}${payload.old.sectionCode}`,
                  Severity: Minor
                  Found in src/store/index.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 addCourse has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                  Open

                      addCourse(state, payload) {
                        if(state.globalAllowConflicts){
                          state.allowedConflictCourses.push({code:payload.course.courseCode});
                        }
                        if (payload.course.courseCode.slice(0, 4) === 'Lock') {
                  Severity: Minor
                  Found in src/store/index.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 checkOverlapForDay has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                  const checkOverlapForDay = (timetable, day) => {
                    let section = 0;
                    while (section < timetable[day].length) {
                      let section2 = +section + +1;
                      while (section2 < timetable[day].length) {
                  Severity: Minor
                  Found in src/timetable-planner/index.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 backtrack has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                  const backtrack = (_assigned, unassigned, csp) => {
                    // Backtracking search.
                    
                    // Copying assigned in necessary because we modify it. Without copying
                    // the object over, modifying assigned would also change values for old
                  Severity: Minor
                  Found in src/timetable-planner/csp/index.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 generateTimetables has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  const generateTimetables = (
                    fallCourses,
                    fallLockSections,
                    winterCourses,
                    winterLockSections,
                  Severity: Minor
                  Found in src/timetable-planner/index.js - About 1 hr to fix

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

                        addCourse(state, payload) {
                          if(state.globalAllowConflicts){
                            state.allowedConflictCourses.push({code:payload.course.courseCode});
                          }
                          if (payload.course.courseCode.slice(0, 4) === 'Lock') {
                    Severity: Minor
                    Found in src/store/index.js - About 1 hr to fix
                      Severity
                      Category
                      Status
                      Source
                      Language