iterative/dvc

View on GitHub
dvc/repo/experiments/show.py

Summary

Maintainability
D
2 days
Test Coverage

File show.py has 321 lines of code (exceeds 250 allowed). Consider refactoring.
Open

from collections import Counter, defaultdict
from collections.abc import Iterable, Iterator, Mapping
from datetime import date, datetime
from typing import TYPE_CHECKING, Any, Literal, NamedTuple, Optional, Union

Severity: Minor
Found in dvc/repo/experiments/show.py - About 3 hrs to fix

    Function _data_cells has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

    def _data_cells(
        exp: "ExpState",
        *,
        metrics_headers: Iterable[str],
        params_headers: Iterable[str],
    Severity: Minor
    Found in dvc/repo/experiments/show.py - 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

    Function _sort_column has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

    def _sort_column(  # noqa: C901
        sort_by: str,
        metric_names: Mapping[str, Iterable[str]],
        param_names: Mapping[str, Iterable[str]],
    ) -> tuple[str, str, str]:
    Severity: Minor
    Found in dvc/repo/experiments/show.py - 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

    Function _build_rows has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

    def _build_rows(
        baseline_states: Iterable["ExpState"],
        *,
        all_headers: Iterable[str],
        fill_value: Optional[str],
    Severity: Minor
    Found in dvc/repo/experiments/show.py - 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

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

    def _collect_names(exp_states: Iterable["ExpState"]) -> _DataNames:
        result = _DataNames(defaultdict(dict), defaultdict(dict), set())
    
        def _collect_d(result_d: dict[str, dict[str, Any]], data_d: dict[str, Any]):
            for path, item in data_d.items():
    Severity: Minor
    Found in dvc/repo/experiments/show.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 _exp_range_rows has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    def _exp_range_rows(
        exp_range: "ExpRange",
        *,
        all_headers: Iterable[str],
        fill_value: Optional[str],
    Severity: Minor
    Found in dvc/repo/experiments/show.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 _data_cells has 11 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def _data_cells(
    Severity: Major
    Found in dvc/repo/experiments/show.py - About 1 hr to fix

      Function show has 10 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def show(
      Severity: Major
      Found in dvc/repo/experiments/show.py - About 1 hr to fix

        Function _build_rows has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def _build_rows(
        Severity: Major
        Found in dvc/repo/experiments/show.py - About 50 mins to fix

          Function _exp_range_rows has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def _exp_range_rows(
          Severity: Minor
          Found in dvc/repo/experiments/show.py - About 45 mins to fix

            Function _sort_exp has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            def _sort_exp(
            Severity: Minor
            Found in dvc/repo/experiments/show.py - About 35 mins to fix

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

                  def update(self, other: "_DataNames"):
                      def _update_d(
                          d: dict[str, dict[str, Any]], other_d: Mapping[str, Mapping[str, Any]]
                      ):
                          for k, v in other_d.items():
              Severity: Minor
              Found in dvc/repo/experiments/show.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

              There are no issues that match your filters.

              Category
              Status