ICTU/quality-time

View on GitHub

Showing 142 of 681 total issues

Function __calculate_status has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def __calculate_status(self, value: str | None) -> Status | None:
        """Determine the status of the measurement."""
        target, near_target, debt_target = (
            self.get("target"),
            self.get("near_target"),
Severity: Minor
Found in components/shared_code/src/shared/model/measurement.py - About 35 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 _include_entity has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def _include_entity(self, entity: Entity) -> bool:
        """Return whether the card should be included."""

        def card_is_inactive() -> bool:
            """Return whether the card is inactive."""
Severity: Minor
Found in components/collector/src/source_collectors/trello/issues.py - About 35 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 post_reports_overview_attribute has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def post_reports_overview_attribute(reports_attribute: str, database: Database):
    """Set a reports overview attribute."""
    new_value = dict(bottle.request.json)[reports_attribute]
    if reports_attribute == "comment" and new_value:
        new_value = sanitize_html(new_value)
Severity: Minor
Found in components/api_server/src/routes/reports_overview.py - About 35 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 match_string_or_regular_expression has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def match_string_or_regular_expression(string: str, strings_and_or_regular_expressions: Collection[str]) -> bool:
    """Return whether the string is equal to one of the strings or matches one of the regular expressions."""
    for string_or_regular_expression in strings_and_or_regular_expressions:
        if is_regexp(string_or_regular_expression):
            if re.match(string_or_regular_expression, string):
Severity: Minor
Found in components/collector/src/collector_utilities/functions.py - About 35 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 sources has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def sources(report, metric_types: Sequence[str], source_type: str, parameter: str):
    """Yield the sources in the report, filtered by metric type, source type, and parameter."""
    for metric in metrics(report, metric_types):
        for source in metric.get("sources", {}).values():
            if source["type"] == source_type and parameter in source["parameters"]:
Severity: Minor
Found in components/api_server/src/initialization/migrations.py - About 35 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 metric_section has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def metric_section(metric_key: str, metric: Metric, level: int) -> str:
    """Return the metric as Markdown section."""
    markdown = markdown_header(metric.name, level=level, index=True)
    markdown += markdown_paragraph(metric.description)
    name = decapitalize(metric.name)
Severity: Minor
Found in docs/src/create_reference_md.py - About 35 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

Avoid too many return statements within this function.
Open

        return <StringInput {...parameter_props} error={warning} />
Severity: Major
Found in components/frontend/src/source/SourceParameter.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

        return (
            <VictoryChart
                height={chartHeight}
                scale={{ x: "time", y: "linear" }}
                style={{
    Severity: Major
    Found in components/frontend/src/metric/TrendGraph.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

          return fetch_server_api("get", `changelog/${nr_changes}`)
      Severity: Major
      Found in components/frontend/src/api/changelog.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                return true
        Severity: Major
        Found in components/frontend/src/fields/IntegerInput.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

              return (
                  <Table className="entities stickyHeader" sortable size="small">
                      <Table.Header>{headers}</Table.Header>
                      <Table.Body>{rows}</Table.Body>
                  </Table>
          Severity: Major
          Found in components/frontend/src/source/SourceEntities.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                    return (
                        <Message
                            header="Measurement details not available"
                            content="There are currently no measurement details available."
                        />
            Severity: Major
            Found in components/frontend/src/source/SourceEntities.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                      return <StringInput {...parameter_props} />
              Severity: Major
              Found in components/frontend/src/source/SourceParameter.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                        return <MultipleChoiceInput {...parameter_props} options={dropdownOptions(parameter_values)} />
                Severity: Major
                Found in components/frontend/src/source/SourceParameter.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                      return null
                  Severity: Major
                  Found in components/frontend/src/source/SourceParameter.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                            return <MultipleChoiceInput {...parameter_props} options={dropdownOptions(parameter_values)} allowAdditions />
                    Severity: Major
                    Found in components/frontend/src/source/SourceParameter.js - About 30 mins to fix

                      Function DashboardCard has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                      export function DashboardCard({ children, onClick, selected, title, titleFirst }) {
                          const color = selected ? "info.main" : null
                          const header = (
                              <CardHeader
                                  title={title}
                      Severity: Minor
                      Found in components/frontend/src/dashboard/DashboardCard.js - About 25 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 showMessage has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                      export function showMessage(type, title, description, messageId) {
                          const hideToasts = registeredURLSearchParams().get("hide_toasts")
                          if (hideToasts !== "true") {
                              const toastMessage =
                                  title && description ? (
                      Severity: Minor
                      Found in components/frontend/src/widgets/toast.js - About 25 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_logos has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def check_logos(self) -> None:
                              """Check that a logo exists for each source and vice versa."""
                              logos_path = pathlib.Path(__file__).parent.parent / "logos"
                              for source_type in self.sources:
                                  logo_path = logos_path / f"{source_type}.png"
                      Severity: Minor
                      Found in components/shared_code/src/shared_data_model/meta/data_model.py - About 25 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 ReadOnlyInput has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                      export function ReadOnlyInput({ error, label, placeholder, prefix, required, value, type, unit }) {
                          return (
                              <Form.Input
                                  error={error || (required && value === "")}
                                  fluid
                      Severity: Minor
                      Found in components/frontend/src/fields/ReadOnlyInput.js - About 25 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

                      Severity
                      Category
                      Status
                      Source
                      Language