iterative/dvc

View on GitHub

Showing 517 of 578 total issues

File vega.py has 260 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import os
from collections.abc import Iterable
from typing import Any, Optional, Union

from funcy import first, last
Severity: Minor
Found in dvc/render/converter/vega.py - About 2 hrs to fix

    Config has 21 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Config(dict):
        """Class that manages configuration files for a DVC repo.
    
        Args:
            dvc_dir (str): optional path to `.dvc` directory, that is used to
    Severity: Minor
    Found in dvc/config.py - About 2 hrs to fix

      Function rich_print has 17 arguments (exceeds 4 allowed). Consider refactoring.
      Open

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

        Function fetch has 17 arguments (exceeds 4 allowed). Consider refactoring.
        Open

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

          Function used_objs has 17 arguments (exceeds 4 allowed). Consider refactoring.
          Open

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

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

            def collect_rev(
                repo: "Repo",
                rev: str,
                param_deps: bool = False,
                force: bool = False,
            Severity: Minor
            Found in dvc/repo/experiments/collect.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 get_exact_name has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
            Open

                def get_exact_name(self, revs: Iterable[str]) -> dict[str, Optional[str]]:
                    """Returns preferred name for the specified revision.
            
                    Prefers tags, branches (heads), experiments in that order.
                    """
            Severity: Minor
            Found in dvc/repo/experiments/__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 build_outs_graph has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
            Open

            def build_outs_graph(graph, outs_trie):
                import networkx as nx
            
                from dvc.dependency import DatasetDependency
            
            
            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 _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 imp_url has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
            Open

            def imp_url(  # noqa: PLR0913
                self: "Repo",
                url,
                out=None,
                erepo=None,
            Severity: Minor
            Found in dvc/repo/imp_url.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_out_changes has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
            Open

            def _build_out_changes(index, changes):
                from dvc_data.index.checkout import MODIFY
            
                out_keys = []
                for out in index.outs:
            Severity: Minor
            Found in dvc/repo/checkout.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 _ast_assign_to_dict has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
            Open

            def _ast_assign_to_dict(assign, only_self_params=False, lineno=False):  # noqa: PLR0912
                result = {}
            
                if isinstance(assign, ast.AnnAssign):
                    name = _get_ast_name(assign.target, only_self_params)
            Severity: Minor
            Found in dvc/utils/serialize/_py.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 checkout has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
            Open

            def checkout(  # noqa: C901
                self,
                targets=None,
                with_deps=False,
                force=False,
            Severity: Minor
            Found in dvc/repo/checkout.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 __init__ has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
            Open

                def __init__(  # noqa: PLR0913
                    self,
                    stage,
                    path,
                    info=None,
            Severity: Minor
            Found in dvc/output.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 test_dir has 52 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def test_dir(self, tmp_dir, dvc, run_copy, remote_version_aware):  # noqa: PLR0915
                    (stage,) = tmp_dir.dvc_gen(
                        {
                            "data_dir": {
                                "data_sub_dir": {"data_sub": "data_sub"},
            Severity: Major
            Found in dvc/testing/remote_tests.py - About 2 hrs to fix

              Function _collect_indexes has 16 arguments (exceeds 4 allowed). Consider refactoring.
              Open

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

                Function add_parser has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                def add_parser(subparsers, _parent_parser):
                    from dvc.commands.status import CmdDataStatus
                
                    # Pull
                    PULL_HELP = "Download tracked files or directories from remote storage."
                Severity: Minor
                Found in dvc/commands/data_sync.py - About 2 hrs to fix

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

                  def _collect_indexes(  # noqa: PLR0913
                      repo,
                      targets=None,
                      remote=None,
                      all_branches=False,
                  Severity: Minor
                  Found in dvc/repo/fetch.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 collect_granular has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def collect_granular(
                          self,
                          target: Optional[str] = None,
                          with_deps: bool = False,
                          recursive: bool = False,
                  Severity: Minor
                  Found in dvc/repo/stage.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 parse_target has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def parse_target(
                      target: str, default: Optional[str] = None, isa_glob: bool = False
                  ) -> tuple[Optional[str], Optional[str]]:
                      from dvc.dvcfile import LOCK_FILE, PROJECT_FILE, is_valid_filename
                      from dvc.exceptions import DvcException
                  Severity: Minor
                  Found in dvc/utils/__init__.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

                  Severity
                  Category
                  Status
                  Source
                  Language