wongjiahau/ttap-web

View on GitHub

Showing 211 of 211 total issues

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

  public render() {
    if (!this.props.slots) {
      return false;
    }
    const subjectSummaries = new TimetableSummary(this.props.slots)
Severity: Minor
Found in src/ts/react/timetableSummaryView.tsx - About 1 hr to fix

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

    const mapStateToProps = (state: any): ISaveTimetableDialogStateProps => {
      const target = state.MasterStateReducer
        .SaveTimetableDialogState as ISaveTimetableDialogState;
      return {
        isGetDateDialogOpen: target.IsGetDateDialogOpen,
    Severity: Major
    Found in src/ts/redux/containers/saveTimetableDialogContainer.ts and 1 other location - About 1 hr to fix
    src/ts/redux/containers/snackbarContainer.ts on lines 10..16

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

    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

    const mapStateToProps = (state: any): ISnackbarViewStateProps => {
      const target = state.MasterStateReducer.SnackbarState as ISnackbarState;
      return {
        isOpen: target.IsOpen,
        message: target.Message,
    Severity: Major
    Found in src/ts/redux/containers/snackbarContainer.ts and 1 other location - About 1 hr to fix
    src/ts/redux/containers/saveTimetableDialogContainer.ts on lines 16..23

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

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

    var WidthProvider = function WidthProvider(ComposedComponent) {
      var _class, _temp2;
    
      return _temp2 = _class = function (_React$Component) {
        _inherits(_class, _React$Component);

      Function onDragHandler has 38 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        GridItem.prototype.onDragHandler = function onDragHandler(handlerName) {
          var _this2 = this;
      
          return function (e, _ref2) {
            var node = _ref2.node,
      Severity: Minor
      Found in src/ts/modified_node_modules/react-grid-layout/build/GridItem.js - About 1 hr to fix

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

            var _props3 = this.props,
                margin = _props3.margin,
                cols = _props3.cols,
                rowHeight = _props3.rowHeight,
                w = _props3.w,
        src/ts/modified_node_modules/react-grid-layout/build/GridItem.js on lines 156..162

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

        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 _props4 = this.props,
                margin = _props4.margin,
                maxRows = _props4.maxRows,
                cols = _props4.cols,
                rowHeight = _props4.rowHeight,
        src/ts/modified_node_modules/react-grid-layout/build/GridItem.js on lines 118..124

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

        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 GenerateNewState has 36 lines of code (exceeds 25 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 1 hr to fix

          Function compactItem has a Cognitive Complexity of 12 (exceeds 5 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

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

          function validateLayout(layout, contextName) {
            contextName = contextName || "Layout";
            var subProps = ['x', 'y', 'w', 'h'];
            if (!Array.isArray(layout)) throw new Error(contextName + " must be an array!");
            for (var _i8 = 0, len = layout.length; _i8 < len; _i8++) {
          Severity: Minor
          Found in src/ts/modified_node_modules/react-grid-layout/build/utils.js - 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 render has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            public render() {
              if (this.state.redirect) {
                return <Redirect push={true} to="/play" />;
              }
              return (
          Severity: Minor
          Found in src/ts/react/fgoView.tsx - About 1 hr to fix

            Function OtherStuffDrawer has 35 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export const OtherStuffDrawer = (props: IOtherStuffDrawerProps) => {
              const routerLink = (icon: any, text: string, to: string) => (
                <Link style={linkStyle} to={to}>
                  <ListItem button={true} onClick={props.onItemClick}>
                    <ListItemIcon>{icon}</ListItemIcon>
            Severity: Minor
            Found in src/ts/react/otherStuffDrawer.tsx - About 1 hr to fix

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

              export function FindTimetableByConsideringWeekNumber(
                rawSlots: RawSlot[],
                disableClashChecking = false,
                visualizer?: FindTimetableVisualizer<IOptimizedSlot>
              ): Timetable[] {
              Severity: Major
              Found in src/ts/permutator/findTimetable.ts and 1 other location - About 1 hr to fix
              src/ts/permutator/findTimetable.ts on lines 127..137

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

              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 function FindTimetableWithoutConsideringWeekNumber(
                rawSlots: RawSlot[],
                disableClashChecking = false,
                visualizer?: FindTimetableVisualizer<IOptimizedSlot>
              ): Timetable[] {
              Severity: Major
              Found in src/ts/permutator/findTimetable.ts and 1 other location - About 1 hr to fix
              src/ts/permutator/findTimetable.ts on lines 139..149

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

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

                protected Save(timetable: Timetable) {
                  let html = (document.getElementById("timetable-view") as HTMLElement)
                    .outerHTML;
                  html = html.replace("display: none", "display: inline"); // display timetable summary
                  const data = `
              Severity: Minor
              Found in src/ts/redux/actions/saveTimetable/saveTimetableAsHtml.ts - About 1 hr to fix

                Function ReleaseDisabledSubjectsIfPossible has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export function ReleaseDisabledSubjectsIfPossible(
                  selectedSubjects: Subject[],
                  allSubjects: Subject[]
                ): void {
                  const disabledSubjects = allSubjects.filter((s) => s.ClashReport !== null);
                Severity: Minor
                Found in src/ts/redux/actions/toggleSubjectSelection.ts - About 1 hr to fix

                  Function StackPanelProofOfConcept has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export const StackPanelProofOfConcept = () => {
                    return (
                      <div>
                        <StackPanel
                          style={{
                  Severity: Minor
                  Found in src/ts/react/panels/stackPanelProofOfConcept.tsx - About 1 hr to fix

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

                          <StackPanel orientation="horizontal" horizontalAlignment="center">
                            <p>center aligned</p>
                            <button>hello</button>
                            <button>bye</button>
                          </StackPanel>
                    Severity: Major
                    Found in src/ts/react/panels/stackPanelProofOfConcept.tsx and 2 other locations - About 1 hr to fix
                    src/ts/react/panels/stackPanelProofOfConcept.tsx on lines 20..24
                    src/ts/react/panels/stackPanelProofOfConcept.tsx on lines 30..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 61.

                    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

                          <StackPanel orientation="horizontal" horizontalAlignment="left">
                            <p>Left aligned</p>
                            <button>hello</button>
                            <button>bye</button>
                          </StackPanel>
                    Severity: Major
                    Found in src/ts/react/panels/stackPanelProofOfConcept.tsx and 2 other locations - About 1 hr to fix
                    src/ts/react/panels/stackPanelProofOfConcept.tsx on lines 20..24
                    src/ts/react/panels/stackPanelProofOfConcept.tsx on lines 25..29

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

                    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

                          <StackPanel orientation="horizontal" horizontalAlignment="right">
                            <p>right aligned</p>
                            <button>hello</button>
                            <button>bye</button>
                          </StackPanel>
                    Severity: Major
                    Found in src/ts/react/panels/stackPanelProofOfConcept.tsx and 2 other locations - About 1 hr to fix
                    src/ts/react/panels/stackPanelProofOfConcept.tsx on lines 25..29
                    src/ts/react/panels/stackPanelProofOfConcept.tsx on lines 30..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 61.

                    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