pjatk21/alt-api

View on GitHub

Showing 9 of 45 total issues

Function ScheduleViewer has 114 lines of code (exceeds 50 allowed). Consider refactoring.
Open

export function ScheduleViewer() {
// TODO: Why positioning of `useLocalStorage()` can impact avaliablitity of this function?
const [choice, setChoice] = useLocalStorage<ModeChoice>('choice', ModeChoice.UNDEFINED)
const [{ groups, tutors }, setQueryOptions] = useLocalStorage<AltapiQueryOptions>(
'queryOptions',
Severity: Major
Found in alt-api-ui/src/schedule-viewer/ScheduleViewer.tsx - About 3 hrs to fix

Function UniversalPicker has 97 lines of code (exceeds 50 allowed). Consider refactoring.
Open

export default function UniversalPicker(props: UniversalPickerProps<string>) {
const formik = useFormik({
initialValues: {
valueSearch: '',
},
Severity: Major
Found in alt-api-ui/src/schedule-viewer/pickers/UniversalPicker.tsx - About 2 hrs to fix

Function UniversalPicker has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

export default function UniversalPicker(props: UniversalPickerProps<string>) {
const formik = useFormik({
initialValues: {
valueSearch: '',
},
Severity: Minor
Found in alt-api-ui/src/schedule-viewer/pickers/UniversalPicker.tsx - About 1 hr to fix

Function AppHome has 62 lines of code (exceeds 50 allowed). Consider refactoring.
Open

export function AppHome() {
return (
<Container sm>
<Col>
<Spacer />
Severity: Major
Found in alt-api-ui/src/home/AppHome.tsx - About 1 hr to fix

Function ScheduleViewer has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

export function ScheduleViewer() {
// TODO: Why positioning of `useLocalStorage()` can impact avaliablitity of this function?
const [choice, setChoice] = useLocalStorage<ModeChoice>('choice', ModeChoice.UNDEFINED)
const [{ groups, tutors }, setQueryOptions] = useLocalStorage<AltapiQueryOptions>(
'queryOptions',
Severity: Minor
Found in alt-api-ui/src/schedule-viewer/ScheduleViewer.tsx - About 1 hr to fix

Function Scrappers has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

export function Scrappers() {
const { data, error, isLoading, isError } = useQuery('scrappers', getScrappers, {
refetchInterval: 5_000,
retry: false,
})
Severity: Minor
Found in alt-api-ui/src/scrappers/Scrappers.tsx - About 45 mins to fix

Function ScheduleTimeline has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

export function ScheduleTimeline({
date,
queryData,
choice,
dontPrintSummary,
Severity: Minor
Found in alt-api-ui/src/schedule-viewer/ScheduleTimeline.tsx - About 45 mins to fix

Function updateOneEntry has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

async updateOneEntry(htmlId: string, changeHash: string, entry: ScheduleEntryDto) {
const previous = await this.timetableModel.findOne({
'entry.groups': entry.groups,
'entry.begin': entry.begin,
'entry.code': entry.code,
Severity: Minor
Found in src/public-timetable/public-timetable.service.ts - About 35 mins to fix

Avoid too many return statements within this function.
Open

return <p>Ayo?</p>
Severity: Major
Found in alt-api-ui/src/scrappers/Scrappers.tsx - About 30 mins to fix
Severity
Category
Status
Source
Language