ElectronicBabylonianLiterature/ebl-frontend

View on GitHub

Showing 358 of 771 total issues

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

export class DiscourseAtLine extends AtLine {
  readonly type = 'DiscourseAtLine'
  readonly label: string

  constructor(data: DiscourseAtLineDto) {
Severity: Major
Found in src/transliteration/domain/at-lines.ts and 1 other location - About 1 hr to fix
src/transliteration/domain/dollar-lines.ts on lines 23..31

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

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

export class HeadingAtLine extends AtLine {
  readonly type = 'HeadingAtLine'
  readonly number: number

  constructor(data: HeadingAtLineDto) {
Severity: Major
Found in src/transliteration/domain/at-lines.ts and 1 other location - About 1 hr to fix
src/transliteration/domain/at-lines.ts on lines 18..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 60.

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

export class LooseDollarLine extends DollarLine {
  readonly type = 'LooseDollarLine'
  readonly text: string

  constructor(data: LooseDollarLineDto) {
Severity: Major
Found in src/transliteration/domain/dollar-lines.ts and 1 other location - About 1 hr to fix
src/transliteration/domain/at-lines.ts on lines 65..73

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

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 render has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  render(): JSX.Element {
    const parsed = new Parser().parse(this.state.citation)
    return (
      <>
        <Form onSubmit={this.handleSubmit}>
Severity: Minor
Found in src/bibliography/ui/BibliographyEntryForm.tsx - About 1 hr to fix

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

    export function TransliterationSearchHelp(): JSX.Element {
      return (
        <Popover
          id={_.uniqueId('TransliterationSearchHelp-')}
          title="Search transliterations"
    Severity: Minor
    Found in src/fragmentarium/ui/SearchHelp.tsx - About 1 hr to fix

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

      export default function LogogramInfo(schrammLogogram: string): JSX.Element {
        return (
          <Popover
            id={_.uniqueId('LogogramInfo-')}
            title="Logogram Info"
      Severity: Minor
      Found in src/signs/ui/display/SignLogogram/LogogramWordInfoPopover.tsx - About 1 hr to fix

        Function testDelegation has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function testDelegation<S>(
          object: S,
          testData: readonly TestData<S>[]
        ): void {
          describe.each(testData)(
        Severity: Minor
        Found in src/test-support/utils.ts - About 1 hr to fix

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

            const glossaryJsx: JSX.Element = await glossaryFactory
              .createGlossary(fragment.text)
              .then((glossaryData) => {
                return Glossary({ data: glossaryData })
              })
          Severity: Major
          Found in src/fragmentarium/ui/fragment/WordExport.tsx and 1 other location - About 1 hr to fix
          src/fragmentarium/ui/fragment/PdfExport.tsx on lines 104..108

          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

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

            const glossaryJsx: JSX.Element = await glossaryFactory
              .createGlossary(fragment.text)
              .then((glossaryData) => {
                return Glossary({ data: glossaryData })
              })
          Severity: Major
          Found in src/fragmentarium/ui/fragment/PdfExport.tsx and 1 other location - About 1 hr to fix
          src/fragmentarium/ui/fragment/WordExport.tsx on lines 209..213

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

          it('Next links to the next fragment', () => {
            expect(
              screen.getByLabelText(`Next ${folio.humanizedName}'s Folio`)
            ).toHaveAttribute('href', expectedLink(pagerData.next))
          })
          Severity: Major
          Found in src/fragmentarium/ui/images/FolioPager.test.tsx and 1 other location - About 1 hr to fix
          src/fragmentarium/ui/images/FolioPager.test.tsx on lines 37..41

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

            derivedFrom = (): JSX.Element => (
              <DerivedFromInput
                value={this.state.word.derivedFrom}
                onChange={this.onChangeValue('derivedFrom')}
              />
          Severity: Major
          Found in src/dictionary/ui/editor/WordForm.tsx and 1 other location - About 1 hr to fix
          src/dictionary/ui/editor/WordForm.tsx on lines 110..115

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

          it('Previous links to the previous fragment', () => {
            expect(
              screen.getByLabelText(`Previous ${folio.humanizedName}'s Folio`)
            ).toHaveAttribute('href', expectedLink(pagerData.previous))
          })
          Severity: Major
          Found in src/fragmentarium/ui/images/FolioPager.test.tsx and 1 other location - About 1 hr to fix
          src/fragmentarium/ui/images/FolioPager.test.tsx on lines 43..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 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 2 locations. Consider refactoring.
          Open

            oraccWords = (): JSX.Element => (
              <OraccWordsList
                value={this.state.word.oraccWords}
                onChange={this.onChangeValue('oraccWords')}
              />
          Severity: Major
          Found in src/dictionary/ui/editor/WordForm.tsx and 1 other location - About 1 hr to fix
          src/dictionary/ui/editor/WordForm.tsx on lines 103..108

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

            return (
              <Download
                baseFileName={baseFileName}
                pdfDownloadButton={pdfDownloadButton}
                wordDownloadButton={wordDownloadButton}
          Severity: Major
          Found in src/fragmentarium/ui/fragment/Download.tsx and 1 other location - About 1 hr to fix
          src/transliteration/ui/DisplayToken.tsx on lines 371..381

          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 render has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            render(): JSX.Element {
              return (
                <div className="Word">
                  <ErrorBoundary>
                    <Link
          Severity: Minor
          Found in src/dictionary/ui/search/Word.tsx - About 1 hr to fix

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

            it('Calls Auth0 login if user is logged out', () => {
              renderUser(false)
              fireEvent.click(screen.getByText('Login'))
              expect(auth.login).toHaveBeenCalled()
            })
            Severity: Major
            Found in src/auth/User.test.tsx and 1 other location - About 1 hr to fix
            src/auth/User.test.tsx on lines 32..36

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

            it('Calls Auth0 logout if user is logged in', () => {
              renderUser(true)
              fireEvent.click(screen.getByText('Logout Test User'))
              expect(auth.logout).toHaveBeenCalled()
            })
            Severity: Major
            Found in src/auth/User.test.tsx and 1 other location - About 1 hr to fix
            src/auth/User.test.tsx on lines 38..42

            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 ChapterLineForm has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

            function ChapterLineForm({
              value,
              manuscripts,
              onChange,
              disabled = false,
            Severity: Minor
            Found in src/corpus/ui/lines/ChapterLines.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 SignsSearchForm has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

            function SignsSearchForm({ sign, signQuery, history }: Props): JSX.Element {
              const [signQueryState, setSignQueryState] = useState(signQuery)
              const [signState, setSignState] = useState(sign || '')
              const [unnormalizedSignQuery, setUnnormalizedSignQuery] = useState(
                signQuery.value
            Severity: Minor
            Found in src/signs/ui/search/SignsSearchForm.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 createColumns has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export function createColumns(tokens: readonly Token[]): TextLineColumn[] {
              const hasColumns = containsColumns(tokens)
              return _.reduce<Token, TextLineColumn[]>(
                tokens,
                (columns, current) => {
            Severity: Minor
            Found in src/transliteration/domain/columns.ts - About 1 hr to fix
              Severity
              Category
              Status
              Source
              Language