iterative/dvc

View on GitHub

Showing 400 of 444 total issues

Function run has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    def run(self):
        if self.args.name is None and not self.args.unset:
            conf = self.config.read(self.args.level)
            try:
                print(conf["core"]["machine"])
Severity: Minor
Found in dvc/commands/machine.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 checkout has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    def checkout(
        self,
        force=False,
        progress_callback=None,
        relink=False,
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 used_objs has 12 arguments (exceeds 4 allowed). Consider refactoring.
Open

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

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

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

      Function experiments_table has 12 arguments (exceeds 4 allowed). Consider refactoring.
      Open

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

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

            def __init__(
        Severity: Major
        Found in dvc/output.py - About 1 hr to fix

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

          def add_parser(subparsers, parent_parser):
              from dvc.commands.config import parent_config_parser
          
              REMOTE_HELP = "Set up and manage data remotes."
              remote_parser = subparsers.add_parser(
          Severity: Minor
          Found in dvc/commands/remote.py - About 1 hr to fix

            Function _get_stage_files has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

            def _get_stage_files(stage: "Stage") -> typing.Iterator[str]:
                yield stage.dvcfile.relpath
                for dep in stage.deps:
                    if (
                        not dep.use_scm_ignore
            Severity: Minor
            Found in dvc/repo/reproduce.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 _loop has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

                def _loop(tasks: List[MonitorTask], done: threading.Event):
                    while True:
                        for task in tasks:
                            if os.path.exists(task.signal_path):
                                try:
            Severity: Minor
            Found in dvc/stage/monitor.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 restore has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

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

            def branch(repo, exp_rev, branch_name, *args, **kwargs):
                from dvc.scm import resolve_rev
            
                try:
                    rev = resolve_rev(repo.scm, exp_rev)
            Severity: Minor
            Found in dvc/repo/experiments/branch.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 _resolve_exp_by_name has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

            def _resolve_exp_by_name(
                repo: "Repo",
                exp_names: Union[str, List[str]],
                commit_ref_dict: Dict["ExpRefInfo", str],
                queued_ref_dict: Dict[int, str],
            Severity: Minor
            Found in dvc/repo/experiments/remove.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 info has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

                def info(self, path, **kwargs):
                    from dvc_data.hashfile.meta import Meta
            
                    key = self._get_key(path)
            
            
            Severity: Minor
            Found in dvc/fs/data.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 build_outs_graph has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

            def build_outs_graph(graph, outs_trie):
                import networkx as nx
            
                G = nx.DiGraph()
            
            
            Severity: Minor
            Found in dvc/repo/graph.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 _ast_tree_to_dict has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

            def _ast_tree_to_dict(tree, only_self_params=False, lineno=False):
                """Parses ast trees to dict.
            
                :param tree: ast.Tree
                :param only_self_params: get only self params from class __init__ function
            Severity: Minor
            Found in dvc/utils/serialize/_py.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 show has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

                def show(
                    self,
                    targets: List[str] = None,
                    revs=None,
                    props=None,
            Severity: Minor
            Found in dvc/repo/plots/__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

            Function _get_used_and_obj has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

                def _get_used_and_obj(
                    self, obj_only=False, **kwargs
                ) -> Tuple[Dict[Optional["ObjectDB"], Set["HashInfo"]], "HashFile"]:
                    from dvc.config import NoRemoteError
                    from dvc.exceptions import NoOutputOrStageError, PathMissingError
            Severity: Minor
            Found in dvc/dependency/repo.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 _prepare_context has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

                def _prepare_context(self, data: typing.Mapping) -> List[object]:
                    lines: List[object] = []
                    for index, error in enumerate(self.exc.errors):
                        if index and lines[-1]:
                            lines.append("")
            Severity: Minor
            Found in dvc/utils/strictyaml.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_repo has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

                def _collect_repo(self, onerror: Callable[[str, Exception], None] = None):
                    """Collects all of the stages present in the DVC repo.
            
                    Args:
                        onerror (optional): callable that will be called with two args:
            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 _extend_row has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

            def _extend_row(row, names, headers, items, precision, fill_value=FILL_VALUE):
                from dvc.compare import _format_field, with_value
            
                for fname, data in items:
                    item = data.get("data", {})
            Severity: Minor
            Found in dvc/commands/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

            Severity
            Category
            Status
            Source
            Language