iterative/dvc

View on GitHub

Showing 529 of 589 total issues

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

    def used_objs(  # noqa: PLR0913
        self,
        targets=None,
        all_branches=False,
        with_deps=False,
Severity: Minor
Found in dvc/repo/__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 reproduce_celery has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def reproduce_celery(
        self, entries: Optional[Iterable["QueueEntry"]] = None, **kwargs
    ) -> dict[str, str]:
        results: dict[str, str] = {}
        if entries is None:
Severity: Minor
Found in dvc/repo/experiments/__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 __init__ has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def __init__(  # noqa: PLR0915, PLR0913
        self,
        root_dir: Optional[str] = None,
        fs: Optional["FileSystem"] = None,
        rev: Optional[str] = None,
Severity: Minor
Found in dvc/repo/__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 _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 _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 load_from_vars has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def load_from_vars(
        self,
        fs,
        vars_: list,
        wdir: str,
Severity: Minor
Found in dvc/parsing/context.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 12 (exceeds 5 allowed). Consider refactoring.
Open

    def run(self):
        try:
            diff = self.repo.experiments.diff(
                a_rev=self.args.a_rev,
                b_rev=self.args.b_rev,
Severity: Minor
Found in dvc/commands/experiments/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_update has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def test_update(self, tmp_dir, dvc, remote_worktree):
        (foo_stage,) = tmp_dir.dvc_gen("foo", "foo")
        (data_dir_stage,) = tmp_dir.dvc_gen(
            {
                "data_dir": {
Severity: Minor
Found in dvc/testing/remote_tests.py - About 1 hr to fix

    Function add_parser has 35 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 run has 11 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def run(  # noqa: C901, PLR0912
      Severity: Major
      Found in dvc/repo/experiments/run.py - About 1 hr to fix

        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 write_json has 10 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def write_json(
          Severity: Major
          Found in dvc/ui/__init__.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 ls has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

              def ls(
                  repo,
                  rev: Optional[Union[list[str], str]] = None,
                  all_commits: bool = False,
                  num: int = 1,
              Severity: Minor
              Found in dvc/repo/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 _can_hash has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

              def _can_hash(stage):
                  if stage.is_callback or stage.always_changed:
                      return False
              
                  if not all([stage.cmd, stage.deps, stage.outs]):
              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 emit has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  def emit(self, record):
                      """Write to Tqdm's stream so as to not break progress-bars"""
                      try:
                          if record.exc_info:
                              _, exc, *_ = record.exc_info
              Severity: Minor
              Found in dvc/logger.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 pull has 10 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              def pull(  # noqa: C901
              Severity: Major
              Found in dvc/repo/experiments/pull.py - About 1 hr to fix

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

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

                  Function push_refspec has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def push_refspec(
                      scm: "Git",
                      url: str,
                      push_list=list[tuple[Optional[str], str]],
                      force: bool = False,
                  Severity: Minor
                  Found in dvc/repo/experiments/utils.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 create has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def create(
                          self,
                          single_stage: bool = False,
                          validate: bool = True,
                          fname: Optional[str] = None,
                  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

                  Severity
                  Category
                  Status
                  Source
                  Language