ElectronicBabylonianLiterature/ebl-frontend

View on GitHub

Showing 65 of 771 total issues

Function Highlight has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

export default function Highlight({
  scale,
  annotation,
  active,
  isToggled,
Severity: Minor
Found in src/fragmentarium/ui/image-annotation/annotation-tool/Highlight.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 automaticAlignment has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

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

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

          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

            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

              Function findLineVariant has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                findLineVariant(
                  variant: LineVariantDisplayDto,
                  isPrimaryVariant: boolean
                ): Bluebird<LineVariantDisplay> {
                  return Bluebird.all([
              Severity: Minor
              Found in src/corpus/application/TextService.ts - About 1 hr to fix

                Function AlignmentForm has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                function AlignmentForm(props: AlignerProps) {
                  const [alignment, setAlignment] = useState(props.token.alignment)
                  const [variant, setVariant] = useState(props.token.variant?.value ?? '')
                
                  function updateToken(alignmentToken: AlignmentToken): AlignmentToken {
                Severity: Minor
                Found in src/corpus/ui/alignment/WordAligner.tsx - About 55 mins 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 addUnderLine has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                  yPos: any,
                  endpos: number,
                  num: number,
                  page: number,
                  endposFirstColumn: number,
                Severity: Minor
                Found in src/fragmentarium/ui/fragment/PdfExport.tsx - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                      if (checkIfNewPage(yPos, doc)) {
                                        newPageStarted = true
                                        doc.addPage()
                                        yPos = 15
                                        maxYPos.coords = 15
                  Severity: Major
                  Found in src/fragmentarium/ui/fragment/PdfExport.tsx - About 45 mins to fix

                    Function getPdfDoc has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                      tableHtml: JQuery,
                      notesHtml: JQuery,
                      jQueryRef: JQuery,
                      wordService: WordService,
                      fragment: Fragment
                    Severity: Minor
                    Found in src/fragmentarium/ui/fragment/PdfExport.tsx - About 35 mins to fix

                      Function addFootnotes has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                        notes: JQuery,
                        padding: number,
                        jQueryRef: JQuery,
                        yPos: number,
                        doc: jsPDF
                      Severity: Minor
                      Found in src/fragmentarium/ui/fragment/PdfExport.tsx - About 35 mins to fix

                        Function createItems has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                          start,
                          end,
                          activePage,
                          setActivePage: (number: number) => void,
                          paginationURLParam: string
                        Severity: Minor
                        Found in src/fragmentarium/ui/search/PaginationItems.tsx - About 35 mins to fix

                          Function useRowsContext has 5 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                            numberOfRows: number,
                            score?: boolean,
                            notes?: boolean,
                            parallels?: boolean,
                            oldLineNumbers?: boolean
                          Severity: Minor
                          Found in src/corpus/ui/RowsContext.ts - About 35 mins to fix

                            Function getTransliterationText has 5 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                              el: HTMLElement | Text | Comment | Document,
                              doc: jsPDF,
                              xPos: number,
                              yPos: number,
                              add: boolean
                            Severity: Minor
                            Found in src/fragmentarium/ui/fragment/PdfExport.tsx - About 35 mins to fix

                              Function getColumnSizes has 5 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                                table: JQuery,
                                jQueryRef: JQuery,
                                outerPaddingForTable: number,
                                firstColumnMinWidth: number,
                                doc: jsPDF
                              Severity: Minor
                              Found in src/fragmentarium/ui/fragment/PdfExport.tsx - About 35 mins to fix
                                Severity
                                Category
                                Status
                                Source
                                Language