VandyHacks/vaken

View on GitHub

Showing 69 of 200 total issues

Function createSubmitHandler has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring.
Open

export const createSubmitHandler = (
    registerFunction: RegisterNfcuidWithUserMutationFn,
    markAttendedFunction: CheckInUserToEventMutationFn,
    removeFunction: RemoveUserFromEventMutationFn,
    markAttendedByNfcFunction: CheckInUserToEventByNfcMutationFn,
Severity: Minor
Found in src/client/routes/nfc/helpers.ts - About 7 hrs 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 createSubmitHandler has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring.
Open

export const createSubmitHandler = (
    registerFunction: _Plugin__RegisterNfcuidWithUserMutationFn,
    markAttendedFunction: _Plugin__CheckInUserToEventMutationFn,
    removeFunction: _Plugin__RemoveUserFromEventMutationFn,
    markAttendedByNfcFunction: _Plugin__CheckInUserToEventByNfcMutationFn,
Severity: Minor
Found in plugins/nfc/components/helpers.ts - About 7 hrs 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

File HackerTable.tsx has 437 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import React, { useContext, useState, useEffect, useRef, FC } from 'react';
import { AutoSizer, SortDirection } from 'react-virtualized';
import 'react-virtualized/styles.css';
import styled from 'styled-components';
import Select from 'react-select';
Severity: Minor
Found in src/client/routes/manage/HackerTable.tsx - About 6 hrs to fix

Function Application has 129 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const Application: FunctionComponent = (): JSX.Element => {
    const { update: setActionButton } = useContext(ActionButtonContext);
    const [openSection, setOpenSection] = useState('');
    const [input, setInput] = useImmer<{ answer: string; question: string }[]>([]);
    const [loaded, setLoaded] = useState(false);
Severity: Major
Found in src/client/routes/application/Application.tsx - About 5 hrs to fix

Function RadioSlider has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

export const RadioSlider: FC<Props> = (props: Props) => {
    const { option1, option2, option3, disable = false, confirmMessageFunc } = props;
    const [selected, setSelected] = useState(option2);
    const [width, setWidth] = useState(0);
    const [left, setLeft] = useState(0);
Severity: Minor
Found in src/client/components/Buttons/RadioSlider.tsx - About 4 hrs 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 RadioSlider has 102 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const RadioSlider: FC<Props> = (props: Props) => {
    const { option1, option2, option3, disable = false, confirmMessageFunc } = props;
    const [selected, setSelected] = useState(option2);
    const [width, setWidth] = useState(0);
    const [left, setLeft] = useState(0);
Severity: Major
Found in src/client/components/Buttons/RadioSlider.tsx - About 4 hrs to fix

Function HackerDash has 90 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const HackerDash: FunctionComponent = (): JSX.Element => {
    const { data, loading } = useMyStatusQuery();
    const [statusInfo, setStatusInfo] = useState(statusConfig[ApplicationStatus.Created]);
    const [confirmMySpot] = useConfirmMySpotMutation();
    const [declineMySpot] = useDeclineMySpotMutation();
Severity: Major
Found in src/client/routes/dashboard/HackerDash.tsx - About 3 hrs to fix

Function ManageEvents has 88 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const ManageEvents: FunctionComponent = (): JSX.Element => {
    const [output, setOutput] = useState('No updates to report');
    const [addOrUpdateEvent] = useAddOrUpdateEventMutation();
    const [removeAbsentEvents] = useRemoveAbsentEventsMutation();
    const [assignEventToCompany] = useAssignEventToCompanyMutation();
Severity: Major
Found in src/client/routes/events/ManageEvents.tsx - About 3 hrs to fix

Function createSubmitHandler has 87 lines of code (exceeds 25 allowed). Consider refactoring.
Open

) => async (nfc: string, user: string, event: QueriedEvent, unadmit: boolean): Promise<boolean> => {
    console.log([nfc, user, event, unadmit]);
    let toastMsg = '';
    try {
        if (event.eventType === CHECK_IN_EVENT_TYPE) {
Severity: Major
Found in plugins/nfc/components/helpers.ts - About 3 hrs to fix

Function createSubmitHandler has 87 lines of code (exceeds 25 allowed). Consider refactoring.
Open

) => async (nfc: string, user: string, event: QueriedEvent, unadmit: boolean): Promise<boolean> => {
    console.log([nfc, user, event, unadmit]);
    let toastMsg = '';
    try {
        if (event.eventType === CHECK_IN_EVENT_TYPE) {
Severity: Major
Found in src/client/routes/nfc/helpers.ts - About 3 hrs to fix

Function Profile has 72 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const Profile: React.FunctionComponent = (): JSX.Element => {
    const { update: setActionButton } = useContext(ActionButtonContext);
    const { data, loading, error } = useMyProfileQuery();
    const [loaded, setLoaded] = useState(false);
    const [input, setInput] = useImmer<UserInput>({});
Severity: Major
Found in src/client/routes/profile/Profile.tsx - About 2 hrs to fix

Function constructor has 71 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    constructor() {
        this.schema = schema;
        this.resolvers = {
            _Plugin__Event: {
                attendees: async event => (await event).attendees || [],
Severity: Major
Found in plugins/nfc/server.ts - About 2 hrs to fix

Function FileInput has 69 lines of code (exceeds 25 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: Major
Found in src/client/components/Input/FileInput.tsx - About 2 hrs to fix

Function HackerTable has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

const HackerTable: FC<HackerTableProps> = ({
    data,
    isSponsor = false,
    viewResumes = false,
}: HackerTableProps): JSX.Element => {
Severity: Minor
Found in src/client/routes/manage/HackerTable.tsx - About 2 hrs 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 CreateSponsor has 62 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const CreateSponsor: React.FunctionComponent = (): JSX.Element => {
    const [sponsorEmail, setSponsorEmail] = useState('');
    const [sponsorName, setSponsorName] = useState('');
    const [companyId, setCompanyId] = useState('');
    const [createSponsorMsg, setCreateSponsorMsg] = useState('');
Severity: Major
Found in src/client/routes/manage/CreateSponsor.tsx - About 2 hrs to fix

File NfcTable.tsx has 269 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import React, { useContext, useState, useEffect, FC } from 'react';
import { AutoSizer, SortDirection, RowMouseEventHandlerParams } from 'react-virtualized';
import 'react-virtualized/styles.css';
import styled from 'styled-components';
import Select from 'react-select';
Severity: Minor
Found in plugins/nfc/components/NfcTable.tsx - About 2 hrs to fix

Function HackerView has 59 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const HackerView: FC<HackerViewProps> = props => {
    const { match } = props;
    const { data, loading, error } = useDetailedHackerQuery({ variables: { id: match.params.id } });
    const fileReadUrlQuery = useSignedReadUrlQuery({
        variables: { input: (data && data.hacker.id) || '' },
Severity: Major
Found in src/client/routes/manage/HackerView.tsx - About 2 hrs to fix

Function Frame has 59 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const Frame: FunctionComponent = (): JSX.Element => {
    const currentUser = useContext(AuthContext);
    const [ActionButton, setActionButton] = useState<React.ReactNode>(null);
    const [menuOpen, setMenuOpen] = useState(false);

Severity: Major
Found in src/client/routes/dashboard/Frame.tsx - About 2 hrs to fix

Function Nfc has 58 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const Nfc: FunctionComponent = (): JSX.Element => {
    const hackers = useHackersQuery();
    const hackersLoading = hackers.loading;
    const hackersError = hackers.error;
    const hackersData = hackers.data;
Severity: Major
Found in plugins/nfc/components/Nfc.tsx - About 2 hrs to fix

File NfcTable.tsx has 262 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import React, { useContext, useState, useEffect, FC, useCallback } from 'react';
import { AutoSizer, SortDirection, RowMouseEventHandlerParams } from 'react-virtualized';
import 'react-virtualized/styles.css';
import styled from 'styled-components';
import Select from 'react-select';
Severity: Minor
Found in src/client/routes/nfc/NfcTable.tsx - About 2 hrs to fix
Severity
Category
Status
Source
Language