wongjiahau/ttap-web

View on GitHub

Showing 125 of 211 total issues

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

      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

                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

                      Function constructor has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        public constructor() {
                          this.renderings.push(() => {
                            this.cy = Cytoscape({
                              elements: [],
                              boxSelectionEnabled: false,
                      Severity: Major
                      Found in src/ts/permutator/findTimetableVisualizer.ts - About 2 hrs to fix

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

                          public render() {
                            let style = {
                              ...tableStyle,
                            };
                            style = {
                        Severity: Major
                        Found in src/ts/react/panels/stackPanel.tsx - About 2 hrs to fix

                          Function GenerateSlotAndDayLayouts has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                          Open

                          export function GenerateSlotAndDayLayouts(
                            rawSlots: ISlotViewModel[],
                            xOffset: number,
                            yOffset: number
                          ): [ReactGridLayout.Layout[], ReactGridLayout.Layout[]] {
                          Severity: Minor
                          Found in src/ts/react/timetableView/generateSlotAndDayLayouts.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 moveElement has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                          Open

                          function moveElement(layout, l, x, y, isUserAction, preventCollision, compactType, cols) {
                            if (l.static) return layout;
                          
                            // Short-circuit if nothing to do.
                            if (l.y === y && l.x === x) return layout;
                          Severity: Minor
                          Found in src/ts/modified_node_modules/react-grid-layout/build/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

                          Function processGridItem has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            ReactGridLayout.prototype.processGridItem = function processGridItem(child) {
                              if (!child.key) return;
                              var l = (0, _utils.getLayoutItem)(this.state.layout, String(child.key));
                              if (!l) return null;
                              var _props4 = this.props,

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

                              public render() {
                                const buttonStyle: React.CSSProperties = {
                                  marginRight: "10px",
                                };
                                return (
                            Severity: Minor
                            Found in src/ts/react/getSemStartDateDialog.tsx - About 2 hrs to fix

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

                                public render() {
                                  const expectedHitCount = this.props.expectedHitCount();
                                  const percentage = (
                                    (expectedHitCount / this.props.actualHitCount) *
                                    100
                              Severity: Minor
                              Found in src/ts/react/algorithmVisualizerView.tsx - About 2 hrs to fix
                                Severity
                                Category
                                Status
                                Source
                                Language