VandyHacks/vaken

View on GitHub

Showing 187 of 200 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

export const createSubmitHandler = (
registerFunction: _Plugin__RegisterNfcuidWithUserMutationFn,
markAttendedFunction: _Plugin__CheckInUserToEventMutationFn,
removeFunction: _Plugin__RemoveUserFromEventMutationFn,
markAttendedByNfcFunction: _Plugin__CheckInUserToEventByNfcMutationFn,
Severity: Major
Found in plugins/nfc/components/helpers.ts and 1 other location - About 4 days to fix
src/client/routes/nfc/helpers.ts on lines 44..145

Similar blocks of code found in 2 locations. Consider refactoring.
Open

export const createSubmitHandler = (
registerFunction: RegisterNfcuidWithUserMutationFn,
markAttendedFunction: CheckInUserToEventMutationFn,
removeFunction: RemoveUserFromEventMutationFn,
markAttendedByNfcFunction: CheckInUserToEventByNfcMutationFn,
Severity: Major
Found in src/client/routes/nfc/helpers.ts and 1 other location - About 4 days to fix
plugins/nfc/components/helpers.ts on lines 44..145

Similar blocks of code found in 2 locations. Consider refactoring.
Open

<TableOptions>
<EventSelect
width="100%"
name="colors"
defaultValue={[EventOptions[0]]}
Severity: Major
Found in plugins/nfc/components/NfcTable.tsx and 1 other location - About 4 days to fix
src/client/routes/nfc/NfcTable.tsx on lines 180..272

Similar blocks of code found in 2 locations. Consider refactoring.
Open

<TableOptions>
<EventSelect
width="100%"
name="colors"
defaultValue={[EventOptions[0]]}
Severity: Major
Found in src/client/routes/nfc/NfcTable.tsx and 1 other location - About 4 days to fix
plugins/nfc/components/NfcTable.tsx on lines 186..278

Similar blocks of code found in 2 locations. Consider refactoring.
Open

export const NfcTableRows = ({
width,
height,
sortedData,
onSortColumnChange,
Severity: Major
Found in src/client/routes/nfc/NfcTableRows.tsx and 1 other location - About 1 day to fix
plugins/nfc/components/NfcTableRows.tsx on lines 90..141

Similar blocks of code found in 2 locations. Consider refactoring.
Open

export const NfcTableRows = ({
width,
height,
sortedData,
onSortColumnChange,
Severity: Major
Found in plugins/nfc/components/NfcTableRows.tsx and 1 other location - About 1 day to fix
src/client/routes/nfc/NfcTableRows.tsx on lines 90..141

Similar blocks of code found in 2 locations. Consider refactoring.
Open

export async function registerNFCUIDWithUser(
nfcID: string,
userID: string,
models: Models
): Promise<UserDbInterface> {
Severity: Major
Found in plugins/nfc/helpers.ts and 1 other location - About 1 day to fix
src/server/nfc/index.ts on lines 37..68

Similar blocks of code found in 2 locations. Consider refactoring.
Open

export async function registerNFCUIDWithUser(
nfcID: string,
userID: string,
models: Models
): Promise<UserDbInterface> {
Severity: Major
Found in src/server/nfc/index.ts and 1 other location - About 1 day to fix
plugins/nfc/helpers.ts on lines 51..82

Similar blocks of code found in 2 locations. Consider refactoring.
Open

export const createMatchCriteria = (searchValue: string) => (hacker: QueriedHacker): boolean => {
let match = true;
searchValue.split(' ').forEach(word => {
// if no words match, return false
if (
Severity: Major
Found in src/client/routes/nfc/helpers.ts and 1 other location - About 1 day to fix
plugins/nfc/components/helpers.ts on lines 15..30

Similar blocks of code found in 2 locations. Consider refactoring.
Open

export const createMatchCriteria = (searchValue: string) => (hacker: QueriedHacker): boolean => {
let match = true;
searchValue.split(' ').forEach(word => {
// if no words match, return false
if (
Severity: Major
Found in plugins/nfc/components/helpers.ts and 1 other location - About 1 day to fix
src/client/routes/nfc/helpers.ts on lines 15..30

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

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

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

Identical blocks of code found in 3 locations. Consider refactoring.
Open

const onSortColumnChange = (ctx: TableCtxI): ((p: SortFnProps) => void) => {
return ({ sortBy, sortDirection }) => {
const { sortBy: prevSortBy, sortDirection: prevSortDirection } = ctx.state;
ctx.update(draft => {
draft.sortBy =
Severity: Major
Found in src/client/routes/nfc/NfcTable.tsx and 2 other locations - About 6 hrs to fix
plugins/nfc/components/NfcTable.tsx on lines 84..97
src/client/routes/manage/HackerTable.tsx on lines 212..225

Identical blocks of code found in 3 locations. Consider refactoring.
Open

const onSortColumnChange = (ctx: TableCtxI): ((p: SortFnProps) => void) => {
return ({ sortBy, sortDirection }) => {
const { sortBy: prevSortBy, sortDirection: prevSortDirection } = ctx.state;
ctx.update(draft => {
draft.sortBy =
Severity: Major
Found in src/client/routes/manage/HackerTable.tsx and 2 other locations - About 6 hrs to fix
plugins/nfc/components/NfcTable.tsx on lines 84..97
src/client/routes/nfc/NfcTable.tsx on lines 80..93

Identical blocks of code found in 3 locations. Consider refactoring.
Open

const onSortColumnChange = (ctx: TableCtxI): ((p: SortFnProps) => void) => {
return ({ sortBy, sortDirection }) => {
const { sortBy: prevSortBy, sortDirection: prevSortDirection } = ctx.state;
ctx.update(draft => {
draft.sortBy =
Severity: Major
Found in plugins/nfc/components/NfcTable.tsx and 2 other locations - About 6 hrs to fix
src/client/routes/manage/HackerTable.tsx on lines 212..225
src/client/routes/nfc/NfcTable.tsx on lines 80..93

Similar blocks of code found in 2 locations. Consider refactoring.
Open

{loading || !data ? (
<Spinner />
) : (
<StyledSelect onChange={e => setTierId(e.target.value)}>
<StyledOption value="" disabled selected>
Severity: Major
Found in src/client/routes/manage/CreateSponsor.tsx and 1 other location - About 5 hrs to fix
src/client/routes/manage/CreateSponsor.tsx on lines 198..211

Similar blocks of code found in 2 locations. Consider refactoring.
Open

{loading || !data ? (
<Spinner />
) : (
<StyledSelect onChange={e => setCompanyId(e.target.value)}>
<StyledOption value="" disabled selected>
Severity: Major
Found in src/client/routes/manage/CreateSponsor.tsx and 1 other location - About 5 hrs to fix
src/client/routes/manage/CreateSponsor.tsx on lines 78..91

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
Severity
Category
Status
Source
Language