ICTU/quality-time

View on GitHub

Showing 142 of 681 total issues

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

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

      import { render, screen, waitFor } from "@testing-library/react"
      import userEvent from "@testing-library/user-event"
      
      import { DataModel } from "../context/DataModel"
      import { SourceEntities } from "./SourceEntities"
      Severity: Minor
      Found in components/frontend/src/source/SourceEntities.test.js - About 2 hrs to fix

        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

          Function MultipleChoiceInput has 48 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export function MultipleChoiceInput(props) {
              let { allowAdditions, editableLabel, onSearchChange, required, set_value, requiredPermissions, ...otherProps } =
                  props
              const [values, setValues] = useState(props.value || [])
              const [searchQuery, setSearchQuery] = useState("")
          Severity: Minor
          Found in components/frontend/src/fields/MultipleChoiceInput.js - About 1 hr to fix

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

            export function SourceEntityAttribute({ entity, entityAttribute }) {
                let cellContents = limitTextLength(entity[entityAttribute.key] ?? "")
                // See the data model (components/shared_code/src/shared_data_model/meta/entity.py) for possible entity attribute
                // types. Note that if entity attribute types are removed old types need to be supported to allow for time travel.
                const type = entityAttribute.type ?? ""
            Severity: Minor
            Found in components/frontend/src/source/SourceEntityAttribute.js - About 1 hr to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Function renderMetricDetails has 47 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            async function renderMetricDetails(stopFilteringAndSorting, connection_error, failLoadingMeasurements) {
                measurement_api.get_metric_measurements.mockImplementation(() => {
                    if (failLoadingMeasurements) {
                        return Promise.reject(new Error("failed to load measurements"))
                    } else {
            Severity: Minor
            Found in components/frontend/src/metric/MetricDetails.test.js - About 1 hr to fix

              Function ReactionTimes has 46 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function ReactionTimes(props) {
                  return (
                      <>
                          <Segment>
                              <Label attached="top" size="large">
              Severity: Minor
              Found in components/frontend/src/report/ReportTitle.js - About 1 hr to fix

                Function groups has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    const groups = Object.values(parameterLayout).map((parameterGroup) => {
                        const parameterKeys = applicableParameters(allParameters, remainingParameters, parameterGroup, metric)
                        if (parameterKeys.length === 0) {
                            return null
                        }
                Severity: Minor
                Found in components/frontend/src/source/SourceParameters.js - About 1 hr to fix

                  Function issuePopupContent has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function issuePopupContent(issueStatus) {
                      let popupContent = <TimeAgoWithDate date={issueStatus.created}>Created</TimeAgoWithDate>
                      if (issueStatus.updated) {
                          popupContent = (
                              <>
                  Severity: Minor
                  Found in components/frontend/src/issue/IssueStatus.js - About 1 hr to fix

                    Function AppUI has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                    Open

                    export function AppUI({
                        changed_fields,
                        dataModel,
                        email,
                        handleDateChange,
                    Severity: Minor
                    Found in components/frontend/src/AppUI.js - About 1 hr to fix

                    Cognitive Complexity

                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                    A method's cognitive complexity is based on a few simple rules:

                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                    • Code is considered more complex for each "break in the linear flow of the code"
                    • Code is considered more complex when "flow breaking structures are nested"

                    Further reading

                    Function _include_entity_based_on_tags has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def _include_entity_based_on_tags(self, entity: Entity) -> bool:
                            """Return whether to include the entity based on the tags."""
                            tags = entity["tags"].split(", ")
                            if tags_to_include := self._parameter("tags_to_include"):
                                for tag in tags:
                    Severity: Minor
                    Found in components/collector/src/source_collectors/axe_core/violations.py - About 1 hr to fix

                    Cognitive Complexity

                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                    A method's cognitive complexity is based on a few simple rules:

                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                    • Code is considered more complex for each "break in the linear flow of the code"
                    • Code is considered more complex when "flow breaking structures are nested"

                    Further reading

                    Function parameter_description has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def parameter_description(parameter: Parameter) -> str:
                        """Return the Markdown version of the parameter."""
                        short_name = parameter.short_name
                        help_text = " " + parameter.help if parameter.help else ""
                        if parameter.type in ("single_choice", "multiple_choice"):
                    Severity: Minor
                    Found in docs/src/create_reference_md.py - About 1 hr to fix

                    Cognitive Complexity

                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                    A method's cognitive complexity is based on a few simple rules:

                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                    • Code is considered more complex for each "break in the linear flow of the code"
                    • Code is considered more complex when "flow breaking structures are nested"

                    Further reading

                    Function sourceEntitiesHeaders has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function sourceEntitiesHeaders(
                        entityAttributes,
                        hideIgnoredEntities,
                        metricEntities,
                        setHideIgnoredEntities,
                    Severity: Minor
                    Found in components/frontend/src/source/SourceEntities.js - About 1 hr to fix

                      Function renderIssueStatus has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function renderIssueStatus({
                          connectionError = false,
                          created = true,
                          due = false,
                          issueTrackerMissing = false,
                      Severity: Minor
                      Found in components/frontend/src/issue/IssueStatus.test.js - About 1 hr to fix

                      Cognitive Complexity

                      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                      A method's cognitive complexity is based on a few simple rules:

                      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                      • Code is considered more complex for each "break in the linear flow of the code"
                      • Code is considered more complex when "flow breaking structures are nested"

                      Further reading

                      Function get_notifications has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def get_notifications(
                              self,
                              reports: list[Report],
                              measurements: list[Measurement],
                              most_recent_measurement_seen: datetime,
                      Severity: Minor
                      Found in components/notifier/src/strategies/notification_strategy.py - About 1 hr to fix

                      Cognitive Complexity

                      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                      A method's cognitive complexity is based on a few simple rules:

                      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                      • Code is considered more complex for each "break in the linear flow of the code"
                      • Code is considered more complex when "flow breaking structures are nested"

                      Further reading

                      Function popupText has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function popupText(metric, debtEndDateInThePast, allIssuesDone, dataModel) {
                          const unit = formatMetricScaleAndUnit(metric, dataModel)
                          const metricDirection = formatMetricDirection(metric, dataModel)
                          let debtEndDateText = ""
                          let endDate
                      Severity: Minor
                      Found in components/frontend/src/measurement/MeasurementTarget.js - About 1 hr to fix

                      Cognitive Complexity

                      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                      A method's cognitive complexity is based on a few simple rules:

                      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                      • Code is considered more complex for each "break in the linear flow of the code"
                      • Code is considered more complex when "flow breaking structures are nested"

                      Further reading

                      Function Input has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export function Input(props) {
                          let { editableLabel, label, error, prefix, required, set_value, warning, ...otherProps } = props
                          const initialValue = props.value || ""
                          const [value, setValue] = useState(initialValue)
                      
                      
                      Severity: Minor
                      Found in components/frontend/src/fields/Input.js - About 1 hr to fix

                        Function source_options has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export function source_options(reports, dataModel, currentMetricType, currentMetricUuid) {
                            const metricSources = dataModel.metrics[currentMetricType].sources
                            let options = []
                            reports.forEach((report) => {
                                Object.values(report.subjects).forEach((subject) => {
                        Severity: Minor
                        Found in components/frontend/src/widgets/menu_options.js - About 1 hr to fix

                          Function EditableTextInput has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          function EditableTextInput(props) {
                              let { label, required, set_value, ...otherProps } = props
                              const initialValue = props.value || ""
                              const [text, setText] = useState(initialValue)
                          
                          
                          Severity: Minor
                          Found in components/frontend/src/fields/TextInput.js - About 1 hr to fix
                            Severity
                            Category
                            Status
                            Source
                            Language