ICTU/quality-time

View on GitHub
components/frontend/src/fields/TextInput.test.js

Summary

Maintainability
D
3 days
Test Coverage

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

it("does not invoke the callback if the value is unchanged", async () => {
    const mockCallback = jest.fn()
    render(<TextInput value="Hello" set_value={mockCallback} />)
    await userEvent.type(screen.getByText(/Hello/), "{Shift>}{Enter}")
    expect(screen.getByText(/Hello/)).not.toBe(null)
Severity: Major
Found in components/frontend/src/fields/TextInput.test.js and 3 other locations - About 4 hrs to fix
components/frontend/src/fields/Input.test.js on lines 44..50
components/frontend/src/fields/TextInput.test.js on lines 19..25
components/frontend/src/fields/TextInput.test.js on lines 35..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 119.

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 4 locations. Consider refactoring.
Open

it("does not invoke the callback on enter", async () => {
    const mockCallback = jest.fn()
    render(<TextInput value="Hello" set_value={mockCallback} />)
    await userEvent.type(screen.getByText(/Hello/), "Bye{Enter}")
    expect(screen.getByText(/Bye/)).not.toBe(null)
Severity: Major
Found in components/frontend/src/fields/TextInput.test.js and 3 other locations - About 4 hrs to fix
components/frontend/src/fields/Input.test.js on lines 44..50
components/frontend/src/fields/TextInput.test.js on lines 27..33
components/frontend/src/fields/TextInput.test.js on lines 35..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 119.

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 4 locations. Consider refactoring.
Open

it("resets the value on escape", async () => {
    const mockCallback = jest.fn()
    render(<TextInput value="Hello" set_value={mockCallback} />)
    await userEvent.type(screen.getByText(/Hello/), "Revert{Escape}")
    expect(screen.getByText(/Hello/)).not.toBe(null)
Severity: Major
Found in components/frontend/src/fields/TextInput.test.js and 3 other locations - About 4 hrs to fix
components/frontend/src/fields/Input.test.js on lines 44..50
components/frontend/src/fields/TextInput.test.js on lines 19..25
components/frontend/src/fields/TextInput.test.js on lines 27..33

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

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

it("does not show an error for required non-empty fields, when read only", () => {
    const { container } = render(<TextInput requiredPermissions={["test"]} value="Hello" required />)
    expect(container.getElementsByTagName("textarea")[0]).toBeValid()
})
Severity: Major
Found in components/frontend/src/fields/TextInput.test.js and 1 other location - About 2 hrs to fix
components/frontend/src/fields/TextInput.test.js on lines 43..46

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

it("shows an error for required empty fields, when read only", () => {
    const { container } = render(<TextInput requiredPermissions={["test"]} value="" required />)
    expect(container.getElementsByTagName("textarea")[0]).toBeInvalid()
})
Severity: Major
Found in components/frontend/src/fields/TextInput.test.js and 1 other location - About 2 hrs to fix
components/frontend/src/fields/TextInput.test.js on lines 48..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 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 5 locations. Consider refactoring.
Open

it("shows an error for required empty fields, when editable", () => {
    const { container } = render(<TextInput value="" required />)
    expect(container.getElementsByTagName("textarea")[0]).toBeInvalid()
})
Severity: Major
Found in components/frontend/src/fields/TextInput.test.js and 4 other locations - About 1 hr to fix
components/frontend/src/fields/Input.test.js on lines 52..55
components/frontend/src/fields/Input.test.js on lines 57..60
components/frontend/src/fields/Input.test.js on lines 67..70
components/frontend/src/fields/TextInput.test.js on lines 63..66

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

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 5 locations. Consider refactoring.
Open

it("does not show an error for required non-empty fields, when editable", () => {
    const { container } = render(<TextInput value="Hello" required />)
    expect(container.getElementsByTagName("textarea")[0]).toBeValid()
})
Severity: Major
Found in components/frontend/src/fields/TextInput.test.js and 4 other locations - About 1 hr to fix
components/frontend/src/fields/Input.test.js on lines 52..55
components/frontend/src/fields/Input.test.js on lines 57..60
components/frontend/src/fields/Input.test.js on lines 67..70
components/frontend/src/fields/TextInput.test.js on lines 58..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 70.

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

it("does not show an error for non-required empty fields, when editable", () => {
    const { container } = render(<TextInput value="" />)
    expect(container.getElementsByTagName("textarea")[0]).toBeValid()
})
Severity: Major
Found in components/frontend/src/fields/TextInput.test.js and 1 other location - About 1 hr to fix
components/frontend/src/fields/Input.test.js on lines 62..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 67.

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

it("shows the editable label", () => {
    render(<TextInput editableLabel="Label" />)
    expect(screen.queryByText("Label")).not.toBe(null)
})
Severity: Major
Found in components/frontend/src/fields/TextInput.test.js and 1 other location - About 1 hr to fix
components/frontend/src/fields/TextInput.test.js on lines 73..76

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

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

it("shows the label", () => {
    render(<TextInput label="Label" />)
    expect(screen.queryByText("Label")).not.toBe(null)
})
Severity: Major
Found in components/frontend/src/fields/TextInput.test.js and 1 other location - About 1 hr to fix
components/frontend/src/fields/TextInput.test.js on lines 78..81

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

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