VIAplanner/via-timetable

View on GitHub

Showing 200 of 200 total issues

Function createTimetable has 1230 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const createTimetable = (fallCourseSection, winterCourseSection, state) => {
  let fallTimetable = {
    MONDAY: [],
    TUESDAY: [],
    WEDNESDAY: [],
Severity: Major
Found in src/timetable-planner/index.js - About 6 days to fix

    File index.js has 1445 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    const sortCourseSection = require('./combinations/combinations');
    
    /**
     * Search for the first index of course that has type section
     * @param {*} courseSection
    Severity: Major
    Found in src/timetable-planner/index.js - About 3 days to fix

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

                        arrayElement2 => {
                          // Base case when reach until the last course that has tutorial
                          if (fallPracticalCombo.founded === 1) {
                            return true;
                          }
      Severity: Major
      Found in src/timetable-planner/index.js and 1 other location - About 2 days to fix
      src/timetable-planner/index.js on lines 577..648

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

      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

                          arrayElement2 => {
                            // Base case when reach until the last course that has tutorial
                            if (fallLectureCombo.founded === 1) {
                              return true;
                            }
      Severity: Major
      Found in src/timetable-planner/index.js and 1 other location - About 2 days to fix
      src/timetable-planner/index.js on lines 807..878

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

      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

      File combinations.spec.js has 959 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import test from 'ava';
      import {
        courseMeetingSectionCombinations,
        courseCombinations,
      } from './combinations';
      Severity: Major
      Found in src/timetable-planner/combinations/combinations.spec.js - About 2 days to fix

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

                                const tutorialCombo = (
                                  // eslint-disable-next-line no-shadow
                                  courseSection,
                                  // eslint-disable-next-line no-shadow
                                  whichArray2 = tut,
        Severity: Major
        Found in src/timetable-planner/index.js and 1 other location - About 2 days to fix
        src/timetable-planner/index.js on lines 1394..1459

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

        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

                    const tutorialCombo = (
                      // eslint-disable-next-line no-shadow
                      courseSection,
                      // eslint-disable-next-line no-shadow
                      whichArray2 = tut,
        Severity: Major
        Found in src/timetable-planner/index.js and 1 other location - About 2 days to fix
        src/timetable-planner/index.js on lines 1138..1203

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

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

          const fallLectureCombo = (courseSection, whichArray, output = []) => {
            fallLectureCombo.founded = 0;
            const lec2 = searchForSectionIndexAfterprevIndex(
              courseSection,
              'lecture',
        Severity: Major
        Found in src/timetable-planner/index.js - About 2 days to fix

          File index.js has 813 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import Vue from 'vue';
          import Vuex from 'vuex';
          import genColor from 'color-generator';
          import { generateTimetables } from '../timetable-planner/index2';
          // import colorDiff from "color-difference"
          Severity: Major
          Found in src/store/index.js - About 1 day to fix

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

            const SECTIONS_L1_T2 = {
              code: 'CSC108H5F',
              combinations: [
                [
                  {
            Severity: Major
            Found in src/timetable-planner/combinations/combinations.spec.js and 1 other location - About 1 day to fix
            src/timetable-planner/combinations/combinations.spec.js on lines 234..322

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

            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

            const SECTIONS_L1_P2 = {
              code: 'CSC108H5F',
              combinations: [
                [
                  {
            Severity: Major
            Found in src/timetable-planner/combinations/combinations.spec.js and 1 other location - About 1 day to fix
            src/timetable-planner/combinations/combinations.spec.js on lines 323..411

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

            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

            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: Major
            Found in src/timetable-planner/index2.js and 1 other location - About 1 day to fix
            src/timetable-planner/index.js on lines 197..207

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

            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

            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: Major
            Found in src/timetable-planner/index.js and 1 other location - About 1 day to fix
            src/timetable-planner/index2.js on lines 59..69

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

            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 3 locations. Consider refactoring.
            Open

                    if (overlapExists(fallTimetable)) {
                      fallTimetable = {
                        MONDAY: [],
                        TUESDAY: [],
                        WEDNESDAY: [],
            Severity: Major
            Found in src/timetable-planner/index.js and 2 other locations - About 1 day to fix
            src/timetable-planner/index.js on lines 549..711
            src/timetable-planner/index.js on lines 773..938

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

            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 3 locations. Consider refactoring.
            Open

                      if (tut >= 0) {
                        const prevTimetabletut = createShallowCopyOfTimetable(
                          fallTimetable,
                        );
                        const tutorialCombo = (
            Severity: Major
            Found in src/timetable-planner/index.js and 2 other locations - About 1 day to fix
            src/timetable-planner/index.js on lines 549..711
            src/timetable-planner/index.js on lines 971..1029

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

            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 3 locations. Consider refactoring.
            Open

                        if (tut >= 0) {
                          const prevTimetable = createShallowCopyOfTimetable(fallTimetable);
                          const tutorialCombo = (
                            // eslint-disable-next-line no-shadow
                            courseSection,
            Severity: Major
            Found in src/timetable-planner/index.js and 2 other locations - About 1 day to fix
            src/timetable-planner/index.js on lines 773..938
            src/timetable-planner/index.js on lines 971..1029

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

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

              const winterLectureCombo = (courseSection, whichArray, output = []) => {
                winterLectureCombo.founded = 0;
                const lec2 = searchForSectionIndexAfterprevIndex(
                  courseSection,
                  'lecture',
            Severity: Major
            Found in src/timetable-planner/index.js - About 1 day to fix

              Function lockSectionOfCourse has a Cognitive Complexity of 67 (exceeds 5 allowed). Consider refactoring.
              Open

              const lockSectionOfCourse = (courseSections, lockSections) => {
                for (const course of courseSections) {
                  for (const section of lockSections) {
                    // const lockedSection = section.slice()
                    if (course.code === section.slice(0, section.length - 5)) {
              Severity: Minor
              Found in src/timetable-planner/index2.js - About 1 day 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 lockSectionOfCourse has a Cognitive Complexity of 67 (exceeds 5 allowed). Consider refactoring.
              Open

              const lockSectionOfCourse = (courseSections, lockSections) => {
                for (const course of courseSections) {
                  for (const section of lockSections) {
                    if (course.code === section.slice(0, section.length - 5)) {
                      if (section[section.length - 5] === 'L') {
              Severity: Minor
              Found in src/timetable-planner/index.js - About 1 day 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

              const fallCourses = [
                {
                  name: `Locked Section`,
                  courseCode: `LockMONDAY57600`,
                  meeting_sections: [
              Severity: Major
              Found in src/timetable-planner/test.js and 1 other location - About 1 day to fix
              src/timetable-planner/test.js on lines 67..128

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

              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

              Severity
              Category
              Status
              Source
              Language