VandyHacks/vaken

View on GitHub

Showing 69 of 200 total issues

Function recomputeHackerEventScores has 54 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const recomputeHackerEventScores = async (
    models: Models,
    writeResultsToDB = false
): Promise<void> => {
    let bestScore = 0;
Severity: Major
Found in scripts/recomputeEventScores.ts - About 2 hrs to fix

Function CreateCompany has 51 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const CreateCompany: React.FunctionComponent = (): JSX.Element => {
    const [companyName, setCompanyName] = useState('');
    const [tierId, setTierId] = useState('');
    const [createCompanyMsg, setCreateCompanyMsg] = useState('');

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

Function updateMyApplication has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Confirmed

export const updateMyApplication: MutationResolvers['updateMyApplication'] = async (
    root,
    { input },
    { user, models }
) => {
Severity: Minor
Found in src/server/resolvers/MutationResolvers/updateApplicationResolver.ts - About 1 hr 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 47 lines of code (exceeds 25 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 1 hr to fix

Function checkInUserToEvent has 47 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export async function checkInUserToEvent(
    userID: string,
    eventID: string,
    models: Models
): Promise<UserDbInterface> {
Severity: Minor
Found in src/server/nfc/index.ts - About 1 hr to fix

Function addOrUpdateEvent has 44 lines of code (exceeds 25 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 1 hr to fix

Function CreateTier has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const CreateTier: React.FC = () => {
    const [tierName, setTierName] = useState('');
    const [permissions, setPermissions] = useState(['']);
    const [createTierMsg, setCreateTierMsg] = useState('');

Severity: Minor
Found in src/client/routes/manage/CreateSponsor.tsx - About 1 hr to fix

Function Nfc has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

export const Nfc: FunctionComponent = (): JSX.Element => {
    const [tableState, updateTableState] = useImmer(defaultTableState);
    const hackers = useHackersQuery();
    const events = useEventsQuery();
    const loggedInUser = useMeSponsorQuery();
Severity: Minor
Found in src/client/routes/nfc/Nfc.tsx - About 1 hr 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 37 lines of code (exceeds 25 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 1 hr to fix

Function addHackers has 36 lines of code (exceeds 25 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 1 hr to fix

Function Nfc has a Cognitive Complexity of 12 (exceeds 5 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: Minor
Found in plugins/nfc/components/Nfc.tsx - About 1 hr 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 JoinTeam has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const JoinTeam: FC = () => {
    const [searchValue, setSearchValue] = useState('');
    const [errorMsg, setErrorMsg] = useState('');
    const [joinTeam] = useJoinTeamMutation({ variables: { input: { name: searchValue } } });

Severity: Minor
Found in src/client/routes/team/JoinTeam.tsx - About 1 hr to fix

Function removeUserFromEvent has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export async function removeUserFromEvent(
    userID: string,
    eventID: string,
    models: Models
): Promise<UserDbInterface> {
Severity: Minor
Found in src/server/nfc/index.ts - About 1 hr to fix

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

export const Nfc: FunctionComponent = (): JSX.Element => {
    const [tableState, updateTableState] = useImmer(defaultTableState);
    const hackers = useHackersQuery();
    const events = useEventsQuery();
    const loggedInUser = useMeSponsorQuery();
Severity: Minor
Found in src/client/routes/nfc/Nfc.tsx - About 1 hr to fix

Function Application has a Cognitive Complexity of 11 (exceeds 5 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: Minor
Found in src/client/routes/application/Application.tsx - About 1 hr 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 assignEventToCompany has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export async function assignEventToCompany(
    eventID: string,
    companyID: string,
    models: Models
): Promise<EventDbObject> {
Severity: Minor
Found in src/server/events/index.ts - About 1 hr to fix

Function Vaken has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const Vaken: React.FunctionComponent = (): JSX.Element => {
    const [ready, setReady] = useState(false);
    const { data, error, loading } = useMeQuery();

    const StateMachine: React.FunctionComponent = (): JSX.Element | null => {
Severity: Minor
Found in src/client/app.tsx - About 1 hr to fix

Function removeUserFromEvent has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export async function removeUserFromEvent(
    userID: string,
    eventID: string,
    models: Models
): Promise<UserDbInterface> {
Severity: Minor
Found in plugins/nfc/helpers.ts - About 1 hr to fix

Function updateEventsHandler has 29 lines of code (exceeds 25 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 1 hr to fix

Function checkInUserToEvent has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export async function checkInUserToEvent(
    userID: string,
    eventID: string,
    models: Models
): Promise<UserDbInterface> {
Severity: Minor
Found in plugins/nfc/helpers.ts - About 1 hr to fix
Severity
Category
Status
Source
Language