ICTU/quality-time

View on GitHub

Showing 692 of 692 total issues

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

export function MeasurementValue({ metric, reportDate }) {
    const dataModel = useContext(DataModel)
    const metricValue = getMetricValue(metric, dataModel)
    let value = metricValue || "?"
    const scale = getMetricScale(metric, dataModel)
Severity: Minor
Found in components/frontend/src/measurement/MeasurementValue.js - 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 access_parameters has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def access_parameters(
    metrics: list[str],
    include: dict[str, bool] | None = None,
    source_type: str = "",
    source_type_format: Literal["", "CSV", "HTML", "JSON", "XML"] = "",
Severity: Minor
Found in components/shared_code/src/shared_data_model/parameters.py - 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 check_source_has_parameters_for_each_supported_metric has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def check_source_has_parameters_for_each_supported_metric(self) -> None:
        """Check that the sources have at least one parameter for each metric supported by the source."""
        for metric_key, metric in self.metrics.items():
            for source_key in metric.sources:
                source = self.sources[source_key]
Severity: Minor
Found in components/shared_code/src/shared_data_model/meta/data_model.py - 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

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

test("DownloadAsPDFButton has the correct label for reports overview", () => {
    render(<DownloadAsPDFButton />)
    expect(screen.getAllByLabelText(/reports overview as PDF/).length).toBe(1)
})
components/frontend/src/App.test.js on lines 45..48
components/frontend/src/fields/Comment.test.js on lines 5..8
components/frontend/src/fields/IntegerInput.test.js on lines 106..109

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

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

it("shows the placeholder", () => {
    renderPasswordInput({ placeholder: "Enter password" })
    expect(screen.queryByPlaceholderText(/Enter password/)).not.toBe(null)
})
Severity: Major
Found in components/frontend/src/fields/PasswordInput.test.js and 2 other locations - About 55 mins to fix
components/frontend/src/fields/ReadOnlyInput.test.js on lines 16..19
components/frontend/src/fields/ReadOnlyInput.test.js on lines 21..24

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

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

it("displays the status category doing", () => {
    renderIssueStatus({ statusCategory: "doing" })
    expect(screen.getByText(/123/).className).toContain("blue")
})
Severity: Major
Found in components/frontend/src/issue/IssueStatus.test.js and 2 other locations - About 55 mins to fix
components/frontend/src/issue/IssueStatus.test.js on lines 79..82
components/frontend/src/issue/IssueStatus.test.js on lines 84..87

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

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

it("renders a string parameter with placeholder", () => {
    renderSourceParameters({ placeholder: "Placeholder" })
    expect(screen.queryAllByPlaceholderText(/Placeholder/).length).toBe(1)
})
Severity: Major
Found in components/frontend/src/source/SourceParameters.test.js and 6 other locations - About 55 mins to fix
components/frontend/src/metric/MetricDebtParameters.test.js on lines 114..117
components/frontend/src/metric/Target.test.js on lines 80..83
components/frontend/src/source/SourceEntity.test.js on lines 37..40
components/frontend/src/source/SourceEntity.test.js on lines 52..55
components/frontend/src/source/SourceParameters.test.js on lines 76..79
components/frontend/src/source/SourceTypeHeader.test.js on lines 31..34

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

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("shows spinner", async () => {
    render(<App />)
    expect(screen.getAllByLabelText(/Loading/).length).toBe(1)
})
Severity: Major
Found in components/frontend/src/App.test.js and 3 other locations - About 55 mins to fix
components/frontend/src/fields/Comment.test.js on lines 5..8
components/frontend/src/fields/IntegerInput.test.js on lines 106..109
components/frontend/src/header_footer/DownloadAsPDFButton.test.js on lines 13..16

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

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

it("renders the source parameter value", () => {
    renderSourceParameters({ source_parameter_value: "Value" })
    expect(screen.queryAllByDisplayValue(/Value/).length).toBe(1)
})
Severity: Major
Found in components/frontend/src/source/SourceParameters.test.js and 6 other locations - About 55 mins to fix
components/frontend/src/metric/MetricDebtParameters.test.js on lines 114..117
components/frontend/src/metric/Target.test.js on lines 80..83
components/frontend/src/source/SourceEntity.test.js on lines 37..40
components/frontend/src/source/SourceEntity.test.js on lines 52..55
components/frontend/src/source/SourceParameters.test.js on lines 66..69
components/frontend/src/source/SourceTypeHeader.test.js on lines 31..34

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

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("has the comment label", () => {
    render(<Comment />)
    expect(screen.getAllByText(/Comment/).length).toBe(1)
})
Severity: Major
Found in components/frontend/src/fields/Comment.test.js and 3 other locations - About 55 mins to fix
components/frontend/src/App.test.js on lines 45..48
components/frontend/src/fields/IntegerInput.test.js on lines 106..109
components/frontend/src/header_footer/DownloadAsPDFButton.test.js on lines 13..16

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

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

it("displays the postfix", () => {
    renderReadOnlyInput({ unit: "postfix" })
    expect(screen.queryByText(/postfix/)).not.toBe(null)
})
Severity: Major
Found in components/frontend/src/fields/ReadOnlyInput.test.js and 2 other locations - About 55 mins to fix
components/frontend/src/fields/PasswordInput.test.js on lines 14..17
components/frontend/src/fields/ReadOnlyInput.test.js on lines 16..19

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

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

it("displays the status category done", () => {
    renderIssueStatus({ statusCategory: "done" })
    expect(screen.getByText(/123/).className).toContain("green")
})
Severity: Major
Found in components/frontend/src/issue/IssueStatus.test.js and 2 other locations - About 55 mins to fix
components/frontend/src/issue/IssueStatus.test.js on lines 74..77
components/frontend/src/issue/IssueStatus.test.js on lines 79..82

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

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

it("displays the default target if changed", () => {
    renderMetricTarget({ type: "violations_with_default_target" })
    expect(screen.queryAllByText(/default:/).length).toBe(1)
})
Severity: Major
Found in components/frontend/src/metric/Target.test.js and 6 other locations - About 55 mins to fix
components/frontend/src/metric/MetricDebtParameters.test.js on lines 114..117
components/frontend/src/source/SourceEntity.test.js on lines 37..40
components/frontend/src/source/SourceEntity.test.js on lines 52..55
components/frontend/src/source/SourceParameters.test.js on lines 66..69
components/frontend/src/source/SourceParameters.test.js on lines 76..79
components/frontend/src/source/SourceTypeHeader.test.js on lines 31..34

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

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

it("renders the fixed status", () => {
    renderSourceEntity({ status: "fixed" })
    expect(screen.getAllByText(/Fixed/).length).toBe(1)
})
Severity: Major
Found in components/frontend/src/source/SourceEntity.test.js and 6 other locations - About 55 mins to fix
components/frontend/src/metric/MetricDebtParameters.test.js on lines 114..117
components/frontend/src/metric/Target.test.js on lines 80..83
components/frontend/src/source/SourceEntity.test.js on lines 52..55
components/frontend/src/source/SourceParameters.test.js on lines 66..69
components/frontend/src/source/SourceParameters.test.js on lines 76..79
components/frontend/src/source/SourceTypeHeader.test.js on lines 31..34

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

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

it("does not point users to specific information in the docs if the information is for other metric types", () => {
    renderSourceTypeHeader({ other_metric: "Generic documentation" })
    expect(screen.queryAllByText(/specific information/).length).toBe(0)
})
Severity: Major
Found in components/frontend/src/source/SourceTypeHeader.test.js and 6 other locations - About 55 mins to fix
components/frontend/src/metric/MetricDebtParameters.test.js on lines 114..117
components/frontend/src/metric/Target.test.js on lines 80..83
components/frontend/src/source/SourceEntity.test.js on lines 37..40
components/frontend/src/source/SourceEntity.test.js on lines 52..55
components/frontend/src/source/SourceParameters.test.js on lines 66..69
components/frontend/src/source/SourceParameters.test.js on lines 76..79

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

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

it("displays the prefix", () => {
    renderReadOnlyInput({ prefix: "prefix" })
    expect(screen.queryByText(/prefix/)).not.toBe(null)
})
Severity: Major
Found in components/frontend/src/fields/ReadOnlyInput.test.js and 2 other locations - About 55 mins to fix
components/frontend/src/fields/PasswordInput.test.js on lines 14..17
components/frontend/src/fields/ReadOnlyInput.test.js on lines 21..24

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

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

it("displays the status category todo", () => {
    renderIssueStatus({ statusCategory: "todo" })
    expect(screen.getByText(/123/).className).toContain("grey")
})
Severity: Major
Found in components/frontend/src/issue/IssueStatus.test.js and 2 other locations - About 55 mins to fix
components/frontend/src/issue/IssueStatus.test.js on lines 74..77
components/frontend/src/issue/IssueStatus.test.js on lines 84..87

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

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

it("shows days ago for the technical debt end date", () => {
    renderMetricDebtParameters({ debt_end_date: "2000-01-01" })
    expect(screen.getAllByLabelText(/years ago/).length).toBe(1)
})
Severity: Major
Found in components/frontend/src/metric/MetricDebtParameters.test.js and 6 other locations - About 55 mins to fix
components/frontend/src/metric/Target.test.js on lines 80..83
components/frontend/src/source/SourceEntity.test.js on lines 37..40
components/frontend/src/source/SourceEntity.test.js on lines 52..55
components/frontend/src/source/SourceParameters.test.js on lines 66..69
components/frontend/src/source/SourceParameters.test.js on lines 76..79
components/frontend/src/source/SourceTypeHeader.test.js on lines 31..34

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

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

it("renders the first seen datetime", () => {
    renderSourceEntity({ first_seen: "2023-07-17" })
    expect(screen.getAllByText(/ago/).length).toBe(1)
})
Severity: Major
Found in components/frontend/src/source/SourceEntity.test.js and 6 other locations - About 55 mins to fix
components/frontend/src/metric/MetricDebtParameters.test.js on lines 114..117
components/frontend/src/metric/Target.test.js on lines 80..83
components/frontend/src/source/SourceEntity.test.js on lines 37..40
components/frontend/src/source/SourceParameters.test.js on lines 66..69
components/frontend/src/source/SourceParameters.test.js on lines 76..79
components/frontend/src/source/SourceTypeHeader.test.js on lines 31..34

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

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("renders missing value as 0", () => {
    render(<IntegerInput />)
    expect(screen.queryAllByDisplayValue(/0/).length).toBe(1)
})
Severity: Major
Found in components/frontend/src/fields/IntegerInput.test.js and 3 other locations - About 55 mins to fix
components/frontend/src/App.test.js on lines 45..48
components/frontend/src/fields/Comment.test.js on lines 5..8
components/frontend/src/header_footer/DownloadAsPDFButton.test.js on lines 13..16

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

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

Severity
Category
Status
Source
Language