wongjiahau/ttap-web

View on GitHub

Showing 125 of 211 total issues

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

    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

          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

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

                  protected GenerateNewState(state: IMasterState): IMasterState {
                    const newClickedTimeConstraint =
                      state.SetTimeConstraintState.ClickedTimeConstraint.slice();
                    newClickedTimeConstraint[this.clickedBox.Day] ^= this.clickedBox.TimePeriod;
                    const newUidsOfClickedBox =
                Severity: Minor
                Found in src/ts/redux/actions/defilterTimetable.ts - About 1 hr to fix

                  Function mapDispatchToProps has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  const mapDispatchToProps = (dispatch: any): ITimetableListViewDispatchProps => {
                    const triggerfulDispatch = (action: MasterStateAction) => {
                      dispatch(action);
                      dispatch(new FindAlternativeSlotsOfCurrentSlots());
                    };
                  Severity: Minor
                  Found in src/ts/redux/containers/timetableListContainer.ts - About 1 hr to fix

                    Function SelectSubject has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

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

                      Function ParseRawSlotToSubject has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export function ParseRawSlotToSubject(slots: RawSlot[]): Subject[] {
                        const result = Array<Subject>();
                        const dic = new Array<IKeyValue<string, RawSlot[]>>();
                        slots
                          .filter((x) => IsReasonable(x) && IsParsable(x))
                      Severity: Minor
                      Found in src/ts/parser/parseRawSlotToSubject.ts - About 1 hr to fix

                        Function CreateEvent has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export function CreateEvent(slot: RawSlot, semesterStartDate: Date) {
                          const semStartDate = new Date(semesterStartDate.getTime());
                          if (semStartDate.getDay() !== 1) {
                            throw new Error(
                              "Expected semesterStartDay to be Monday but was " +
                        Severity: Minor
                        Found in src/ts/redux/actions/saveTimetable/saveTimetableAsGoogleCalendar.ts - About 1 hr to fix

                          Function correctBounds has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                          Open

                          function correctBounds(layout, bounds) {
                            var collidesWith = getStatics(layout);
                            for (var _i4 = 0, len = layout.length; _i4 < len; _i4++) {
                              var l = layout[_i4];
                              // Overflows right
                          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 GenerateSlotAndDayLayouts has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          export function GenerateSlotAndDayLayouts(
                            rawSlots: ISlotViewModel[],
                            xOffset: number,
                            yOffset: number
                          ): [ReactGridLayout.Layout[], ReactGridLayout.Layout[]] {
                          Severity: Minor
                          Found in src/ts/react/timetableView/generateSlotAndDayLayouts.ts - About 1 hr to fix

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

                              Function placeholder has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                ReactGridLayout.prototype.placeholder = function placeholder() {
                                  var activeDrag = this.state.activeDrag;
                              
                                  if (!activeDrag) return null;
                                  var _props3 = this.props,

                                Function slotViews has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                  const slotViews = slots.map((x, index) => {
                                    return (
                                      // "s" means "Slot"
                                      <div key={"s" + index}>
                                        <SlotView
                                Severity: Minor
                                Found in src/ts/react/timetableView/generateSlotViewsAndDayColumn.tsx - About 1 hr to fix

                                  Function GeneralizeSlot has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  export function GeneralizeSlot(originalSlots: RawSlot[]): RawSlot[] {
                                    const slots = originalSlots.map(clone) as IRawSlot[];
                                    const results = new Array<RawSlot>();
                                    results.push(slots[0]);
                                    let generalized: boolean;
                                  Severity: Minor
                                  Found in src/ts/permutator/generalizeSlot.ts - About 1 hr to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language