ElectronicBabylonianLiterature/ebl-frontend

View on GitHub

Showing 65 of 766 total issues

`` 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

    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

    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'

        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

          Function findChapterDisplay has 55 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            findChapterDisplay(
              id: ChapterId,
              lines: readonly number[] = [],
              variants: readonly number[] = []
            ): Bluebird<ChapterDisplay> {
          Severity: Major
          Found in src/corpus/application/TextService.ts - About 2 hrs to fix

            File ChapterLines.tsx has 253 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import produce, { castDraft, Draft } from 'immer'
            import _ from 'lodash'
            import React from 'react'
            import { Button, Card, Col, Form, ListGroup } from 'react-bootstrap'
            import ListForm from 'common/List'
            Severity: Minor
            Found in src/corpus/ui/lines/ChapterLines.tsx - About 2 hrs to fix

              Function InjectedApp has 46 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function InjectedApp(): JSX.Element {
                const authenticationService = useAuthentication()
                const apiClient = new ApiClient(authenticationService, errorReporter)
                const wordRepository = new WordRepository(apiClient)
                const signsRepository = new SignRepository(apiClient)
              Severity: Minor
              Found in src/index.tsx - About 1 hr to fix

                Function dealWithFootNotesHtml has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function dealWithFootNotesHtml(
                  el: HTMLElement | Text | Comment | Document,
                  doc: jsPDF,
                  xPos: number,
                  yPos: number
                Severity: Minor
                Found in src/fragmentarium/ui/fragment/PdfExport.tsx - About 1 hr to fix

                  Function listController has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function listController(ListView) {
                    return function ListController({
                      value,
                      children,
                      onChange,
                  Severity: Minor
                  Found in src/common/List.tsx - About 1 hr to fix

                    Function signFactory has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export const signFactory = Factory.define<Sign>(() => {
                      return new Sign({
                        name: chance.pickone(['BA', 'BAD', 'BAR', 'PI']),
                        lists: chance.pickone([
                          [{ name: 'MESZL', number: '1' }],
                    Severity: Minor
                    Found in src/test-support/sign-fixtures.ts - About 1 hr to fix

                      Function automaticAlignment has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export default function automaticAlignment(
                        tokens: readonly (readonly AnnotationToken[])[],
                        annotation: Annotation,
                        annotations: readonly Annotation[]
                      ): readonly Annotation[] {

                        Function wordExport has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export async function wordExport(
                          fragment: Fragment,
                          wordService: WordService,
                          jQueryRef: JQuery
                        ): Promise<Document> {
                        Severity: Minor
                        Found in src/fragmentarium/ui/fragment/WordExport.tsx - About 1 hr to fix

                          Function withData has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          export default function withData<PROPS, GETTER_PROPS, DATA>(
                            WrappedComponent: React.ComponentType<WithData<PROPS, DATA>>,
                            getter: (props: PROPS & GETTER_PROPS) => Promise<DATA>,
                            config: Partial<Config<PROPS & GETTER_PROPS, DATA>> = {}
                          ): React.ComponentType<PROPS & GETTER_PROPS> {
                          Severity: Minor
                          Found in src/http/withData.tsx - About 1 hr to fix

                            Function SignLogogramInfo has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

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

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

                              function addGlossary(
                                glossaryHtml: JQuery,
                                jQueryRef: JQuery,
                                yPos: number,
                                doc: any
                              Severity: Minor
                              Found in src/fragmentarium/ui/fragment/PdfExport.tsx - About 1 hr to fix

                                Function handleSelection has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                  const handleSelection = (annotation: RawAnnotation | Annotation): void => {
                                    const { geometry, data } = annotation
                                    if (data) {
                                      const selectedAnnotation = getSelectionById(data.id, annotations)
                                      if (selectedAnnotation) {

                                  Function dealWithGlossaryHtml has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  function dealWithGlossaryHtml(
                                    el: HTMLElement | Text | Comment | Document,
                                    doc: jsPDF,
                                    xPos: number,
                                    yPos: number
                                  Severity: Minor
                                  Found in src/fragmentarium/ui/fragment/PdfExport.tsx - About 1 hr to fix

                                    Function getColumnSizes has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    function getColumnSizes(
                                      table: JQuery,
                                      jQueryRef: JQuery,
                                      outerPaddingForTable: number,
                                      firstColumnMinWidth: number,
                                    Severity: Minor
                                    Found in src/fragmentarium/ui/fragment/PdfExport.tsx - About 1 hr to fix

                                      Function findChapterLine has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                        findChapterLine(
                                          id: ChapterId,
                                          number: number,
                                          variantNumber: number
                                        ): Bluebird<LineDetails> {
                                      Severity: Minor
                                      Found in src/corpus/application/TextService.ts - About 1 hr to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language