ElectronicBabylonianLiterature/ebl-frontend

View on GitHub

Showing 358 of 766 total issues

File PdfExport.tsx has 661 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import React from 'react'
import { Fragment } from 'fragmentarium/domain/fragment'
import Record from 'fragmentarium/ui/info/Record'

import { ReactElement } from 'react'
Severity: Major
Found in src/fragmentarium/ui/fragment/PdfExport.tsx - About 1 day to fix

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

    import Bluebird from 'bluebird'
    import _ from 'lodash'
    import { TestData, testDelegation } from 'test-support/utils'
    import TextService from './TextService'
    import { LemmatizationToken } from 'transliteration/domain/Lemmatization'
    Severity: Major
    Found in src/corpus/application/TextService.test.ts - About 1 day to fix

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

        divs.each((i, el) => {
          let linePos = paddingForGlossary
      
          $(el)
            .contents()
      Severity: Major
      Found in src/fragmentarium/ui/fragment/PdfExport.tsx and 1 other location - About 6 hrs to fix
      src/fragmentarium/ui/fragment/PdfExport.tsx on lines 499..520

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

      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

        lis.each((i, el) => {
          let linePos = padding
      
          $(el)
            .contents()
      Severity: Major
      Found in src/fragmentarium/ui/fragment/PdfExport.tsx and 1 other location - About 6 hrs to fix
      src/fragmentarium/ui/fragment/PdfExport.tsx on lines 555..576

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

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

        render(): JSX.Element {
          const rows = this.state.number?.split('\n').length ?? 0
          const numberSearchForm = (
            <Form.Group as={Row} controlId="number">
              <HelpCol overlay={MuseumSearchHelp()} />
      Severity: Major
      Found in src/fragmentarium/ui/SearchForm.tsx - About 6 hrs to fix

        File TextService.ts has 418 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import Bluebird from 'bluebird'
        import produce, { castDraft } from 'immer'
        import _ from 'lodash'
        import { stringify } from 'query-string'
        
        
        Severity: Minor
        Found in src/corpus/application/TextService.ts - About 6 hrs to fix

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

          describe('find', () => {
            const fileName = 'image of tower of babel.jpg'
          
            beforeEach(async () => {
              jest
          Severity: Major
          Found in src/fragmentarium/infrastructure/ImageRepository.test.ts and 1 other location - About 6 hrs to fix
          src/fragmentarium/infrastructure/ImageRepository.test.ts on lines 68..88

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

          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

          describe('findPhoto', () => {
            const number = 'ABC 123+456'
          
            beforeEach(async () => {
              jest
          Severity: Major
          Found in src/fragmentarium/infrastructure/ImageRepository.test.ts and 1 other location - About 6 hrs to fix
          src/fragmentarium/infrastructure/ImageRepository.test.ts on lines 21..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 155.

          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 FragmentRepository.test.ts has 411 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import Promise from 'bluebird'
          import { testDelegation, TestData } from 'test-support/utils'
          import FragmentRepository, { createScript } from './FragmentRepository'
          import Folio from 'fragmentarium/domain/Folio'
          import { fragment, fragmentDto } from 'test-support/test-fragment'
          Severity: Minor
          Found in src/fragmentarium/infrastructure/FragmentRepository.test.ts - About 5 hrs to fix

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

                render() {
                  const { props } = this
                  const {
                    isMouseHovering,
            
            
            Severity: Major
            Found in src/fragmentarium/ui/image-annotation/annotation-tool/Annotation.js - About 5 hrs to fix

              FragmentService has 41 functions (exceeds 20 allowed). Consider refactoring.
              Open

              export class FragmentService {
                private readonly referenceInjector: ReferenceInjector
              
                constructor(
                  private readonly fragmentRepository: FragmentRepository &
              Severity: Minor
              Found in src/fragmentarium/application/FragmentService.ts - About 5 hrs to fix

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

                  findColophons(id: ChapterId): Bluebird<SiglumAndTransliteration[]> {
                    return this.apiClient
                      .fetchJson(`${createChapterUrl(id)}/colophons`, false)
                      .then(fromSiglumAndTransliterationDto)
                      .then((colophons) =>
                Severity: Major
                Found in src/corpus/application/TextService.ts and 1 other location - About 5 hrs to fix
                src/corpus/application/TextService.ts on lines 332..348

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

                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

                  findUnplacedLines(id: ChapterId): Bluebird<SiglumAndTransliteration[]> {
                    return this.apiClient
                      .fetchJson(`${createChapterUrl(id)}/unplaced_lines`, false)
                      .then(fromSiglumAndTransliterationDto)
                      .then((unplacedLines) =>
                Severity: Major
                Found in src/corpus/application/TextService.ts and 1 other location - About 5 hrs to fix
                src/corpus/application/TextService.ts on lines 314..330

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

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

                function addMainTableWithFootnotes(
                  table: JQuery,
                  notes: JQuery,
                  jQueryRef: any,
                  yPos: number,
                Severity: Major
                Found in src/fragmentarium/ui/fragment/PdfExport.tsx - About 5 hrs to fix

                  Function FragmentAnnotation has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function FragmentAnnotation({
                    tokens,
                    fragment,
                    image,
                    initialAnnotations,

                  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

                  File FragmentRepository.ts has 392 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import Promise from 'bluebird'
                  import _ from 'lodash'
                  import { stringify } from 'query-string'
                  import produce from 'immer'
                  import {
                  Severity: Minor
                  Found in src/fragmentarium/infrastructure/FragmentRepository.ts - About 5 hrs to fix

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

                    function AnnotatorDisplay({
                      image,
                      fragment,
                      annotations,
                      fragmentService,
                    Severity: Major
                    Found in src/fragmentarium/ui/image-annotation/Annotator.tsx and 1 other location - About 5 hrs to fix
                    src/fragmentarium/ui/image-annotation/Annotator.tsx on lines 33..55

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

                    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 Annotator({
                      image,
                      fragment,
                      annotations,
                      fragmentService,
                    Severity: Major
                    Found in src/fragmentarium/ui/image-annotation/Annotator.tsx and 1 other location - About 5 hrs to fix
                    src/fragmentarium/ui/image-annotation/Annotator.tsx on lines 9..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 143.

                    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 ChapterEditView.integration.test.ts has 381 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import _ from 'lodash'
                    import Chance from 'chance'
                    
                    import AppDriver from 'test-support/AppDriver'
                    import FakeApi from 'test-support/FakeApi'
                    Severity: Minor
                    Found in src/corpus/ui/ChapterEditView.integration.test.ts - About 5 hrs to fix

                      File FragmentAnnotation.tsx has 376 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      import Content from 'fragmentarium/ui/image-annotation/annotation-tool/Content'
                      import { AnnotationToken } from 'fragmentarium/domain/annotation-token'
                      import SignService from 'signs/application/SignService'
                      import AnnotationTool from 'fragmentarium/ui/image-annotation/annotation-tool/Annotation'
                      import { RectangleSelector } from 'react-image-annotation/lib/selectors'
                        Severity
                        Category
                        Status
                        Source
                        Language