iterative/dvc

View on GitHub

Showing 529 of 589 total issues

Function _calculate_column_widths has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

    def _calculate_column_widths(
        self, console: "Console", options: "ConsoleOptions"
    ) -> list[int]:
        """Calculate the widths of each column, including padding, not
        including borders.
Severity: Minor
Found in dvc/utils/table.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 yappi_profile has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

def yappi_profile(
    path: Optional[Union[Callable[[], str], str]] = None,
    wall_clock: Optional[bool] = True,
    separate_threads: Optional[bool] = False,
):
Severity: Minor
Found in dvc/_debug.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

BaseExecutor has 24 functions (exceeds 20 allowed). Consider refactoring.
Open

class BaseExecutor(ABC):
    """Base class for executing experiments in parallel.

    Parameters:
        root_dir: Path to SCM root.
Severity: Minor
Found in dvc/repo/experiments/executor/base.py - About 2 hrs to fix

    File data.py has 277 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    from contextlib import _GeneratorContextManager as GCM
    from contextlib import contextmanager
    from typing import Any, Optional
    
    from funcy import reraise
    Severity: Minor
    Found in dvc/api/data.py - About 2 hrs to fix

      File worktree.py has 276 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      from collections.abc import Iterable
      from functools import partial
      from typing import TYPE_CHECKING, Any, Optional, Union
      
      from funcy import first
      Severity: Minor
      Found in dvc/repo/worktree.py - About 2 hrs to fix

        Function commit_2_to_3 has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

        def commit_2_to_3(repo: "Repo", dry: bool = False):
            """Force-commit all legacy outputs to use DVC 3.0 hashes."""
            from dvc.dvcfile import ProjectFile
            from dvc.ui import ui
        
        
        Severity: Minor
        Found in dvc/repo/commit.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 _merge_params has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

        def _merge_params(s_list) -> dict[str, list[str]]:
            d = defaultdict(list)
            default_file = ParamsDependency.DEFAULT_PARAMS_FILE
        
            # figure out completely tracked params file, and ignore specific keys
        Severity: Minor
        Found in dvc/dependency/__init__.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 __pretty_exc__ has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

            def __pretty_exc__(self, **kwargs: Any) -> None:  # noqa: C901
                from ruamel.yaml.error import MarkedYAMLError
        
                exc = self.exc.__cause__
        
        
        Severity: Minor
        Found in dvc/utils/strictyaml.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 _show_diff has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

            def _show_diff(diff, hide_missing=False):
                """
                Given a diff structure, generate a string of paths separated
                by new lines and grouped together by their state.
        
        
        Severity: Minor
        Found in dvc/commands/diff.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 resolve_name has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

        def resolve_name(
            scm: "Git",
            exp_names: Union[Iterable[str], str],
            git_remote: Optional[str] = None,
        ) -> dict[str, Optional[ExpRefInfo]]:
        Severity: Minor
        Found in dvc/repo/experiments/utils.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 _reproduce has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

        def _reproduce(
            stages: list["Stage"],
            graph: Optional["DiGraph"] = None,
            force_downstream: bool = False,
            on_error: str = "fail",
        Severity: Minor
        Found in dvc/repo/reproduce.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_tree_structure has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

        def _build_tree_structure(
            entries, with_color=False, with_size=False, with_hash=False, _depth=0, _prefix=""
        ):
            rows = []
            fmt = _get_formatter(with_color)
        Severity: Minor
        Found in dvc/commands/ls/__init__.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

        File path_info.py has 267 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import os
        import pathlib
        import posixpath
        import sys
        from typing import Callable, ClassVar
        Severity: Minor
        Found in dvc/testing/path_info.py - About 2 hrs to fix

          Function __init__ has 19 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def __init__(  # noqa: PLR0913
          Severity: Major
          Found in dvc/output.py - About 2 hrs to fix

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

            class URLInfo(_BasePath):
                DEFAULT_PORTS: ClassVar[dict[str, int]] = {
                    "http": 80,
                    "https": 443,
                    "ssh": 22,
            Severity: Minor
            Found in dvc/testing/path_info.py - About 2 hrs to fix

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

                  def restore(self, stage, run_cache=True, pull=False, dry=False):  # noqa: C901
                      from .serialize import to_single_stage_lockfile
              
                      if not _can_hash(stage):
                          raise RunCacheNotFoundError(stage)
              Severity: Minor
              Found in dvc/stage/cache.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 commit has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
              Open

                  def commit(
                      cls,
                      scm: "Git",
                      exp_hash: str,
                      exp_name: Optional[str] = None,
              Severity: Minor
              Found in dvc/repo/experiments/executor/base.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_graph has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
              Open

              def build_graph(stages, outs_trie=None):
                  """Generate a graph by using the given stages on the given directory
              
                  The nodes of the graph are the stage's path relative to the root.
              
              
              Severity: Minor
              Found in dvc/repo/graph.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 _diff has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
              Open

              def _diff(old, new, data_keys, with_missing=False):
                  from dvc_data.index.diff import ADD, DELETE, MODIFY, RENAME
                  from dvc_data.index.diff import diff as idiff
              
                  ret: dict[str, list[dict]] = {
              Severity: Minor
              Found in dvc/repo/diff.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 update has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
              Open

              def update(  # noqa: C901
                  self,
                  targets=None,
                  rev=None,
                  recursive=False,
              Severity: Minor
              Found in dvc/repo/update.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

              Severity
              Category
              Status
              Source
              Language