VandyHacks/vaken

View on GitHub

Showing 187 of 200 total issues

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

export const EventsQueryMock: MockedResponse<EventsQueryResult['data']> = {
    request: {
        query: EventsDocument,
    },
    result: {
Severity: Major
Found in src/client/routes/events/events.graphql.mocks.ts and 2 other locations - About 1 hr to fix
src/client/routes/manage/sponsor.graphql.mocks.ts on lines 17..26
src/client/routes/manage/sponsor.graphql.mocks.ts on lines 28..37

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

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

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

export const TiersQueryMock: MockedResponse<TiersQueryResult['data']> = {
    request: {
        query: TiersDocument,
    },
    result: {
Severity: Major
Found in src/client/routes/manage/sponsor.graphql.mocks.ts and 2 other locations - About 1 hr to fix
src/client/routes/events/events.graphql.mocks.ts on lines 17..26
src/client/routes/manage/sponsor.graphql.mocks.ts on lines 17..26

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

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 3 locations. Consider refactoring.
Open

export const CompaniesQueryMock: MockedResponse<CompaniesQueryResult['data']> = {
    request: {
        query: CompaniesDocument,
    },
    result: {
Severity: Major
Found in src/client/routes/manage/sponsor.graphql.mocks.ts and 2 other locations - About 1 hr to fix
src/client/routes/events/events.graphql.mocks.ts on lines 17..26
src/client/routes/manage/sponsor.graphql.mocks.ts on lines 28..37

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

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

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

            {!isSponsor && (
                <Column
                    className="column"
                    label="Requires Travel Reimbursement?"
                    dataKey="needsReimbursement"
Severity: Major
Found in src/client/routes/manage/HackerTableRows.tsx and 2 other locations - About 1 hr to fix
src/client/routes/manage/HackerTableRows.tsx on lines 201..211
src/client/routes/manage/HackerTableRows.tsx on lines 223..233

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

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 3 locations. Consider refactoring.
Open

            {!isSponsor && (
                <Column
                    className="column"
                    label="Actions"
                    dataKey="actions"
Severity: Major
Found in src/client/routes/manage/HackerTableRows.tsx and 2 other locations - About 1 hr to fix
src/client/routes/manage/HackerTableRows.tsx on lines 201..211
src/client/routes/manage/HackerTableRows.tsx on lines 212..222

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

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 3 locations. Consider refactoring.
Open

            {!isSponsor && (
                <Column
                    className="column"
                    label="Status"
                    dataKey="status"
Severity: Major
Found in src/client/routes/manage/HackerTableRows.tsx and 2 other locations - About 1 hr to fix
src/client/routes/manage/HackerTableRows.tsx on lines 212..222
src/client/routes/manage/HackerTableRows.tsx on lines 223..233

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

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

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

export const TeamQueryMock: MockedResponse<TeamQueryResult['data']> = {
    request: {
        query: TeamDocument,
    },
    result: {
Severity: Major
Found in src/client/routes/team/teams.graphql.mocks.ts and 4 other locations - About 1 hr to fix
src/client/me.graphql.mocks.ts on lines 10..19
src/client/routes/application/application.graphql.mocks.ts on lines 15..24
src/client/routes/manage/sponsor.graphql.mocks.ts on lines 38..47
src/client/routes/profile/user.graphql.mocks.ts on lines 10..19

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

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 5 locations. Consider refactoring.
Open

export const MyProfileQueryMock: MockedResponse<MyProfileQueryResult['data']> = {
    request: {
        query: MyProfileDocument,
    },
    result: {
Severity: Major
Found in src/client/routes/profile/user.graphql.mocks.ts and 4 other locations - About 1 hr to fix
src/client/me.graphql.mocks.ts on lines 10..19
src/client/routes/application/application.graphql.mocks.ts on lines 15..24
src/client/routes/manage/sponsor.graphql.mocks.ts on lines 38..47
src/client/routes/team/teams.graphql.mocks.ts on lines 10..19

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

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 5 locations. Consider refactoring.
Open

export const MeQueryMock: MockedResponse<MeQueryResult['data']> = {
    request: {
        query: MeDocument,
    },
    result: {
Severity: Major
Found in src/client/me.graphql.mocks.ts and 4 other locations - About 1 hr to fix
src/client/routes/application/application.graphql.mocks.ts on lines 15..24
src/client/routes/manage/sponsor.graphql.mocks.ts on lines 38..47
src/client/routes/profile/user.graphql.mocks.ts on lines 10..19
src/client/routes/team/teams.graphql.mocks.ts on lines 10..19

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

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 5 locations. Consider refactoring.
Open

export const MeSponsorQueryMock: MockedResponse<MeSponsorQueryResult['data']> = {
    request: {
        query: MeSponsorDocument,
    },
    result: {
Severity: Major
Found in src/client/routes/manage/sponsor.graphql.mocks.ts and 4 other locations - About 1 hr to fix
src/client/me.graphql.mocks.ts on lines 10..19
src/client/routes/application/application.graphql.mocks.ts on lines 15..24
src/client/routes/profile/user.graphql.mocks.ts on lines 10..19
src/client/routes/team/teams.graphql.mocks.ts on lines 10..19

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

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 5 locations. Consider refactoring.
Open

export const MyApplicationQueryMock: MockedResponse<MyApplicationQueryResult['data']> = {
    request: {
        query: MyApplicationDocument,
    },
    result: {
Severity: Major
Found in src/client/routes/application/application.graphql.mocks.ts and 4 other locations - About 1 hr to fix
src/client/me.graphql.mocks.ts on lines 10..19
src/client/routes/manage/sponsor.graphql.mocks.ts on lines 38..47
src/client/routes/profile/user.graphql.mocks.ts on lines 10..19
src/client/routes/team/teams.graphql.mocks.ts on lines 10..19

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

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