wongjiahau/ttap-web

View on GitHub

Showing 125 of 211 total issues

Function DeselectSubject has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function DeselectSubject(
  subjectToBeDeselected: Subject,
  allSubjects: Subject[],
  state: IMasterState
): IMasterState {
Severity: Minor
Found in src/ts/redux/actions/toggleSubjectSelection.ts - About 1 hr to fix

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

      protected GenerateNewState(state: IMasterState): IMasterState {
        const targetSubject = find(state.SubjectListState.Subjects, {
          Code: this.subjectCode,
        }) as Subject;
        let selectedSlotsCount = 0;
    Severity: Minor
    Found in src/ts/redux/actions/toggleSelectionOnGroupOfSlots.ts - About 1 hr to fix

      Function findSisterSlots has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function findSisterSlots(
        slotsOfCurrentTimetable: IRawSlot[],
        allSlots: IRawSlot[]
      ): IRawSlot[] {
        const currentSlotsAsBigSlots = slotsOfCurrentTimetable.map((x) =>
      Severity: Minor
      Found in src/ts/redux/actions/saveTimetable/saveTimetableAsTextFile.ts - About 1 hr to fix

        Function moveElement has 29 lines of code (exceeds 25 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 1 hr to fix

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

            protected GenerateNewState(state: IMasterState): IMasterState {
              const [filtrate, residue] = Filter(
                state.TimetableListState.FiltrateTimetables,
                this.clickedState
              );
          Severity: Minor
          Found in src/ts/redux/actions/filterTimetable.ts - About 1 hr to fix

            Function Legend has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const Legend = (props: ILegendProps) => {
              const background = () => {
                switch (props.type) {
                  case "red":
                    return ColorOfDefinitelyOccupied;
            Severity: Minor
            Found in src/ts/react/setTimeConstraintView.tsx - About 1 hr to fix

              Function LoadSlotsFromUrl has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export const LoadSlotsFromUrl = (
                downloadUrl: string,
                fileType: string,
                started: () => void,
                successed: (loadedSlots: IRawSlot[]) => void,
              Severity: Minor
              Found in src/ts/react/selectCourseView.tsx - About 1 hr to fix

                Function Defilter has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                export function Defilter(
                  residueTimetables: IGroupedTimetable[],
                  clickedTimeConstraint: number[]
                ): [IGroupedTimetable[], IGroupedTimetable[]] {
                  if (clickedTimeConstraint.length !== 7) {
                Severity: Minor
                Found in src/ts/model/matrix/defilter.ts - About 1 hr 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 GenerateAlternateSlotViewsAndDayColumn has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export function GenerateAlternateSlotViewsAndDayColumn(
                  slots: ISlotViewModel[],
                  handleSelectSlotChoice: (slotUid: number, newSlotChoice: number) => void,
                  handleGoToThisAlternateSlot: (slotUid: number) => void,
                  isShowingAlternativeSlotOf: ISlotViewModel

                  Function GetDayColumn has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    private GetDayColumn(): JSX.Element[] {
                      const days = [" ", "MON", "TUE", "WED", "THU", "FRI", "SAT", "SUN"];
                      const firstDivStyle: React.CSSProperties = {
                        borderRight: "1px solid",
                        display: "table",
                  Severity: Minor
                  Found in src/ts/react/timetableView/skeleton.tsx - About 1 hr to fix

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

                      public constructor(props: ISelectCourseViewDispatchProps) {
                        super(props);
                        this.state = {
                          currentSuggestions: [],
                          redirect: false,
                    Severity: Minor
                    Found in src/ts/react/selectCourseView.tsx - About 1 hr to fix

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

                        public render() {
                          const paperStyle: React.CSSProperties = {
                            overflowY: "auto",
                            paddingTop: "15px",
                            paddingRight: "40px",
                      Severity: Minor
                      Found in src/ts/react/tutorial/markdownPage.tsx - About 1 hr to fix

                        Function compactItem has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        function compactItem(compareWith, l, compactType, cols) {
                          var compactV = compactType === 'vertical';
                          var compactH = compactType === 'horizontal';
                          if (compactV) {
                            // Bottom 'y' possible is the bottom of the layout.
                        Severity: Minor
                        Found in src/ts/modified_node_modules/react-grid-layout/build/utils.js - About 1 hr to fix

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

                            protected GenerateNewState(state: IMasterState): IMasterState {
                              const route = state.SettingsState.SearchByConsideringWeekNumber
                                ? "ungeneralized"
                                : "generalized";
                              const router = new DataRouter<ObjectStore<RawSlot>>();
                          Severity: Minor
                          Found in src/ts/redux/actions/notifyDataLoaded.ts - About 1 hr to fix

                            Function StringifyTotalMatrix has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            export function StringifyTotalMatrix(totalMatrix: STCBox[]): string {
                              const getRow = () => Array(TimePeriod.GetNumberOfHalfHours());
                              const data = [
                                getRow(),
                                getRow(),
                            Severity: Minor
                            Found in src/ts/model/matrix/generateTotalMatrix.ts - About 1 hr to fix

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

                                protected GenerateNewState(state: IMasterState): IMasterState {
                                  const sourceSlot = state.TimetableListState.SlotViewModelStore.GetOne(
                                    this.sourceSlotUid
                                  );
                                  if (!sourceSlot) {
                              Severity: Minor
                              Found in src/ts/redux/actions/goToThisAlternativeSlot.ts - About 1 hr to fix

                                Function synchronizeLayoutWithChildren has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                function synchronizeLayoutWithChildren(initialLayout, children, cols, compactType) {
                                  return initialLayout;  // Added this line
                                  initialLayout = initialLayout || [];
                                
                                  // Generate one layout item per child.
                                Severity: Minor
                                Found in src/ts/modified_node_modules/react-grid-layout/build/utils.js - About 1 hr to fix

                                  Function moveElement has 8 arguments (exceeds 4 allowed). Consider refactoring.
                                  Open

                                  function moveElement(layout, l, x, y, isUserAction, preventCollision, compactType, cols) {
                                  Severity: Major
                                  Found in src/ts/modified_node_modules/react-grid-layout/build/utils.js - About 1 hr to fix

                                    Function GetTimeRow has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                      private GetTimeRow(): JSX.Element[] {
                                        const divStyle: React.CSSProperties = {
                                          borderBottom: "1px solid",
                                          borderRight: "1px solid",
                                          height: "20.5px",
                                    Severity: Minor
                                    Found in src/ts/react/timetableView/skeleton.tsx - About 55 mins 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 PartitionizeByKey has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                    export function PartitionizeByKey<T>(input: T[], keyName: string): T[][] {
                                      if (input.length === 0) {
                                        return [];
                                      }
                                      const result = new Array<T[]>();
                                    Severity: Minor
                                    Found in src/ts/permutator/partitionize.ts - About 45 mins 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

                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language