ahbeng/NUSMods

View on GitHub

Showing 212 of 556 total issues

Avoid too many return statements within this function.
Open

  return null;
Severity: Major
Found in packages/nusmoderator/src/academicCalendar.ts - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

      return null;
    Severity: Major
    Found in website/src/views/components/icons/weather.ts - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

        return <LoadingSpinner />;
      Severity: Major
      Found in website/src/views/modules/ModuleArchiveContainer.tsx - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

            return Wind;
        Severity: Major
        Found in website/src/views/components/icons/weather.ts - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                return {
                  past: [...past, present],
                  present: next,
                  future: newFuture,
                };
          Severity: Major
          Found in website/src/reducers/undoHistory.ts - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                  return produce(state, (draft) => {
                    draft.hidden[semester] = hiddenModules;
                  });
            Severity: Major
            Found in website/src/reducers/timetables.ts - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                    if (requiredCount === 1 && options.length === 1) return [options[0]];
              Severity: Major
              Found in website/src/utils/planner.ts - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                      return [fragment];
                Severity: Major
                Found in website/src/utils/planner.ts - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                        return state;
                  Severity: Major
                  Found in website/src/reducers/moduleBank.ts - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                        return assertNever(fragment);
                    Severity: Major
                    Found in website/src/utils/planner.ts - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                          return assertNever(conflict);
                      Severity: Major
                      Found in website/src/utils/planner.ts - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                          return `Weeks ${processed.join(', ')}`;
                        Severity: Major
                        Found in website/src/utils/timetables.ts - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                return {
                                  ...state,
                                  lessons: { [semester]: timetable },
                                  colors: { [semester]: colors },
                                  hidden: { [semester]: hidden },
                          Severity: Major
                          Found in website/src/reducers/timetables.ts - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                  return state;
                            Severity: Major
                            Found in website/src/reducers/undoHistory.ts - About 30 mins to fix

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

                                  public program_types(): Program_typesContext {
                                      let _localctx: Program_typesContext = new Program_typesContext(this._ctx, this.state);
                                      this.enterRule(_localctx, 2, NusModsParser.RULE_program_types);
                                      let _la: number;
                                      try {
                              Severity: Minor
                              Found in scrapers/nus-v2/src/services/requisite-tree/antlr4/NusModsParser.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 ExportMenuComponent has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                              Open

                              const ExportMenuComponent: React.FC<Props> = ({ semester, timetable }) => {
                                const [isMacWarningOpen, setIsMacWarningOpen] = useState(false);
                              
                                const dispatch = useDispatch();
                                const state = useSelector((storeState: State) => storeState);
                              Severity: Minor
                              Found in website/src/views/timetable/ExportMenu.tsx - 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 ModulePageContent has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                              Open

                              const ModulePageContent: React.FC<Props> = ({ module, archiveYear }) => {
                                const [isMenuOpen, setIsMenuOpen] = useState(false);
                              
                                const { moduleCode, title } = module;
                              
                              
                              Severity: Minor
                              Found in website/src/views/modules/ModulePageContent.tsx - 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 getDuplicateModules has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                              Open

                              export function getDuplicateModules(classes: VenueLesson[]): ModuleCode[] {
                                const lessonsByTime: VenueLesson[][] = values(
                                  groupBy(classes, (lesson) => [lesson.startTime, lesson.endTime, lesson.weeks, lesson.day]),
                                );
                              
                              
                              Severity: Minor
                              Found in scrapers/nus-v2/src/utils/data.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 parse has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                              Open

                              function parse(data: ModuleWithoutTree[], subLogger: Logger): PrereqTreeMap {
                                const results: PrereqTreeMap = {};
                              
                                for (const module of data) {
                                  const { moduleCode, prerequisiteRule: value } = module;
                              Severity: Minor
                              Found in scrapers/nus-v2/src/services/requisite-tree/index.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 ExamWeekComponent has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                              Open

                              const ExamWeekComponent: React.FC<Props> = (props) => {
                                const { modules, weekNumber, firstDayOfExams, days } = props;
                                const currentTime = useCurrentTime();
                              
                                // Array of dates to display
                              Severity: Minor
                              Found in website/src/views/timetable/ExamWeek.tsx - 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