Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Colophons #462

Merged
merged 20 commits into from
May 12, 2024
Merged

Colophons #462

merged 20 commits into from
May 12, 2024

Conversation

khoidt
Copy link
Contributor

@khoidt khoidt commented Mar 7, 2024

No description provided.

)
}

function ArchaeologyContents(props: TabsProps): JSX.Element {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

)
}

function ColophonContents(props: TabsProps): JSX.Element {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

}[name]()
}

function isTabDisabled({
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

)
}

function DisplayContents(props: TabsProps): JSX.Element {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

src/colophons/domain/Colophons.ts Outdated Show resolved Hide resolved
isUncertain: boolean
}

interface Individual {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

src/colophons/domain/Colophons.ts Outdated Show resolved Hide resolved
OnlyColophon = 'Only Colophon',
}

enum ColophonType {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

value={individual.name?.value ?? ''}
onChange={(e) => onUpdate('name', 'value', e.target.value)}
/>
<Form.Control
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

src/colophons/domain/Colophons.ts Outdated Show resolved Hide resolved
src/fragmentarium/ui/fragment/ColophonEditorInputs.tsx Outdated Show resolved Hide resolved
src/fragmentarium/ui/fragment/ColophonEditorInputs.tsx Outdated Show resolved Hide resolved
src/fragmentarium/ui/fragment/ColophonEditorInputs.tsx Outdated Show resolved Hide resolved
isUncertain: boolean
}

export interface Individual {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

return `${chance.sentence()}\n${chance.sentence()}`
}

export function fragmentCollection(
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

}: BrokenUncertainProps): JSX.Element {
return (
<>
<Form.Switch
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

src/fragmentarium/ui/fragment/ColophonEditorInputs.tsx Outdated Show resolved Hide resolved
src/fragmentarium/ui/fragment/ColophonEditorInputs.tsx Outdated Show resolved Hide resolved
onChange={(event) => setBroken(event.target.checked)}
checked={isBroken}
/>
<Form.Switch
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@@ -0,0 +1,277 @@
import React from 'react'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

File ColophonEditorInputs.tsx has 266 lines of code (exceeds 250 allowed). Consider refactoring.

src/fragmentarium/ui/fragment/ColophonEditor.tsx Outdated Show resolved Hide resolved
src/fragmentarium/ui/fragment/ColophonEditor.tsx Outdated Show resolved Hide resolved
const _individuals =
individuals.length > 0 ? individuals : [new IndividualAttestation()]
return (
<ListForm
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

src/fragmentarium/ui/fragment/ColophonEditor.tsx Outdated Show resolved Hide resolved
src/fragmentarium/ui/fragment/ColophonEditor.tsx Outdated Show resolved Hide resolved
)
}

export const ColophonStatusInput = ({
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

)
}

export const ColophonOwnershipInput = ({
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

})
}

setTypeField(type?: IndividualTypeAttestation): IndividualAttestation {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

index: number
}): JSX.Element => {
const nameFields = ['name', 'sonOf', 'grandsonOf', 'family']
const getSelectField = (props, key: string) => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function getSelectField has 45 lines of code (exceeds 25 allowed). Consider refactoring.

}
}

const IndividualForm = ({
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function IndividualForm has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.

})
}

toString(): string {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function toString has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.

})
}
}
const individualFields = [...nameFields, 'nativeOf', 'type'].map((key) => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function individualFields has 39 lines of code (exceeds 25 allowed). Consider refactoring.

@@ -0,0 +1,336 @@
import React, { useState } from 'react'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

File ColophonEditor.tsx has 307 lines of code (exceeds 250 allowed). Consider refactoring.

Copy link

codeclimate bot commented May 12, 2024

Code Climate has analyzed commit 8afc586 and detected 0 issues on this pull request.

The test coverage on the diff in this pull request is 89.9% (75% is the threshold).

This pull request will bring the total coverage in the repository to 91.0% (0.0% change).

View more on Code Climate.

@khoidt khoidt merged commit b73bd3a into master May 12, 2024
12 checks passed
@khoidt
Copy link
Contributor Author

khoidt commented May 13, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant