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

AfO Register #398

Merged
merged 32 commits into from
Nov 28, 2023
Merged

AfO Register #398

merged 32 commits into from
Nov 28, 2023

Conversation

khoidt
Copy link
Contributor

@khoidt khoidt commented Oct 25, 2023

No description provided.

</HeadTagsService>
)}
{...(sitemap && sitemapDefaults)}
/>,
<Route
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.

} & RouteComponentProps): JSX.Element {
const rawQuery = parse(location.search).query || ''
const query = _.isArray(rawQuery) ? rawQuery.join('') : rawQuery
return (
<>
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.

})

describe('Converts to Markdown string', () => {
it('Returns the correct markdown string with fragments', () => {
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.

})

describe('Finds link to fragment', () => {
it('should return the correct link to fragment', () => {
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.

this.apiClient = apiClient
}

search(query: string): Promise<AfoRegisterRecord[]> {
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.

}}
id={_.uniqueId('Bibliography-')}
>
<Tab
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 { text: text ?? '', textNumber: textNumber ?? '' }
}

function BibliographyReferences({
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 AfoRegister({
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.

{...props}
/>
</Tab>
<Tab
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.

this.props.history.push(`?${stringify(this.state.query)}`)
}

render() {
Copy link

Choose a reason for hiding this comment

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

Function render has 35 lines of code (exceeds 25 allowed). Consider refactoring.

.then((result) => result.map(createAfoRegisterRecord))
}

searchSuggestions(query: string): Promise<AfoRegisterRecordSuggestion[]> {
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.

import { stringify } from 'query-string'
import MarkdownAndHtmlToHtml from 'common/MarkdownAndHtmlToHtml'

export const AfoRegisterRedirectBox = (
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.

afoRegisterService: AfoRegisterService
} & RouteComponentProps

function AfoRegisterSearch({ queryProp, afoRegisterService }: FormProps) {
Copy link

Choose a reason for hiding this comment

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

Function AfoRegisterSearch has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.

@khoidt
Copy link
Contributor Author

khoidt commented Nov 21, 2023

Add AfO Register

afoRegisterService={afoRegisterService}
/>
</div>
<div className="AfoRegister__search_results">
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 4 locations. Consider refactoring.

readonly discussedByNotes?: string
readonly fragmentNumbers?: string[]

constructor({
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.

this.fragmentNumbers = fragmentNumbers
}

toMarkdownString(): string {
Copy link

Choose a reason for hiding this comment

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

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

}

toMarkdownString(): string {
let result = this.text + (this.textNumber ? ' ' + this.textNumber : '')
Copy link
Contributor

Choose a reason for hiding this comment

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

I recently made a little helper function padLeft in src/fragmentarium/domain/archaeology.ts because I had to do the x ? ' ' + x : '' thing over and over, which is then just padLeft(this.textNumber). If you like you can move it to common/utils.ts or something and use it here, it might lower the complexity a bit.

Copy link

codeclimate bot commented Nov 28, 2023

Code Climate has analyzed commit 43c19d8 and detected 0 issues on this pull request.

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

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

View more on Code Climate.

@khoidt khoidt merged commit e53966b into master Nov 28, 2023
12 checks passed
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.

2 participants