VandyHacks/vaken

View on GitHub

Showing 187 of 200 total issues

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

        await Promise.all(
            args[0].split(',').map(email => {
                const constraint: Partial<LoginDbObject> = args[1]
                    ? { email, provider: args[1] }
                    : { email };
Severity: Major
Found in scripts/makeVolunteer.ts and 1 other location - About 3 hrs to fix
scripts/makeOrganizer.ts on lines 49..57

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 97.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

        await Promise.all(
            args[0].split(',').map(email => {
                const constraint: Partial<LoginDbObject> = args[1]
                    ? { email, provider: args[1] }
                    : { email };
Severity: Major
Found in scripts/makeOrganizer.ts and 1 other location - About 3 hrs to fix
scripts/makeVolunteer.ts on lines 39..47

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 97.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

export async function getEventsAttended(userID: string, models: Models): Promise<string[]> {
    const user = await models.Hackers.findOne({ _id: new ObjectID(userID) });
    return user != null && user.eventsAttended != null ? user.eventsAttended : [];
}
Severity: Major
Found in src/server/nfc/index.ts and 1 other location - About 3 hrs to fix
plugins/nfc/helpers.ts on lines 160..163

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 96.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

    [ApplicationStatus.Started]: {
        actions: [
            {
                action: () => void (window.location.href = '/application'),
                actionText: 'Complete your application',
Severity: Major
Found in src/client/routes/dashboard/HackerDash.tsx and 1 other location - About 3 hrs to fix
src/client/routes/dashboard/HackerDash.tsx on lines 22..35

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 96.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

    [ApplicationStatus.Created]: {
        actions: [
            {
                action: () => void (window.location.href = '/application'),
                actionText: 'Complete your application',
Severity: Major
Found in src/client/routes/dashboard/HackerDash.tsx and 1 other location - About 3 hrs to fix
src/client/routes/dashboard/HackerDash.tsx on lines 36..49

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 96.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

export async function getEventsAttended(userID: string, models: Models): Promise<string[]> {
    const user = await models.Hackers.findOne({ _id: new ObjectID(userID) });
    return user != null && user.eventsAttended != null ? user.eventsAttended : [];
}
Severity: Major
Found in plugins/nfc/helpers.ts and 1 other location - About 3 hrs to fix
src/server/nfc/index.ts on lines 172..175

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 96.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

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

const renderHeaderAsLabel = ({
    dataKey,
    sortBy,
    sortDirection,
    label,
Severity: Major
Found in plugins/nfc/components/NfcTableRows.tsx and 1 other location - About 2 hrs to fix
src/client/routes/nfc/NfcTableRows.tsx on lines 66..78

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 90.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

const renderHeaderAsLabel = ({
    dataKey,
    sortBy,
    sortDirection,
    label,
Severity: Major
Found in src/client/routes/nfc/NfcTableRows.tsx and 1 other location - About 2 hrs to fix
plugins/nfc/components/NfcTableRows.tsx on lines 66..78

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 90.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

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

export async function getAttendees(eventID: string, models: Models): Promise<string[]> {
    const event = await models.Events.findOne({ _id: new ObjectID(eventID) });
    return event != null ? event.attendees : [];
}
Severity: Major
Found in plugins/nfc/helpers.ts and 1 other location - About 2 hrs to fix
src/server/nfc/index.ts on lines 177..180

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 84.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

export async function getAttendees(eventID: string, models: Models): Promise<string[]> {
    const event = await models.Events.findOne({ _id: new ObjectID(eventID) });
    return event != null ? event.attendees : [];
}
Severity: Major
Found in src/server/nfc/index.ts and 1 other location - About 2 hrs to fix
plugins/nfc/helpers.ts on lines 165..168

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 84.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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 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 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