wongjiahau/ttap-web

View on GitHub

Showing 211 of 211 total issues

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

    expect(
      newState.SetTimeConstraintState.TotalMatrix.filter(
        (x) => x.Kind === BoxKind.MaybeOccupied
      )
    ).to.have.lengthOf(6);
Severity: Major
Found in src/ts/specs/_integration.test.ts and 1 other location - About 1 hr to fix
src/ts/specs/_integration.test.ts on lines 59..63

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

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

    expect(
      newState.SetTimeConstraintState.TotalMatrix.filter(
        (x) => x.Kind === BoxKind.MaybeOccupied
      )
    ).to.have.lengthOf(0);
Severity: Major
Found in src/ts/specs/_integration.test.ts and 1 other location - About 1 hr to fix
src/ts/specs/_integration.test.ts on lines 42..46

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

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

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

            for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
              args[_key] = arguments[_key];
            }
      src/ts/modified_node_modules/react-grid-layout/build/GridItem.js on lines 45..47
      src/ts/modified_node_modules/react-grid-layout/build/ResponsiveReactGridLayout.js on lines 51..53

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

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

          for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
            args[_key] = arguments[_key];
          }
      src/ts/modified_node_modules/react-grid-layout/build/ResponsiveReactGridLayout.js on lines 51..53
      src/ts/modified_node_modules/react-grid-layout/build/components/WidthProvider.js on lines 42..44

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

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

          for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
            args[_key] = arguments[_key];
          }
      src/ts/modified_node_modules/react-grid-layout/build/GridItem.js on lines 45..47
      src/ts/modified_node_modules/react-grid-layout/build/components/WidthProvider.js on lines 42..44

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

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

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

                      function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
                      src/ts/modified_node_modules/react-grid-layout/build/GridItem.js on lines 30..30
                      src/ts/modified_node_modules/react-grid-layout/build/ResponsiveReactGridLayout.js on lines 34..34
                      src/ts/modified_node_modules/react-grid-layout/build/components/WidthProvider.js on lines 24..24

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

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

                      function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
                      src/ts/modified_node_modules/react-grid-layout/build/GridItem.js on lines 30..30
                      src/ts/modified_node_modules/react-grid-layout/build/ReactGridLayout.js on lines 34..34
                      src/ts/modified_node_modules/react-grid-layout/build/components/WidthProvider.js on lines 24..24

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

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

                      function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
                      src/ts/modified_node_modules/react-grid-layout/build/GridItem.js on lines 30..30
                      src/ts/modified_node_modules/react-grid-layout/build/ReactGridLayout.js on lines 34..34
                      src/ts/modified_node_modules/react-grid-layout/build/ResponsiveReactGridLayout.js on lines 34..34

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

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

                      function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
                      src/ts/modified_node_modules/react-grid-layout/build/ReactGridLayout.js on lines 34..34
                      src/ts/modified_node_modules/react-grid-layout/build/ResponsiveReactGridLayout.js on lines 34..34
                      src/ts/modified_node_modules/react-grid-layout/build/components/WidthProvider.js on lines 24..24

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

                      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