wongjiahau/ttap-web

View on GitHub

Showing 211 of 211 total issues

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

  public render() {
    const subjectViews = this.props.Subjects.map((s, index) => {
      if (s.IsVisible) {
        return (
          <div key={s.Code}>
Severity: Major
Found in src/ts/react/subjectListView.tsx - About 4 hrs to fix

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

      public render() {
        return (
          <Dialog open={this.props.isOpen} fullScreen={true}>
            {/* transition={Transition}> */}
            <DialogContent style={divStyle}>
    Severity: Major
    Found in src/ts/react/setTimeConstraintView.tsx - About 4 hrs to fix

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

        public render() {
          // const DEBUGGING = false; // Please change to false during production
          // if (DEBUGGING) {
          //     this.props.handleSlotLoaded(HENG_2017_APR());
          //     alert("WARNING! You are in a debugging session.");
      Severity: Major
      Found in src/ts/react/timetableCreatorView.tsx - About 3 hrs to fix

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

        var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
        src/ts/modified_node_modules/react-grid-layout/build/GridItem.js on lines 6..6
        src/ts/modified_node_modules/react-grid-layout/build/ReactGridLayout.js on lines 6..6
        src/ts/modified_node_modules/react-grid-layout/build/ResponsiveReactGridLayout.js on lines 6..6
        src/ts/modified_node_modules/react-grid-layout/build/components/WidthProvider.js on lines 6..6

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

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

        var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
        src/ts/modified_node_modules/react-grid-layout/build/GridItem.js on lines 6..6
        src/ts/modified_node_modules/react-grid-layout/build/ReactGridLayout.js on lines 6..6
        src/ts/modified_node_modules/react-grid-layout/build/components/WidthProvider.js on lines 6..6
        src/ts/modified_node_modules/react-grid-layout/build/utils.js on lines 6..6

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

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

        var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
        src/ts/modified_node_modules/react-grid-layout/build/GridItem.js on lines 6..6
        src/ts/modified_node_modules/react-grid-layout/build/ReactGridLayout.js on lines 6..6
        src/ts/modified_node_modules/react-grid-layout/build/ResponsiveReactGridLayout.js on lines 6..6
        src/ts/modified_node_modules/react-grid-layout/build/utils.js on lines 6..6

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

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

        var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
        src/ts/modified_node_modules/react-grid-layout/build/ReactGridLayout.js on lines 6..6
        src/ts/modified_node_modules/react-grid-layout/build/ResponsiveReactGridLayout.js on lines 6..6
        src/ts/modified_node_modules/react-grid-layout/build/components/WidthProvider.js on lines 6..6
        src/ts/modified_node_modules/react-grid-layout/build/utils.js on lines 6..6

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

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

        var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
        src/ts/modified_node_modules/react-grid-layout/build/GridItem.js on lines 6..6
        src/ts/modified_node_modules/react-grid-layout/build/ResponsiveReactGridLayout.js on lines 6..6
        src/ts/modified_node_modules/react-grid-layout/build/components/WidthProvider.js on lines 6..6
        src/ts/modified_node_modules/react-grid-layout/build/utils.js on lines 6..6

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

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

        export function FindTimetable(
          input: IOptimizedSlot[],
          disableClashChecking = false,
          visualizer?: FindTimetableVisualizer<IOptimizedSlot>
        ): Timetable[] {
        Severity: Major
        Found in src/ts/permutator/findTimetable.ts - About 3 hrs to fix

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

            protected GenerateNewState(state: IMasterState): IMasterState {
              const currentTimetable =
                state.TimetableListState.FiltrateTimetables[
                  state.TimetableListState.CurrentIndex
                ];
          Severity: Major
          Found in src/ts/redux/actions/findAlternativeSlotsOfCurrentSlots.ts - About 3 hrs to fix

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

            export class ToggleIsOpenOfSubjectListView extends MasterStateAction {
              public constructor(private open: boolean) {
                super();
              }
            
            
            Severity: Major
            Found in src/ts/redux/actions/toggleIsOpenOfSubjectListView.ts and 1 other location - About 3 hrs to fix
            src/ts/redux/actions/toggleIsOpenOfGetDateDialog.ts on lines 2..20

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

            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

            export class ToggleIsOpenOfGetDateDialog extends MasterStateAction {
              public constructor(private isOpen: boolean) {
                super();
              }
            
            
            Severity: Major
            Found in src/ts/redux/actions/toggleIsOpenOfGetDateDialog.ts and 1 other location - About 3 hrs to fix
            src/ts/redux/actions/toggleIsOpenOfSubjectListView.ts on lines 3..21

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

            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 = 5;
                  newSlot.Number = last(result).Number;
                  newSlot.Type = last(result).Type;
                  newSlot.Group = last(result).Group;
            Severity: Major
            Found in src/ts/parser/parseStudentHtmlToRawSlot_v2.ts and 1 other location - About 3 hrs to fix
            src/ts/parser/parseFgoHtmlToRawSlot_v2.ts on lines 48..54

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

            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 = 5;
                  newSlot.Number = last(result).Number;
                  newSlot.Type = last(result).Type;
                  newSlot.Group = last(result).Group;
            Severity: Major
            Found in src/ts/parser/parseFgoHtmlToRawSlot_v2.ts and 1 other location - About 3 hrs to fix
            src/ts/parser/parseStudentHtmlToRawSlot_v2.ts on lines 48..54

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

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

              public render() {
                if (!this.props.slotViewModelStore) {
                  return Logo();
                }
                const slotsToBeRendered =
            Severity: Major
            Found in src/ts/react/timetableListView.tsx - About 3 hrs to fix

              Function GenerateTotalMatrix has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
              Open

              export function GenerateTotalMatrix(
                timetables: IGroupedTimetable[],
                uidsOfClickedMatrix: string[] = []
              ): STCBox[] {
                const result = new Array<STCBox>();
              Severity: Minor
              Found in src/ts/model/matrix/generateTotalMatrix.ts - 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 ParseStudentHtmlToRawSlot_v2 has 85 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

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

                File utils.js has 306 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/utils.js - About 3 hrs to fix

                  Function ParseStudentHtmlToRawSlot has 81 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

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

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

                      public render() {
                        const getButton = (
                          handler: any,
                          icon: any,
                          tooltip: string,
                    Severity: Major
                    Found in src/ts/react/counterView.tsx - About 3 hrs to fix
                      Severity
                      Category
                      Status
                      Source
                      Language