VandyHacks/vaken

View on GitHub

Showing 69 of 200 total issues

Avoid too many return statements within this function.
Open

    return (
        <FloatingPopup borderRadius="1rem" height="100%" backgroundOpacity="1" padding="1.5rem">
            <TableContext.Provider value={{ state: tableState, update: updateTableState }}>
                <NfcTable hackersData={hackersData.hackers} eventsData={eventsCurrent} />
            </TableContext.Provider>
Severity: Major
Found in plugins/nfc/components/Nfc.tsx - About 30 mins to fix

Avoid too many return statements within this function.
Open

    return (
        <FloatingPopup borderRadius="1rem" height="100%" backgroundOpacity="1" padding="1.5rem">
            <TableContext.Provider value={{ state: tableState, update: updateTableState }}>
                <NfcTable hackersData={hackers.data?.hackers ?? []} eventsData={ongoingEvents ?? []} />
            </TableContext.Provider>
Severity: Major
Found in src/client/routes/nfc/Nfc.tsx - About 30 mins to fix

Avoid too many return statements within this function.
Open

        return <p>You dont have permissions to scan NFCs</p>;
Severity: Major
Found in plugins/nfc/components/Nfc.tsx - About 30 mins to fix

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

const addHackers = async (): Promise<void> => {
    const models = await new DB().collections;
    console.log('Connected to DB');
    const newHackers: HackerDbObject[] = [];
    for (let i = 1; i <= NUM_HACKERS; i += 1) {
Severity: Minor
Found in scripts/populateDb.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 CheckInEvent has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export const CheckInEvent: FC = () => {
    const events = useEventsForHackersQuery();
    const hacker = useMyEventStatusQuery();
    const [checkIn] = useCheckInUserToEventAndUpdateEventScoreMutation();
    const onCheckIn = useMemo(() => getOnCheckIn(checkIn), [checkIn]);
Severity: Minor
Found in src/client/routes/events/CheckInEvents.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 FileInput has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export const FileInput: FC<InputProps> = props => {
    const [file, setFile] = useState<File>();
    const [getSignedUploadUrl] = useSignedUploadUrlMutation();
    const [uploaded, setUploaded] = useState(false);
    const [loading, toggleLoading] = useState(false);
Severity: Minor
Found in src/client/components/Input/FileInput.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 updateEventsHandler has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export async function updateEventsHandler(
    events: null | EventUpdate[],
    addOrUpdateEvent: AddOrUpdateEventMutationHookResult[0],
    removeAbsentEvents: RemoveAbsentEventsMutationHookResult[0]
): Promise<string[]> {
Severity: Minor
Found in src/client/routes/events/helpers.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 addOrUpdateEvent has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export async function addOrUpdateEvent(
    eventInput: EventUpdateInput,
    models: Models
): Promise<EventDbObject> {
    if (!eventInput.id && !eventInput.gcalID)
Severity: Minor
Found in src/server/events/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 SponsorHackerView has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export const SponsorHackerView: FC = () => {
    const { loading, error, data } = useHackersQuery();
    const [tableState, updateTableState] = useImmer(defaultTableState);
    const sponsor = useMeSponsorQuery();
    const now = Date.now();
Severity: Minor
Found in src/client/routes/manage/SponsorHackerView.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