VandyHacks/vaken

View on GitHub

Showing 69 of 200 total issues

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

const NfcTable: FC<NfcTableProps> = ({ hackersData, eventsData }: NfcTableProps): JSX.Element => {
    const EventOptions: { label: string; value: string }[] = eventsData.map(event => {
        return {
            label: event.name,
            value: event.id,
Severity: Minor
Found in plugins/nfc/components/NfcTable.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 NfcTable has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

const NfcTable: FC<Props> = ({ hackersData, eventsData }): JSX.Element => {
    const EventOptions: { label: string; value: string }[] = eventsData.map(event => {
        return {
            label: event.name,
            value: event.id,
Severity: Minor
Found in src/client/routes/nfc/NfcTable.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 ManageHackers has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const ManageHackers: FunctionComponent = (): JSX.Element => {
    const { loading, error, data } = useHackersQuery();
    const [tableState, updateTableState] = useImmer(defaultTableState);

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

Function generateHacker has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const generateHacker: () => HackerDbObject = () => {
    const fn = faker.name.firstName();
    const ln = faker.name.lastName();
    return {
        _id: new ObjectID(),
Severity: Minor
Found in scripts/populateDb.ts - About 1 hr to fix

Function createActionRenderer has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function createActionRenderer(
    updateStatus: (s: { status: ApplicationStatus; id: string }) => Promise<void>
): FC<ActionRendererProps> {
    return function ActionRenderer({ rowData: { id, firstName, lastName, status } }) {
        return (
Severity: Minor
Found in src/client/routes/manage/ActionRenderer.tsx - About 1 hr to fix

Function getResumes has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Confirmed

const getResumes = async (models: Models): Promise<void[]> => {
    const cwd = process.cwd();
    const arr = await models.Hackers.find({
        status: { $in: ['ACCEPTED', 'SUBMITTED', 'CONFIRMED'] },
    })
Severity: Minor
Found in scripts/downloadResumes.ts - About 1 hr to fix

Function Button has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const Button: FC<ButtonProps> = props => {
    const [unresolved, setUnresolved] = useState(false);

    const { icon, iconAlt } = props;
    const iconElement = useMemo(() => getIcon(icon, iconAlt), [icon, iconAlt]);
Severity: Minor
Found in src/client/components/Buttons/Button.tsx - About 1 hr to fix

Function transformCalEventToDBUpdate has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const transformCalEventToDBUpdate = (event: SimplifiedVEvent): EventUpdate => {
    if (!event.start && !event.end) {
        throw new TypeError('Calendar event did not contain start or end timestamp');
    }
    // Either start or end may be undefined, but not both due to guard above.
Severity: Minor
Found in src/server/events/index.ts - About 1 hr to fix

Function KVData has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

const KVData = (hackerData: string[], types: string): ChartData<ChartJSData> => {
    let keys: string[] = [];
    if (types === 'gender') {
        keys = [...Object.values(Gender), 'NOT FOUND'];
    } else if (types === 'status') {
Severity: Minor
Found in src/client/routes/dashboard/OrganizerDash.tsx - About 55 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 CreateSponsor has a Cognitive Complexity of 8 (exceeds 5 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: Minor
Found in src/client/routes/manage/CreateSponsor.tsx - About 45 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 constructor has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    constructor() {
        this.schema = schema;
        this.resolvers = {
            _Plugin__Event: {
                attendees: async event => (await event).attendees || [],
Severity: Minor
Found in plugins/nfc/server.ts - About 45 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 onTableColumnSelect has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

const onTableColumnSelect = (
    ctx: TableCtxI,
    index: number
): ((s: ValueType<Option, true>) => void) => {
    // Dependency injection
Severity: Minor
Found in src/client/routes/manage/HackerTable.tsx - About 45 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 ResumeLink has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

export const ResumeLink: FC<ResumeLinkProps> = (props: { id: string }) => {
    const { id } = props;
    const { data, loading, error } = useDetailedHackerQuery({ variables: { id } });
    const [linkLoc, setLinkLoc] = useState('');
    const fileReadUrlQuery = useSignedReadUrlQuery({
Severity: Minor
Found in src/client/routes/manage/ResumeLink.tsx - About 45 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

Consider simplifying this complex logical expression.
Open

        if (
            word.length !== 0 &&
            !hacker.firstName.toLowerCase().includes(word) &&
            !hacker.lastName.toLowerCase().includes(word) &&
            !hacker.email.toLowerCase().includes(word) &&
Severity: Major
Found in plugins/nfc/components/helpers.ts - About 40 mins to fix

Consider simplifying this complex logical expression.
Open

        if (
            word.length !== 0 &&
            !hacker.firstName.toLowerCase().includes(word) &&
            !hacker.lastName.toLowerCase().includes(word) &&
            !hacker.email.toLowerCase().includes(word) &&
Severity: Major
Found in src/client/routes/nfc/helpers.ts - About 40 mins to fix

Function assignEventToCompany has a Cognitive Complexity of 7 (exceeds 5 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 35 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 HackerView has a Cognitive Complexity of 7 (exceeds 5 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: Minor
Found in src/client/routes/manage/HackerView.tsx - About 35 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 transformCalEventToDBUpdate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export const transformCalEventToDBUpdate = (event: SimplifiedVEvent): EventUpdate => {
    if (!event.start && !event.end) {
        throw new TypeError('Calendar event did not contain start or end timestamp');
    }
    // Either start or end may be undefined, but not both due to guard above.
Severity: Minor
Found in src/server/events/index.ts - About 35 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 generateRowClassName has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

) => (arg: { index: number }) => string = (data, topUserMatch) => ({ index }) => {
    if (data[index] && data[index].id === topUserMatch) return 'selected';

    if (index < 0) return 'headerRow';

Severity: Minor
Found in src/client/routes/nfc/helpers.ts - About 35 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 generateRowClassName has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

) => (arg: { index: number }) => string = (data, topUserMatch) => ({ index }) => {
    if (data[index] && data[index].id === topUserMatch) return 'selected';

    if (index < 0) return 'headerRow';

Severity: Minor
Found in plugins/nfc/components/helpers.ts - About 35 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