iterative/dvc

View on GitHub

Showing 517 of 578 total issues

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(self.args.a_rev, self.args.b_rev, self.args.targets)
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 __init__ has 15 arguments (exceeds 4 allowed). Consider refactoring.
Open

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

    Function test has 46 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def test(self, tmp_dir, dvc, remote):
            (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/remote_tests.py - About 1 hr to fix

      Function fetch_running_exp_from_temp_dir has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

      def fetch_running_exp_from_temp_dir(
          queue: "BaseStashQueue", rev: str, fetch_refs: bool
      ) -> dict[str, dict]:
          """Fetch status of running exps out of current working directory
      
      
      Severity: Minor
      Found in dvc/repo/experiments/queue/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 get_remote has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

          def get_remote(
              self,
              name: Optional[str] = None,
              command: str = "<command>",
          ) -> "Remote":
      Severity: Minor
      Found in dvc/data_cloud.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 _infer_x_y has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

          def _infer_x_y(self):
              x = self.properties.get("x", None)
              y = self.properties.get("y", None)
      
              inferred_properties: dict = {}
      Severity: Minor
      Found in dvc/render/converter/vega.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_repo_dirs has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

          def _get_repo_dirs(
              self,
              root_dir: Optional[str] = None,
              fs: Optional["FileSystem"] = None,
              uninitialized: bool = 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 _collect_names has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

      def _collect_names(exp_states: Iterable["ExpState"]) -> _DataNames:
          result = _DataNames(defaultdict(dict), defaultdict(dict), set())
      
          def _collect_d(result_d: dict[str, dict[str, Any]], data_d: dict[str, Any]):
              for path, item in data_d.items():
      Severity: Minor
      Found in dvc/repo/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

      Function build_outs_trie has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

      def build_outs_trie(stages):
          outs = Trie()
      
          for stage in stages:
              for out in stage.outs:
      Severity: Minor
      Found in dvc/repo/trie.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 _exp_range_rows has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

      def _exp_range_rows(
          exp_range: "ExpRange",
          *,
          all_headers: Iterable[str],
          fill_value: Optional[str],
      Severity: Minor
      Found in dvc/repo/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

      Function iter_revs has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

      def iter_revs(
          scm: "Git",
          revs: Optional[list[str]] = None,
          num: int = 1,
          all_branches: bool = False,
      Severity: Minor
      Found in dvc/scm.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 _postprocess has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

      def _postprocess(results):
          processed: dict[str, dict] = {}
          for rev, rev_data in results.items():
              if not rev_data:
                  continue
      Severity: Minor
      Found in dvc/api/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

      Function _show_markdown has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

      def _show_markdown(diff, show_hash=False, hide_missing=False):
          headers = ["Status", "Hash", "Path"] if show_hash else ["Status", "Path"]
          rows = []
          statuses = ["added", "deleted", "renamed", "modified"]
          if not hide_missing:
      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 branch has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

      def branch(repo, exp_rev, branch_name=None, **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 _repro_dvc has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          def _repro_dvc(
              cls,
              info: "ExecutorInfo",
              infofile: Optional[str] = None,
              log_errors: bool = True,
      Severity: Minor
      Found in dvc/repo/experiments/executor/base.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 13 (exceeds 5 allowed). Consider refactoring.
      Open

      def init(root_dir=os.curdir, no_scm=False, force=False, subdir=False):  # noqa: C901
          """
          Creates an empty repo on the given directory -- basically a
          `.dvc` directory with subdirectories for configuration and cache.
      
      
      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 collect_files has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

      def collect_files(
          repo: "Repo", onerror: Optional[Callable[[str, Exception], None]] = None
      ):
          """Collects all of the stages present in the DVC repo.
      
      
      Severity: Minor
      Found in dvc/repo/index.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_vars has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

      def _collect_vars(repo, params, stages=None) -> dict:
          vars_params: dict[str, dict] = defaultdict(dict)
      
          for stage in repo.index.stages:
              if isinstance(stage, PipelineStage) and stage.tracked_vars:
      Severity: Minor
      Found in dvc/repo/params/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

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

          def _gen(self, struct, prefix=None):
              paths = []
              for name, contents in struct.items():
                  path = (prefix or self) / name
      
      
      Severity: Minor
      Found in dvc/testing/tmp_dir.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 workspace_status has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          def workspace_status(self):
              if not self.exists:
                  return {str(self): "deleted"}
              if self.hash_info.value is None:
                  return {str(self): "new"}
      Severity: Minor
      Found in dvc/dependency/param.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