ElectronicBabylonianLiterature/ebl-frontend

View on GitHub
src/fragmentarium/ui/SearchForm.test.tsx

Summary

Maintainability
A
1 hr
Test Coverage

File SearchForm.test.tsx has 286 lines of code (exceeds 250 allowed). Consider refactoring.
Wontfix

import React from 'react'
import { Router, withRouter } from 'react-router-dom'
import { act, render, screen, waitFor } from '@testing-library/react'
import Promise from 'bluebird'
import SessionContext from 'auth/SessionContext'
Severity: Minor
Found in src/fragmentarium/ui/SearchForm.test.tsx - About 2 hrs to fix

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

        await waitFor(() => {
          expect(screen.getByText('Old Assyrian')).toBeVisible()
          expect(screen.getByText('Old Babylonian')).toBeVisible()
          expect(screen.getByText('Old Elamite')).toBeVisible()
        })
    Severity: Major
    Found in src/fragmentarium/ui/SearchForm.test.tsx and 1 other location - About 2 hrs to fix
    src/afo-register/ui/AfoRegisterSearchForm.test.tsx on lines 128..132

    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

          <Router history={history}>
            <SessionContext.Provider value={session}>
              <SearchFormWithRouter
                fragmentService={fragmentService}
                fragmentQuery={query}
    Severity: Major
    Found in src/fragmentarium/ui/SearchForm.test.tsx and 1 other location - About 1 hr to fix
    src/fragmentarium/ui/search/FragmentariumSearch.test.tsx on lines 55..65

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

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

      it('Displays User Input in NumbersSearchForm', async () => {
        const userInput = 'RN0'
        userEvent.type(screen.getByLabelText('Number'), userInput)
        expect(screen.getByLabelText('Number')).toHaveValue(userInput)
      })
    Severity: Major
    Found in src/fragmentarium/ui/SearchForm.test.tsx and 1 other location - About 1 hr to fix
    src/fragmentarium/ui/SearchForm.test.tsx on lines 127..131

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

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

      it('Displays User Input in PagesSearchForm', async () => {
        const userInput = '1-2'
        userEvent.type(screen.getByLabelText('Pages'), userInput)
        expect(screen.getByLabelText('Pages')).toHaveValue(userInput)
      })
    Severity: Major
    Found in src/fragmentarium/ui/SearchForm.test.tsx and 1 other location - About 1 hr to fix
    src/fragmentarium/ui/SearchForm.test.tsx on lines 110..114

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

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

      it('displays user input', async () => {
        await waitFor(() =>
          expect(screen.getByLabelText('select-genre')).toHaveValue('arch')
        )
      })
    Severity: Minor
    Found in src/fragmentarium/ui/SearchForm.test.tsx and 1 other location - About 30 mins to fix
    src/fragmentarium/ui/SearchForm.test.tsx on lines 250..254

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

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

      it('displays user input', async () => {
        await waitFor(() =>
          expect(screen.getByLabelText('select-provenance')).toHaveValue('Assur')
        )
      })
    Severity: Minor
    Found in src/fragmentarium/ui/SearchForm.test.tsx and 1 other location - About 30 mins to fix
    src/fragmentarium/ui/SearchForm.test.tsx on lines 273..277

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

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

      it('displays user input', async () => {
        await waitFor(() =>
          expect(screen.getByLabelText('Select lemmata')).toHaveValue(lemmaInput)
        )
      })
    Severity: Minor
    Found in src/fragmentarium/ui/SearchForm.test.tsx and 1 other location - About 30 mins to fix
    src/fragmentarium/ui/SearchForm.test.tsx on lines 212..216

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

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

      it('displays user input', async () => {
        await waitFor(() =>
          expect(screen.getByLabelText('select-period')).toHaveValue(periodInput)
        )
      })
    Severity: Minor
    Found in src/fragmentarium/ui/SearchForm.test.tsx and 1 other location - About 30 mins to fix
    src/fragmentarium/ui/SearchForm.test.tsx on lines 161..165

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

    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

    There are no issues that match your filters.

    Category
    Status