wongjiahau/ttap-web

View on GitHub

Showing 211 of 211 total issues

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

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

              <div className="grid-item">
                {getButton(
                  this.props.handleClickLeft,
                  <IconLeft />,
                  this.props.leftTooltip,
      Severity: Major
      Found in src/ts/react/counterView.tsx and 2 other locations - About 45 mins to fix
      src/ts/react/counterView.tsx on lines 94..101
      src/ts/react/counterView.tsx on lines 102..109

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

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

              <div className="grid-item">
                {getButton(
                  this.props.handleClickDown,
                  <IconDown />,
                  this.props.downTooltip,
      Severity: Major
      Found in src/ts/react/counterView.tsx and 2 other locations - About 45 mins to fix
      src/ts/react/counterView.tsx on lines 68..75
      src/ts/react/counterView.tsx on lines 102..109

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

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

              <div className="grid-item">
                {getButton(
                  this.props.handleClickRight,
                  <IconRight />,
                  this.props.rightTooltip,
      Severity: Major
      Found in src/ts/react/counterView.tsx and 2 other locations - About 45 mins to fix
      src/ts/react/counterView.tsx on lines 68..75
      src/ts/react/counterView.tsx on lines 94..101

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

      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

            width: w === Infinity ? w : Math.round(colWidth * w + Math.max(0, w - 1) * margin[0]),
      src/ts/modified_node_modules/react-grid-layout/build/GridItem.js on lines 93..93

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

      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

            height: h === Infinity ? h : Math.round(rowHeight * h + Math.max(0, h - 1) * margin[1])
      src/ts/modified_node_modules/react-grid-layout/build/GridItem.js on lines 92..92

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

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

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

              var _props = this.props,
                  margin = _props.margin,
                  containerPadding = _props.containerPadding,
                  containerWidth = _props.containerWidth,
                  cols = _props.cols;
          src/ts/modified_node_modules/react-grid-layout/build/ResponsiveReactGridLayout.js on lines 67..71

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

          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

              var _props = this.props,
                  width = _props.width,
                  breakpoints = _props.breakpoints,
                  layouts = _props.layouts,
                  cols = _props.cols;
          src/ts/modified_node_modules/react-grid-layout/build/GridItem.js on lines 58..62

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

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

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

              if (a.x > b.x || a.x === b.x && a.y > b.y) {
                return 1;
              }
          Severity: Minor
          Found in src/ts/modified_node_modules/react-grid-layout/build/utils.js and 1 other location - About 35 mins to fix
          src/ts/modified_node_modules/react-grid-layout/build/utils.js on lines 415..420

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

          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

            constructor(props: ISubjectListViewProps) {
              super(props);
              this.state = {
                sectionStyle: this.getSectionStyle(),
              };
          Severity: Minor
          Found in src/ts/react/subjectListView.tsx and 1 other location - About 35 mins to fix
          src/ts/react/slotsTableView.tsx on lines 74..79

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

          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

            public constructor(props: ISlotsTableViewProps) {
              super(props);
              this.state = {
                sectionStyle: this.getSectionStyle(),
              };
          Severity: Minor
          Found in src/ts/react/slotsTableView.tsx and 1 other location - About 35 mins to fix
          src/ts/react/subjectListView.tsx on lines 77..82

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

          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

              if (a.y > b.y || a.y === b.y && a.x > b.x) {
                return 1;
              } else if (a.y === b.y && a.x === b.x) {
                // Without this, we can get different sort results in IE vs. Chrome/FF
                return 0;
          Severity: Minor
          Found in src/ts/modified_node_modules/react-grid-layout/build/utils.js and 1 other location - About 35 mins to fix
          src/ts/modified_node_modules/react-grid-layout/build/utils.js on lines 427..429

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

          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

          Severity
          Category
          Status
          Source
          Language