Showing 212 of 556 total issues
Function renderModule
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
const renderModule = (plannerModule: PlannerModuleInfo, index: number) => {
const { id, moduleCode, moduleInfo, conflict, placeholder } = plannerModule;
const showExamDate = showModuleMeta && config.academicYear === year;
Function run
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
async run(input: Input) {
this.logger.info(`Collating modules for ${this.academicYear}`);
const { semesterData, aliases } = input;
const combinedAliases = mergeAliases(aliases);
Function NotFoundPage
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
const NotFoundPage: React.FC = () => {
Sentry.withScope(() => {
Sentry.captureMessage('404 - Page Not Found');
});
Function contains_number
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public contains_number(): Contains_numberContext {
let _localctx: Contains_numberContext = new Contains_numberContext(this._ctx, this.state);
this.enterRule(_localctx, 44, NusModsParser.RULE_contains_number);
try {
this.enterOuterAlt(_localctx, 1);
Function TetrisLogo
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
const TetrisLogo: React.FC = () => {
// Create the diagonal bands by offsetting the color using line and char index
// Make the bands move by offsetting the color using time
const currentTime = useCurrentTime(INTERVAL);
const timeOffset = Math.round(currentTime.getTime() / INTERVAL);
Function boolean_expr
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public boolean_expr(): Boolean_exprContext {
let _localctx: Boolean_exprContext = new Boolean_exprContext(this._ctx, this.state);
this.enterRule(_localctx, 8, NusModsParser.RULE_boolean_expr);
let _la: number;
try {
- Read upRead up
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 TimetableContainerComponent
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
export const TimetableContainerComponent: FC = () => {
const params = useParams<Params>();
const semester = semesterForTimetablePage(params.semester);
- Read upRead up
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 verifyLogin
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
(next: Handler): Handler =>
async (req, res): Promise<void> => {
try {
const { user } = await authenticate(req);
// TODO: Augment VercelApiHandler's request with a user object, or find
- Read upRead up
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 process
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function process(rawData) {
const total = rawData.reduce((count, row) => count + row.sum_daily_nb_uniq_visitors, 0);
const output = helpers.getTemplate();
for (const row of rawData) {
- Read upRead up
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 ModuleArchiveContainerComponent
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export const ModuleArchiveContainerComponent: FC = () => {
const [ModulePageContent, setModulePageContent] =
useState<ComponentType<ModulePageContentProps> | null>(null);
const [error, setError] = useState<Error | undefined>();
- Read upRead up
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 createGenericColoredLesson
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
dayText?: DayText,
startTime?: LessonTime,
endTime?: LessonTime,
lessonType?: LessonType,
classNo?: ClassNo,
Consider simplifying this complex logical expression. Open
if (
typeof height !== 'undefined' &&
typeof width !== 'undefined' &&
!Number.isNaN(height) && // accept floats
!Number.isNaN(width) && // accept floats
Consider simplifying this complex logical expression. Open
if (
!module.CourseTitle ||
!module.ModularCredit ||
!module.Subject ||
!module.CatalogNumber ||
Consider simplifying this complex logical expression. Open
if (
typeof height !== 'undefined' &&
typeof width !== 'undefined' &&
!Number.isNaN(height) && // accept floats
!Number.isNaN(width) && // accept floats
Consider simplifying this complex logical expression. Open
if (
((NUSMODS_ENV === 'preview' || NUSMODS_ENV === 'staging' || NUSMODS_ENV === 'production') &&
'serviceWorker' in navigator &&
window.location.protocol === 'https:') ||
// Allow us to force service worker to be enabled for debugging
Function iCalForTimetable
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
semester: Semester,
timetable: SemTimetableConfigWithLessons,
moduleData: { [moduleCode: string]: Module },
hiddenModules: string[],
academicYear: string = config.academicYear,
Function computeUndoStacks
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
state: UndoHistoryState<T> = {
past: [],
present: undefined, // Don't pretend to know the present
future: [],
},
Function createGenericLesson
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
dayText: DayText = 'Monday',
startTime: LessonTime = '0800',
endTime: LessonTime = '1000',
lessonType: LessonType = 'Recitation',
classNo: ClassNo = '1',
Function serializeState
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
semester: Semester,
timetable: SemTimetableConfig,
colorScheme: ColorScheme,
state: State,
options: ExportOptions = {},
Function defaultFallback
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
(methodHandlers: MethodHandlers) =>
async (_req: Request, res: Response): Promise<void> => {
const allowedMethods = Object.entries(methodHandlers).reduce((acc, [method, handler]) => {
if (handler !== undefined) {
if (acc === '') return method;
- Read upRead up
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"