iterative/dvc

View on GitHub

Showing 368 of 444 total issues

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

class URLInfo(_BasePath):
    DEFAULT_PORTS = {"http": 80, "https": 443, "ssh": 22, "hdfs": 0}

    def __init__(self, url):
        p = urlparse(url)
Severity: Minor
Found in dvc/testing/path_info.py - About 2 hrs to fix

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

        def _stash_exp(
            self,
            *args,
            params: Optional[dict] = None,
            resume_rev: Optional[str] = None,
    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 _get_steps has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

    def _get_steps(G, stages, downstream, single_item):
        import networkx as nx
    
        active = G.copy()
        if not single_item:
    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 init has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

    def init(
        repo: "Repo",
        name: str = "train",
        type: str = "default",  # pylint: disable=redefined-builtin
        defaults: Dict[str, str] = None,
    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 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 _check_circular_import has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        def _check_circular_import(self, odb, obj_ids):
            from dvc.exceptions import CircularImportError
            from dvc.fs.dvc import DvcFileSystem
            from dvc_data.db.reference import ReferenceHashFileDB
            from dvc_data.objects.tree import Tree
    Severity: Minor
    Found in dvc/dependency/repo.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 259 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    # pylint: disable=protected-access
    import os
    import pathlib
    import posixpath
    from typing import Callable
    Severity: Minor
    Found in dvc/testing/path_info.py - About 2 hrs to fix

      File config_schema.py has 257 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import os
      from urllib.parse import urlparse
      
      from funcy import walk_values
      from voluptuous import (
      Severity: Minor
      Found in dvc/config_schema.py - About 2 hrs to fix

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

        def add_parser(subparsers, parent_parser):
            from dvc.commands.config import parent_config_parser
        
            machine_HELP = "Set up and manage cloud machines."
            machine_parser = subparsers.add_parser(
        Severity: Major
        Found in dvc/commands/machine.py - About 2 hrs to fix

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

          def parse_target(
              target: str, default: str = None, isa_glob: bool = False
          ) -> Tuple[Optional[str], Optional[str]]:
              from dvc.dvcfile import PIPELINE_FILE, PIPELINE_LOCK, is_valid_filename
              from dvc.exceptions import DvcException
          Severity: Minor
          Found in dvc/utils/__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 _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):
              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 ls has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
          Open

              def ls(  # pylint: disable=arguments-differ
                  self, path, detail=True, dvc_only=False, **kwargs
              ):
                  fs, fs_path, dvc_fs, dvc_path = self._get_fs_pair(path)
          
          
          Severity: Minor
          Found in dvc/fs/dvc.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 __init__.py has 253 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import csv
          import io
          import logging
          import os
          from collections import OrderedDict
          Severity: Minor
          Found in dvc/repo/plots/__init__.py - About 2 hrs to fix

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

                def collect_granular(
                    self,
                    target: 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 send_signal has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
            Open

                def send_signal(self, name: str, sig: int):
                    """Send `signal` to the specified named process."""
                    process_info = self[name]
                    if sys.platform == "win32":
                        if sig not in (
            Severity: Minor
            Found in dvc/proc/manager.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 makedirs has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
            Open

            def makedirs(path, exist_ok=False, mode=None):
                if mode is None:
                    os.makedirs(path, exist_ok=exist_ok)
                    return
            
            
            Severity: Minor
            Found in dvc/utils/fs.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 dumpd has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
            Open

                def dumpd(self):
                    ret = {**self.hash_info.to_dict(), **self.meta.to_dict()}
            
                    if self.is_in_repo:
                        path = self.fs.path.as_posix(
            Severity: Minor
            Found in dvc/output.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 run has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
            Open

                def run(self):
                    name_only = self.args.name_only
                    exps = self.repo.experiments.ls(
                        all_commits=self.args.all_commits,
                        rev=self.args.rev,
            Severity: Minor
            Found in dvc/commands/experiments/ls.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 run has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
            Open

                def run(self):
                    from dvc.exceptions import DvcException
            
                    try:
                        diff = self.repo.diff(
            Severity: Minor
            Found in dvc/commands/diff.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 test has 46 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def test(self, tmp_dir, dvc, remote):  # pylint: disable=W0613
                    (stage,) = tmp_dir.dvc_gen("foo", "foo")
                    out = stage.outs[0]
                    cache = out.cache_path
                    foo_hash = out.hash_info
            Severity: Minor
            Found in dvc/testing/test_remote.py - About 1 hr to fix
              Severity
              Category
              Status
              Source
              Language