Showing 212 of 556 total issues
Function renderConflict
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const renderConflict = (conflict: Conflict) => {
switch (conflict.type) {
case 'noInfo':
return (
<div className={styles.conflictHeader}>
Function Navtabs
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const Navtabs: FC = () => {
const activeSemester = useSelector(({ app }: State) => app.activeSemester);
const tabProps = {
className: styles.link,
Function renderType
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function renderType(type: EmptyGroupType) {
switch (type) {
case 'winter':
return (
<>
Function program_types
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
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 {
Function ModuleTreeComponent
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const ModuleTreeComponent: React.FC<Props> = (props) => {
const { fulfillRequirements, prereqTree, moduleCode } = props;
return (
<>
File ical.test.ts
has 262 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { EventOption } from 'ical-generator';
import config from 'config';
import iCalForTimetable, {
calculateNumericWeek,
calculateWeekRange,
Function createIndex
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async function createIndex(client: Client): Promise<Client> {
try {
await client.indices.create({
index: INDEX_NAME,
body: {
Function makeExportHandler
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
Open
export function makeExportHandler<T>(
parseExportData: (request: VercelRequest) => T,
performExport: (response: VercelResponse, page: Page, data: T) => void | Promise<void>,
): VercelApiHandler {
return async function handler(request, response) {
- 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 op
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public op(): OpContext {
let _localctx: OpContext = new OpContext(this._ctx, this.state);
this.enterRule(_localctx, 10, NusModsParser.RULE_op);
try {
this.state = 93;
Function exports
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = (api) => {
api.cache.using(() => process.env.NODE_ENV);
const IS_PROD = api.env('production');
const IS_DEV = api.env('development');
Function timetables
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function timetables(
state: TimetablesState = defaultTimetableState,
action: Actions,
): TimetablesState {
// All normal timetable actions should specify their semester
File academicCalendar.test.ts
has 254 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import {
getAcadYearStartDate,
getAcadYear,
getAcadSem,
getAcadWeekName,
Function PlannerModule
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
Open
const PlannerModule = memo<Props>((props) => {
const [isEditingPlaceholder, setEditingPlaceholder] = useState(false);
const removeModule = () => props.removeModule(props.id);
- 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
File GetSemesterData.ts
has 253 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { strict as assert } from 'assert';
import { each, fromPairs, keyBy, isEmpty } from 'lodash';
import type { AcademicGrp, AcademicOrg, ModuleAttributeEntry, ModuleInfo } from '../types/api';
import type {
Function ExamWeekComponent
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const ExamWeekComponent: React.FC<Props> = (props) => {
const { modules, weekNumber, firstDayOfExams, days } = props;
const currentTime = useCurrentTime();
// Array of dates to display
Function ArrivalTimes
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const ArrivalTimes = memo<Props>((props: Props) => {
if (props.error) {
return (
<>
<h3 className={styles.heading}>{props.name}</h3>
Function special_condition
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public special_condition(): Special_conditionContext {
let _localctx: Special_conditionContext = new Special_conditionContext(this._ctx, this.state);
this.enterRule(_localctx, 30, NusModsParser.RULE_special_condition);
try {
this.state = 171;
Function compound
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public compound(): CompoundContext {
let _localctx: CompoundContext = new CompoundContext(this._ctx, this.state);
this.enterRule(_localctx, 4, NusModsParser.RULE_compound);
try {
this.state = 77;
Function programs_condition
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public programs_condition(): Programs_conditionContext {
let _localctx: Programs_conditionContext = new Programs_conditionContext(this._ctx, this.state);
this.enterRule(_localctx, 16, NusModsParser.RULE_programs_condition);
try {
this.state = 117;
Function plan_types_condition
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public plan_types_condition(): Plan_types_conditionContext {
let _localctx: Plan_types_conditionContext = new Plan_types_conditionContext(this._ctx, this.state);
this.enterRule(_localctx, 22, NusModsParser.RULE_plan_types_condition);
try {
this.state = 138;