Showing 212 of 556 total issues
Function mergeDualCodedModules
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export function mergeDualCodedModules(classes: VenueLesson[]): {
lessons: VenueLesson[];
aliases: ModuleAliases;
} {
// Repeatedly merge lessons that occupy the same space in the timetable
- 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 buildFacultyMap
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function buildFacultyMap(departments: AcademicOrg[], faculties: AcademicGrp[]) {
const departmentFaculty: Record<string, string> = {};
// Map departments to their corresponding faculty. This works because the first three chars of
// the department code (AcademicOrganization) matches the faculty code (AcademicGroup)
- 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 compound
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public compound(): CompoundContext {
let _localctx: CompoundContext = new CompoundContext(this._ctx, this.state);
this.enterRule(_localctx, 4, NusModsParser.RULE_compound);
try {
this.state = 77;
- 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 mapLessonWeeks
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export function mapLessonWeeks(dates: string[], semester: number, logger: Logger): Weeks {
// Sanity check for lessons occurring on duplicate days
if (dates.length !== new Set(dates).size) {
logger.error('Lesson has duplicate dates');
}
- 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 removeCompleteRows
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export function removeCompleteRows(board: Board) {
let rowsCleared = 0;
const newBoard = produce(board, (draft: Board) => {
// TODO: Optimize based on where the piece has landed
- 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 getAcadWeekName
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export function getAcadWeekName(acadWeekNumber: number): AcadWeek | null {
switch (acadWeekNumber) {
case 7:
return {
weekType: 'Recess',
- 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 authenticate
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const authenticate = async (req: Request) => {
const tokenProvided = req.headers.authorization || (req.body && req.body.SAMLResponse);
if (!tokenProvided) {
throw new Error(errors.noTokenSupplied);
}
- 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 TimetableCell
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const TimetableCell: React.FC<Props> = (props) => {
const { lesson, showTitle, onClick, onHover, hoverLesson, transparent } = props;
const moduleName = showTitle ? `${lesson.moduleCode} ${lesson.title}` : lesson.moduleCode;
const Cell = props.onClick ? 'button' : 'div';
- 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 env
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
exports.env = () => {
if (process.env.NODE_ENV === 'test') return 'test';
// Vercel deployments
if (process.env.VERCEL_ENV === 'production') return 'production';
- 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 getFileSystemWriter
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export function getFileSystemWriter(academicYear: string): Persist {
const yearRoot = getFileRoot(academicYear);
// Directory structure
//
- 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 planner
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export default function planner(
state: PlannerState = defaultPlannerState,
action: Actions,
): PlannerState {
switch (action.type) {
- 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 DayEvents
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const DayEvents = React.memo<Props>((props) => {
const renderLesson = (lesson: ColoredLesson, i: number) => {
const { openLesson, onOpenLesson, marker, date } = props;
const isOpen =
- 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"