iterative/dvc

View on GitHub
dvc/repo/artifacts.py

Summary

Maintainability
C
1 day
Test Coverage

File artifacts.py has 291 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import os
import posixpath
from pathlib import Path
from typing import TYPE_CHECKING, Any, Optional, Union

Severity: Minor
Found in dvc/repo/artifacts.py - About 3 hrs to fix

    Function get has 11 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def get(  # noqa: PLR0913
    Severity: Major
    Found in dvc/repo/artifacts.py - About 1 hr to fix

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

          def get(  # noqa: PLR0913
              cls,
              url: str,
              name: str,
              version: Optional[str] = None,
      Severity: Minor
      Found in dvc/repo/artifacts.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 _download_studio has 8 arguments (exceeds 4 allowed). Consider refactoring.
      Open

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

        Function download has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def download(
        Severity: Minor
        Found in dvc/repo/artifacts.py - About 45 mins to fix

          Function _download_studio has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def _download_studio(
                  repo_url: str,
                  name: str,
                  version: Optional[str] = None,
                  stage: Optional[str] = None,
          Severity: Minor
          Found in dvc/repo/artifacts.py - About 45 mins 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 read has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              def read(self) -> dict[str, dict[str, Artifact]]:
                  """Read artifacts from dvc.yaml."""
                  artifacts: dict[str, dict[str, Artifact]] = {}
                  for dvcfile, dvcfile_artifacts in self.repo.index._artifacts.items():
                      dvcyaml = relpath(dvcfile, self.repo.root_dir)
          Severity: Minor
          Found in dvc/repo/artifacts.py - About 25 mins 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

          There are no issues that match your filters.

          Category
          Status