ElectronicBabylonianLiterature/ebl-frontend

View on GitHub

Showing 358 of 771 total issues

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

    {
      value: 'maṭ',
      cleanValue: 'maṭ',
      enclosureType: [],
      erasure: 'NONE',
Severity: Major
Found in src/test-support/word-info-fixtures.ts and 3 other locations - About 2 hrs to fix
src/test-support/line-group-fixtures.ts on lines 39..59
src/test-support/word-info-fixtures.ts on lines 41..61
src/test-support/word-info-fixtures.ts on lines 69..89

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

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

function getMainTableWithFootnotes(
  table: JQuery,
  footNotesLines: Paragraph[],
  jQueryRef: JQuery
): { table: Array<Table | Paragraph>; footNotes: Paragraph[] } {
Severity: Major
Found in src/fragmentarium/ui/fragment/WordExport.tsx - About 2 hrs to fix

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

    function createCorpusChapterUrl(
      textId: TextId,
      stage: string,
      name: string
    ): string {
    Severity: Major
    Found in src/dictionary/ui/search/DictionaryLineVariant.tsx and 1 other location - About 2 hrs to fix
    src/dictionary/ui/search/DictionaryLineGroup.tsx on lines 20..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 86.

    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

    function createCorpusChapterUrl(
      textId: TextId,
      stage: string,
      name: string
    ): string {
    Severity: Major
    Found in src/dictionary/ui/search/DictionaryLineGroup.tsx and 1 other location - About 2 hrs to fix
    src/dictionary/ui/search/DictionaryLineVariant.tsx on lines 36..52

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

    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

    `` has 23 functions (exceeds 20 allowed). Consider refactoring.
    Open

      class Annotation extends Component {
        static propTypes = {
          innerRef: T.func,
          onMouseUp: T.func,
          onMouseDown: T.func,
    Severity: Minor
    Found in src/fragmentarium/ui/image-annotation/annotation-tool/Annotation.js - About 2 hrs to fix

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

        test('Puts on submit', async () => {
          bibliographyService.create.mockReturnValueOnce(Promise.resolve())
          const { container } = await renderWithRouter(true, true, createWaitFor)
      
          await submitForm(container)
      Severity: Major
      Found in src/bibliography/ui/BibliographyEditor.test.tsx and 1 other location - About 2 hrs to fix
      src/bibliography/ui/BibliographyEditor.test.tsx on lines 52..59

      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

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

        test('Posts on submit', async () => {
          bibliographyService.update.mockReturnValueOnce(Promise.resolve())
          const { container } = await renderWithRouter(true, false, resultId)
      
          await submitForm(container)
      Severity: Major
      Found in src/bibliography/ui/BibliographyEditor.test.tsx and 1 other location - About 2 hrs to fix
      src/bibliography/ui/BibliographyEditor.test.tsx on lines 71..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 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 getTransliterationText has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

      function getTransliterationText(
        el: HTMLElement | Text | Comment | Document,
        doc: jsPDF,
        xPos: number,
        yPos: number,
      Severity: Minor
      Found in src/fragmentarium/ui/fragment/PdfExport.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

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

        return (
          <>
            <Dropdown.Item onClick={handleClick}>
              {isLoading ? <Spinner /> : children}
            </Dropdown.Item>
      Severity: Major
      Found in src/fragmentarium/ui/fragment/PdfDownloadButton.tsx and 1 other location - About 2 hrs to fix
      src/common/WordDownloadButton.tsx on lines 44..51

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

      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

        [
          new AnnotationToken(
            'kur',
            AnnotationTokenType.HasSign,
            'kur',
      src/fragmentarium/ui/image-annotation/annotation-tool/mapTokensToAnnotationTokens.test.ts on lines 62..86

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

      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

        [
          new AnnotationToken(
            'kur',
            AnnotationTokenType.HasSign,
            'kur',
      src/fragmentarium/ui/image-annotation/annotation-tool/mapTokensToAnnotationTokens.test.ts on lines 87..111

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

      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

      FakeApi has 22 functions (exceeds 20 allowed). Consider refactoring.
      Open

      export default class FakeApi {
        private expectations: Expectation[] = []
      
        readonly client = {
          fetchJson: jest.fn().mockImplementation((path, authenticate) => {
      Severity: Minor
      Found in src/test-support/FakeApi.ts - About 2 hrs to fix

        File mapTokensToAnnotationTokens.test.ts has 263 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import { AnnotationToken } from 'fragmentarium/domain/annotation-token'
        import Annotation, {
          AnnotationTokenType,
        } from 'fragmentarium/domain/annotation'
        import { Text } from 'transliteration/domain/text'

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

            [
              new AnnotationToken(
                'kur',
                AnnotationTokenType.HasSign,
                'kur',
          src/fragmentarium/ui/image-annotation/annotation-tool/mapTokensToAnnotationTokens.test.ts on lines 12..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 81.

          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

            [
              new AnnotationToken(
                'kur',
                AnnotationTokenType.HasSign,
                'kur',
          src/fragmentarium/ui/image-annotation/annotation-tool/mapTokensToAnnotationTokens.test.ts on lines 37..61

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

          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

          File museum.ts has 262 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          export const Museums = {
            ANCIENT_CULTURES_CHICAGO: {
              name:
                'Institute for the Study of Ancient Cultures, West Asia & North Africa',
              city: 'Chicago',
          Severity: Minor
          Found in src/fragmentarium/domain/museum.ts - About 2 hrs to fix

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

                {
                  type: 'Word',
                  value: 'kur',
                  parts: [],
                  cleanValue: 'kur',
            Severity: Major
            Found in src/corpus/domain/text.test.ts and 1 other location - About 2 hrs to fix
            src/test-support/test-tokens.ts on lines 3..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 80.

            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 const atfToken: Word = {
              type: 'Word',
              value: '',
              parts: [],
              cleanValue: '',
            Severity: Major
            Found in src/test-support/test-tokens.ts and 1 other location - About 2 hrs to fix
            src/corpus/domain/text.test.ts on lines 44..60

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

            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 tableHtml: JQuery = $(
                renderToString(
                  <MemoryRouter>
                    <DictionaryContext.Provider value={wordService}>
                      <TransliterationLines text={fragment.text} />
            Severity: Major
            Found in src/fragmentarium/ui/fragment/PdfExport.tsx and 1 other location - About 2 hrs to fix
            src/fragmentarium/ui/fragment/WordExport.tsx on lines 52..60

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

            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

            async function renderScriptSelection() {
              render(
                <SessionContext.Provider value={session}>
                  <ScriptSelection
                    fragment={fragment}
            Severity: Major
            Found in src/fragmentarium/ui/info/ScriptSelection.test.tsx and 1 other location - About 2 hrs to fix
            src/fragmentarium/ui/info/GenreSelection.test.tsx on lines 20..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 79.

            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

            Severity
            Category
            Status
            Source
            Language