VIAplanner/via-timetable

View on GitHub

Showing 200 of 200 total issues

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

        if (overlapExists(fallTimetable)) {
          fallTimetable = {
            MONDAY: [],
            TUESDAY: [],
            WEDNESDAY: [],
Severity: Major
Found in src/timetable-planner/index.js and 3 other locations - About 5 hrs to fix
src/timetable-planner/index.js on lines 971..1029
src/timetable-planner/index.js on lines 1368..1482
src/timetable-planner/index.js on lines 1512..1535

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

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

        if (overlapExists(winterTimetable)) {
          winterTimetable = {
            MONDAY: [],
            TUESDAY: [],
            WEDNESDAY: [],
Severity: Major
Found in src/timetable-planner/index.js and 3 other locations - About 5 hrs to fix
src/timetable-planner/index.js on lines 751..939
src/timetable-planner/index.js on lines 971..1029
src/timetable-planner/index.js on lines 1368..1482

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

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

        if (overlapExists(winterTimetable)) {
          winterTimetable = {
            MONDAY: [],
            TUESDAY: [],
            WEDNESDAY: [],
Severity: Major
Found in src/timetable-planner/index.js and 3 other locations - About 5 hrs to fix
src/timetable-planner/index.js on lines 751..939
src/timetable-planner/index.js on lines 971..1029
src/timetable-planner/index.js on lines 1512..1535

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

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 timetable.spec.js has 398 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import test from 'ava';
import { generateTimetables, createTimetable } from './index';

const ONE_COURSE_L1_P2 = [
  {
Severity: Minor
Found in src/timetable-planner/timetable.spec.js - About 5 hrs to fix

    Function winterPracticalCombo has 130 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

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

      Function practicalCombo has 128 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

                  const practicalCombo = (
                    // eslint-disable-next-line no-shadow
                    courseSection,
                    whichArray2 = pra,
                    output2 = [],
      Severity: Major
      Found in src/timetable-planner/index.js - About 5 hrs to fix

        Function createTimetable has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
        Open

        const createTimetable = (fallCourseSection, winterCourseSection, state) => {
          let fallTimetable = {
            MONDAY: [],
            TUESDAY: [],
            WEDNESDAY: [],
        Severity: Minor
        Found in src/timetable-planner/index.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

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

              if (course.code === section.slice(0, section.length - 5)) {
                if (section[section.length - 5] === 'L') {
                  for (const lecture of course.lecture) {
                    if (lecture.sectionCode === section.slice(section.length - 5)) {
                      course.lecture = [lecture];
        Severity: Major
        Found in src/timetable-planner/index.js and 1 other location - About 4 hrs to fix
        src/timetable-planner/index2.js on lines 17..48

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

        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

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

              if (course.code === section.slice(0, section.length - 5)) {
                if (section[section.length - 5] === 'L') {
                  // const lecture = course.lecture.find(lec => lec.sectionCode === section.slice(section.length - 5));
                  for (const lecture of course.lecture) {
                    if (lecture.sectionCode === section.slice(section.length - 5)) {
        Severity: Major
        Found in src/timetable-planner/index2.js and 1 other location - About 4 hrs to fix
        src/timetable-planner/index.js on lines 156..186

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

        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 {
                  for (const day in context.state.winterTimetable) {
                    const dayEvents = context.state.winterTimetable[day];
                    for (let i = dayEvents.length - 1; i >= 0; i -= 1) {
                      if (dayEvents[i].code === payload.code) {
        Severity: Major
        Found in src/store/index.js and 1 other location - About 3 hrs to fix
        src/store/index.js on lines 659..669

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

        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 (payload.code[4] === 'F') {
                  for (const day in context.state.fallTimetable) {
                    const dayEvents = context.state.fallTimetable[day];
                    for (let i = dayEvents.length - 1; i >= 0; i -= 1) {
                      if (dayEvents[i].code === payload.code) {
        Severity: Major
        Found in src/store/index.js and 1 other location - About 3 hrs to fix
        src/store/index.js on lines 669..679

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

        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

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

          getters: {
            getSerializedState: state => state.history[state.history.length - 1 + state.historyIndex],
            getExportOverlay: state => state.exportOverlay,
            getNoTimetablePopup: state => state.noTimetablePopup,
            getShareLinkPopup: state => state.shareLinkPopup,
        Severity: Minor
        Found in src/store/index.js - About 3 hrs to fix

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

              saveLockedDayStatus(context) {
                if (context.state.semesterStatus === 'F') {
                  context.state.savedLockedDayStatus = JSON.parse(
                    JSON.stringify(context.state.fallLockedDayStatus),
                  );
          Severity: Major
          Found in src/store/index.js and 1 other location - About 3 hrs to fix
          src/store/index.js on lines 525..535

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

          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

              saveLockedHourStatus(context) {
                if (context.state.semesterStatus === 'F') {
                  context.state.savedLockedHourStatus = JSON.parse(
                    JSON.stringify(context.state.fallLockedHourStatus),
                  );
          Severity: Major
          Found in src/store/index.js and 1 other location - About 3 hrs to fix
          src/store/index.js on lines 514..524

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

          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

                  for (const day in context.state.winterTimetable) {
                    const dayEvents = context.state.winterTimetable[day];
                    for (let i = dayEvents.length - 1; i >= 0; i -= 1) {
                      if (dayEvents[i].code === payload.code) {
                        dayEvents.splice(i, 1);
          Severity: Major
          Found in src/store/index.js and 1 other location - About 3 hrs to fix
          src/store/index.js on lines 681..688

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

          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

                  for (const day in context.state.fallTimetable) {
                    const dayEvents = context.state.fallTimetable[day];
                    for (let i = dayEvents.length - 1; i >= 0; i -= 1) {
                      if (dayEvents[i].code === payload.code) {
                        dayEvents.splice(i, 1);
          Severity: Major
          Found in src/store/index.js and 1 other location - About 3 hrs to fix
          src/store/index.js on lines 689..696

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

          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 tutorialCombo has 89 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: Major
          Found in src/timetable-planner/index.js - About 3 hrs to fix

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

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

              Function tutorialCombo has 88 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: Major
              Found in src/timetable-planner/index.js - About 3 hrs to fix

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

                const generateTimetables = (
                  fallCourses,
                  fallLockSections,
                  winterCourses,
                  winterLockSections,
                Severity: Major
                Found in src/timetable-planner/index2.js - About 3 hrs to fix
                  Severity
                  Category
                  Status
                  Source
                  Language