wongjiahau/ttap-web

View on GitHub

Showing 211 of 211 total issues

Function ParseFgoHtmlToRawSlot_v2 has 80 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function ParseFgoHtmlToRawSlot_v2(html: string): RawSlot[] {
  const result = new Array<RawSlot>();
  const htmlDoc = new DOMParser().parseFromString(html, "text/html");

  const tableRows = htmlDoc
Severity: Major
Found in src/ts/parser/parseFgoHtmlToRawSlot_v2.ts - About 3 hrs to fix

    Function render has 79 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      public render() {
        const skeleton = new Skeleton();
        if (this.props.slots && this.props.alternateSlots) {
          // render timetable view
          const slotViewsAndDayColumn = GenerateSlotViewsAndDayColumn(
    Severity: Major
    Found in src/ts/react/timetableView/timetableView.tsx - About 3 hrs to fix

      File GridItem.js has 298 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      //@ts-nocheck
      'use strict';
      
      exports.__esModule = true;
      
      
      Severity: Minor
      Found in src/ts/modified_node_modules/react-grid-layout/build/GridItem.js - About 3 hrs to fix

        Function GridItem has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
        Open

        var GridItem = function (_React$Component) {
          _inherits(GridItem, _React$Component);
        
          function GridItem() {
            var _temp, _this, _ret;
        Severity: Minor
        Found in src/ts/modified_node_modules/react-grid-layout/build/GridItem.js - About 3 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

              while (true) {
                indices[ptr].Value++;
                if (indices[ptr].Value <= indices[ptr].UpperLimit) {
                  break;
                } else {
        Severity: Major
        Found in src/ts/permutator/findTimetable.ts and 1 other location - About 3 hrs to fix
        src/ts/permutator/findTimetable.ts on lines 92..104

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

        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

                while (true) {
                  indices[ptr].Value++;
                  if (indices[ptr].Value <= indices[ptr].UpperLimit) {
                    break;
                  } else {
        Severity: Major
        Found in src/ts/permutator/findTimetable.ts and 1 other location - About 3 hrs to fix
        src/ts/permutator/findTimetable.ts on lines 110..122

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

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

        export function ParseFgoHtmlToRawSlot_v1(html: string): RawSlot[] {
          const result = new Array<RawSlot>();
          const htmlDoc = new DOMParser().parseFromString(html, "text/html");
        
          const tableRows = htmlDoc
        Severity: Major
        Found in src/ts/parser/parseFgoHtmlToRawSlot.ts - About 3 hrs to fix

          Function ResponsiveReactGridLayout has 76 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          var ResponsiveReactGridLayout = function (_React$Component) {
            _inherits(ResponsiveReactGridLayout, _React$Component);
          
            function ResponsiveReactGridLayout() {
              var _temp, _this, _ret;

            Function GenerateNewState has 74 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              protected GenerateNewState(state: IMasterState): IMasterState {
                const slotStore =
                  state.DataState.RawSlotDataRouter.GetDataFrom("ungeneralized");
                const slotTableState = state.SlotTableState;
                const slotNumbersOfSelectedSlots = GetSlotNumbers(
            Severity: Major
            Found in src/ts/redux/actions/findTimetablesBasedOnChosenSlots.ts - About 2 hrs to fix

              Function render has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
              Open

                public render() {
                  const {
                    slot,
                    color,
                    isShowingAlternativeSlot,
              Severity: Minor
              Found in src/ts/react/slotView.tsx - 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

              File subjectListView.tsx has 285 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import Button from "@material-ui/core/Button";
              import Drawer from "@material-ui/core/Drawer";
              import Paper from "@material-ui/core/Paper";
              import TextField from "@material-ui/core/TextField";
              import Tooltip from "@material-ui/core/Tooltip";
              Severity: Minor
              Found in src/ts/react/subjectListView.tsx - About 2 hrs to fix

                Function render has 70 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  public render() {
                    if (this.state.redirect) {
                      return <Redirect push={true} to="/play" />;
                    }
                    const inputProps = {
                Severity: Major
                Found in src/ts/react/selectCourseView.tsx - About 2 hrs to fix

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

                  fs.writeFile(
                    `${__dirname}/../ts/redux/tests/_${actionFileName}.test.ts`,
                    testSnippet,
                    function (err) {
                      if (err) {
                  Severity: Major
                  Found in scripts/generate-action.js and 1 other location - About 2 hrs to fix
                  scripts/generate-action.js on lines 63..73

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

                  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

                  fs.writeFile(
                    `${__dirname}/../ts/redux/actions/${actionFileName}.ts`,
                    fileSnippet,
                    function (err) {
                      if (err) {
                  Severity: Major
                  Found in scripts/generate-action.js and 1 other location - About 2 hrs to fix
                  scripts/generate-action.js on lines 96..106

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

                  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 (new Str(currentRow.id).Contains("subRow")) {
                        offset = 4;
                        newSlot.Number = last(result).Number;
                        newSlot.Type = last(result).Type;
                        newSlot.Group = last(result).Group;
                  Severity: Major
                  Found in src/ts/parser/parseStudentHtmlToRawSlot.ts and 1 other location - About 2 hrs to fix
                  src/ts/parser/parseFgoHtmlToRawSlot.ts on lines 48..53

                  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

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

                      if (new Str(currentRow.id).Contains("subRow")) {
                        offset = 4;
                        newSlot.Number = last(result).Number;
                        newSlot.Type = last(result).Type;
                        newSlot.Group = last(result).Group;
                  Severity: Major
                  Found in src/ts/parser/parseFgoHtmlToRawSlot.ts and 1 other location - About 2 hrs to fix
                  src/ts/parser/parseStudentHtmlToRawSlot.ts on lines 47..52

                  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

                  File login.tsx has 272 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import {
                    DialogActions,
                    DialogContent,
                    DialogContentText,
                    DialogTitle,
                  Severity: Minor
                  Found in src/ts/react/login.tsx - About 2 hrs to fix

                    File selectCourseView.tsx has 271 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import CircularProgress from "@material-ui/core/CircularProgress";
                    import Dialog from "@material-ui/core/Dialog";
                    import * as React from "react";
                    // @ts-ignore
                    import * as Autosuggest from "react-autosuggest";
                    Severity: Minor
                    Found in src/ts/react/selectCourseView.tsx - About 2 hrs to fix

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

                      export function ReleaseDisabledSubjectsIfPossible(
                        selectedSubjects: Subject[],
                        allSubjects: Subject[]
                      ): void {
                        const disabledSubjects = allSubjects.filter((s) => s.ClashReport !== null);
                      Severity: Minor
                      Found in src/ts/redux/actions/toggleSubjectSelection.ts - 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 GenerateTotalMatrix has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export function GenerateTotalMatrix(
                        timetables: IGroupedTimetable[],
                        uidsOfClickedMatrix: string[] = []
                      ): STCBox[] {
                        const result = new Array<STCBox>();
                      Severity: Major
                      Found in src/ts/model/matrix/generateTotalMatrix.ts - About 2 hrs to fix
                        Severity
                        Category
                        Status
                        Source
                        Language