wongjiahau/ttap-web

View on GitHub

Showing 125 of 211 total issues

Function moveElementAwayFromCollision has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

function moveElementAwayFromCollision(layout, collidesWith, itemToMove, isUserAction, compactType, cols) {
Severity: Minor
Found in src/ts/modified_node_modules/react-grid-layout/build/utils.js - About 45 mins to fix

    Function GenerateSlotViewsAndDayColumn has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    export function GenerateSlotViewsAndDayColumn(
      slots: ISlotViewModel[],
      selectSlotChoiceHandler: (slotUid: number, newSlotChoice: number) => void,
      goToThisAlternativeSlotHandler: (
        sourceSlotUid: number,
    Severity: Minor
    Found in src/ts/react/timetableView/generateSlotViewsAndDayColumn.tsx - 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

    Avoid deeply nested control flow statements.
    Open

              if (indices[ptr].Value <= indices[ptr].UpperLimit) {
                break;
              } else {
                indices[ptr].Value = 0;
                snapshots.pop();
    Severity: Major
    Found in src/ts/permutator/findTimetable.ts - About 45 mins to fix

      Function findOrGenerateResponsiveLayout has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      function findOrGenerateResponsiveLayout(layouts, breakpoints, breakpoint, lastBreakpoint, cols, compactType) {
      Severity: Minor
      Found in src/ts/modified_node_modules/react-grid-layout/build/responsiveUtils.js - About 45 mins to fix

        Function GenerateNewState has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          protected GenerateNewState(state: IMasterState): IMasterState {
            const visualizer = state.AlgorithmVisualizerState.isEnabled
              ? new FindTimetableVisualizer()
              : new NullFindTimetableVisualizer();
        
        
        Severity: Minor
        Found in src/ts/redux/actions/toggleSubjectSelection.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

        Function GenerateNewState has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          protected GenerateNewState(state: IMasterState): IMasterState {
            const currentTimetable =
              state.TimetableListState.FiltrateTimetables[
                state.TimetableListState.CurrentIndex
              ];
        Severity: Minor
        Found in src/ts/redux/actions/findAlternativeSlotsOfCurrentSlots.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

        Avoid deeply nested control flow statements.
        Open

                  if (ptr === 0) {
                    return result;
                  }
        Severity: Major
        Found in src/ts/permutator/findTimetable.ts - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                    for (let j = Y + 1; j <= 6; j++) {
                      dayRows[j].rowIndex++;
                    }
          Severity: Major
          Found in src/ts/react/timetableView/generateSlotAndDayLayouts.ts - About 45 mins to fix

            Function calcPosition has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

              GridItem.prototype.calcPosition = function calcPosition(x, y, w, h, state) {
            Severity: Minor
            Found in src/ts/modified_node_modules/react-grid-layout/build/GridItem.js - About 35 mins to fix

              Function GenerateSlotViewsAndDayColumn has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                slots: ISlotViewModel[],
                selectSlotChoiceHandler: (slotUid: number, newSlotChoice: number) => void,
                goToThisAlternativeSlotHandler: (
                  sourceSlotUid: number,
                  destinationSlotUid: number
              Severity: Minor
              Found in src/ts/react/timetableView/generateSlotViewsAndDayColumn.tsx - About 35 mins to fix

                Function Increment has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                export function Increment(indices: BoundedInt[]): BoundedInt[] {
                  let pointer = indices.length - 1;
                  const x = indices.slice();
                  while (true) {
                    x[pointer].Value++;
                Severity: Minor
                Found in src/ts/permutator/increment.ts - About 35 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 render has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                  public render() {
                    const skeleton = new Skeleton();
                    if (this.props.slots && this.props.alternateSlots) {
                      // render timetable view
                      const slotViewsAndDayColumn = GenerateSlotViewsAndDayColumn(
                Severity: Minor
                Found in src/ts/react/timetableView/timetableView.tsx - About 35 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 render has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                  public render() {
                    const subjectViews = this.props.Subjects.map((s, index) => {
                      if (s.IsVisible) {
                        return (
                          <div key={s.Code}>
                Severity: Minor
                Found in src/ts/react/subjectListView.tsx - About 35 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 To12HourFormat has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                  public To12HourFormat(withAmOrPmLabel: boolean = true): string {
                    let temp = this.Hour > 12 ? this.Hour - 12 : this.Hour;
                    if (temp === 0) {
                      temp = 12;
                    }
                Severity: Minor
                Found in src/ts/att/time.ts - About 35 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

                Avoid too many return statements within this function.
                Open

                  return true; // boxes overlap
                Severity: Major
                Found in src/ts/modified_node_modules/react-grid-layout/build/utils.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                    if (l1.y >= l2.y + l2.h) return false; // l1 is below l2
                  Severity: Major
                  Found in src/ts/modified_node_modules/react-grid-layout/build/utils.js - About 30 mins to fix

                    Function GetSlotNumbers has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                    export function GetSlotNumbers(slotState: IStringDicionary<boolean>): string[] {
                      const result: string[] = [];
                      for (const key in slotState) {
                        if (slotState.hasOwnProperty(key)) {
                          const current = slotState[key];
                    Severity: Minor
                    Found in src/ts/redux/actions/findTimetablesBasedOnChosenSlots.ts - About 25 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 _extends has a Cognitive Complexity of 6 (exceeds 5 allowed). 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; };
                    Severity: Minor
                    Found in src/ts/modified_node_modules/react-grid-layout/build/ReactGridLayout.js - About 25 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 _extends has a Cognitive Complexity of 6 (exceeds 5 allowed). 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; };

                    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 FindClashes has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                    export function FindClashes(
                      subjects: Subject[],
                      rawSlotStore: ObjectStore<RawSlot>
                    ): void {
                      if (subjects.length < 2) {
                    Severity: Minor
                    Found in src/ts/clashFinder/findClashes.ts - About 25 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