ICTU/quality-time

View on GitHub

Showing 684 of 684 total issues

File create_reference_md.py has 264 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""Script to convert the data model in a Markdown file."""

import pathlib
import re
from typing import Literal
Severity: Minor
Found in docs/src/create_reference_md.py - About 2 hrs to fix

    Metric has 22 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Metric(dict):
        """Class representing a metric."""
    
        def __init__(
            self,
    Severity: Minor
    Found in components/shared_code/src/shared/model/metric.py - About 2 hrs to fix

      File gitlab.py has 263 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      """GitLab source."""
      
      from pydantic import HttpUrl
      
      from shared_data_model.meta.entity import Color, Entity, EntityAttribute, EntityAttributeType
      Severity: Minor
      Found in components/shared_code/src/shared_data_model/sources/gitlab.py - About 2 hrs to fix

        Identical blocks of code found in 3 locations. Consider refactoring.
        Open

            fetch_server_api.fetch_server_api = jest.fn().mockReturnValue({
                then: jest.fn().mockReturnValue({ catch: jest.fn().mockReturnValue({ finally: jest.fn() }) }),
            })
        components/frontend/src/App.test.js on lines 25..27
        components/frontend/src/AppUI.test.js on lines 10..12

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

        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

        Identical blocks of code found in 3 locations. Consider refactoring.
        Open

            fetch_server_api.fetch_server_api = jest.fn().mockReturnValue({
                then: jest.fn().mockReturnValue({ catch: jest.fn().mockReturnValue({ finally: jest.fn() }) }),
            })
        Severity: Major
        Found in components/frontend/src/AppUI.test.js and 2 other locations - About 2 hrs to fix
        components/frontend/src/App.test.js on lines 25..27
        components/frontend/src/header_footer/DownloadAsPDFButton.test.js on lines 8..10

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

        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

        Identical blocks of code found in 3 locations. Consider refactoring.
        Open

            fetch_server_api.fetch_server_api = jest.fn().mockReturnValue({
                then: jest.fn().mockReturnValue({ catch: jest.fn().mockReturnValue({ finally: jest.fn() }) }),
            })
        Severity: Major
        Found in components/frontend/src/App.test.js and 2 other locations - About 2 hrs to fix
        components/frontend/src/AppUI.test.js on lines 10..12
        components/frontend/src/header_footer/DownloadAsPDFButton.test.js on lines 8..10

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

        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

        export function AppUI({
            changed_fields,
            dataModel,
            email,
            handleDateChange,
        Severity: Major
        Found in components/frontend/src/AppUI.js and 1 other location - About 2 hrs to fix
        components/frontend/src/AppUI.js on lines 125..142

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

        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

        AppUI.propTypes = {
            changed_fields: stringsPropType,
            dataModel: object,
            email: string,
            handleDateChange: func,
        Severity: Major
        Found in components/frontend/src/AppUI.js and 1 other location - About 2 hrs to fix
        components/frontend/src/AppUI.js on lines 26..43

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

        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

        File Menubar.js has 262 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import "./Menubar.css"
        
        import { element, func, string } from "prop-types"
        import { useEffect, useState } from "react"
        import FocusLock from "react-focus-lock"
        Severity: Minor
        Found in components/frontend/src/header_footer/Menubar.js - About 2 hrs to fix

          Function SourceEntityAttribute has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
          Open

          export function SourceEntityAttribute({ entity, entityAttribute }) {
              let cellContents = entity[entityAttribute.key] ?? ""
              if (typeof cellContents === "string" && cellContents.length >= 250) {
                  cellContents = cellContents.slice(0, 247) + "..."
              }
          Severity: Minor
          Found in components/frontend/src/source/SourceEntityAttribute.js - 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

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

                          <Grid.Column>
                              <StringInput
                                  id="report-title"
                                  label="Report title"
                                  requiredPermissions={[EDIT_REPORT_PERMISSION]}
          Severity: Major
          Found in components/frontend/src/report/ReportTitle.js and 1 other location - About 2 hrs to fix
          components/frontend/src/report/ReportTitle.js on lines 37..45

          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

                          <Grid.Column>
                              <StringInput
                                  id="report-subtitle"
                                  label="Report subtitle"
                                  requiredPermissions={[EDIT_REPORT_PERMISSION]}
          Severity: Major
          Found in components/frontend/src/report/ReportTitle.js and 1 other location - About 2 hrs to fix
          components/frontend/src/report/ReportTitle.js on lines 28..36

          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

          it("does not render the time left if technical debt is accepted without an end date", () => {
              render(<TimeLeft metric={{ status: "debt_target_met", status_start: "2022-01-01" }} report={{}} />)
              expect(screen.queryAllByText(/day/).length).toBe(0)
          })
          Severity: Major
          Found in components/frontend/src/measurement/TimeLeft.test.js and 1 other location - About 2 hrs to fix
          components/frontend/src/measurement/TimeLeft.test.js on lines 34..37

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

          it("renders 0 days left if the deadline is in the past", () => {
              render(<TimeLeft metric={{ status: "target_not_met", status_start: "2022-01-01" }} report={{}} />)
              expect(screen.queryAllByText(/0 days/).length).toBe(1)
          })
          Severity: Major
          Found in components/frontend/src/measurement/TimeLeft.test.js and 1 other location - About 2 hrs to fix
          components/frontend/src/measurement/TimeLeft.test.js on lines 29..32

          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

          File IssueTracker.js has 258 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import { func } from "prop-types"
          import { useContext, useEffect, useState } from "react"
          import { Grid, Header } from "semantic-ui-react"
          
          import { get_report_issue_tracker_options, set_report_issue_tracker_attribute } from "../api/report"
          Severity: Minor
          Found in components/frontend/src/report/IssueTracker.js - About 2 hrs to fix

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

                if (issueStatus.created && settings.showIssueCreationDate.value) {
                    details.push(
                        <Label.Detail key="created">
                            Created <TimeAgo date={issueStatus.created} />
                        </Label.Detail>,
            Severity: Major
            Found in components/frontend/src/issue/IssueStatus.js and 2 other locations - About 2 hrs to fix
            components/frontend/src/issue/IssueStatus.js on lines 50..56
            components/frontend/src/issue/IssueStatus.js on lines 57..63

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

            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

                if (issueStatus.updated && settings.showIssueUpdateDate.value) {
                    details.push(
                        <Label.Detail key="updated">
                            Updated <TimeAgo date={issueStatus.updated} />
                        </Label.Detail>,
            Severity: Major
            Found in components/frontend/src/issue/IssueStatus.js and 2 other locations - About 2 hrs to fix
            components/frontend/src/issue/IssueStatus.js on lines 43..49
            components/frontend/src/issue/IssueStatus.js on lines 57..63

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

            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("renders the measurements with zero length", () => {
                renderTrendgraph({
                    measurements: [{ count: { value: "1" }, start: "2019-09-29", end: "2019-09-29" }],
                })
                expect(screen.getAllByText(/Time/).length).toBe(1)
            Severity: Major
            Found in components/frontend/src/metric/TrendGraph.test.js and 2 other locations - About 2 hrs to fix
            components/frontend/src/metric/TrendGraph.test.js on lines 28..33
            components/frontend/src/metric/TrendGraph.test.js on lines 63..68

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

            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