iterative/dvc

View on GitHub

Showing 547 of 589 total issues

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

def _build_out_changes(index, changes):
    from dvc_data.index.checkout import MODIFY

    out_keys = []
    for out in index.outs:
Severity: Minor
Found in dvc/repo/checkout.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 16 (exceeds 5 allowed). Consider refactoring.
Open

    def __init__(  # noqa: PLR0913
        self,
        stage,
        path,
        info=None,
Severity: Minor
Found in dvc/output.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 test_dir has 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def test_dir(self, tmp_dir, dvc, run_copy, remote_version_aware):  # noqa: PLR0915
        (stage,) = tmp_dir.dvc_gen(
            {
                "data_dir": {
                    "data_sub_dir": {"data_sub": "data_sub"},
Severity: Major
Found in dvc/testing/remote_tests.py - About 2 hrs to fix

    Function _collect_indexes has 16 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def _collect_indexes(  # noqa: PLR0913
    Severity: Major
    Found in dvc/repo/fetch.py - About 2 hrs to fix

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

      def add_parser(subparsers, _parent_parser):
          from dvc.commands.status import CmdDataStatus
      
          # Pull
          PULL_HELP = "Download tracked files or directories from remote storage."
      Severity: Minor
      Found in dvc/commands/data_sync.py - About 2 hrs to fix

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

        def _collect_indexes(  # noqa: PLR0913
            repo,
            targets=None,
            remote=None,
            all_branches=False,
        Severity: Minor
        Found in dvc/repo/fetch.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_granular has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

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

        def parse_target(
            target: str, default: Optional[str] = None, isa_glob: bool = False
        ) -> tuple[Optional[str], Optional[str]]:
            from dvc.dvcfile import LOCK_FILE, PROJECT_FILE, is_valid_filename
            from dvc.exceptions import DvcException
        Severity: Minor
        Found in dvc/utils/__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 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

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                    try:
                        self.repo.imp(
                            self.args.url,
                            self.args.path,
                            out=self.args.out,
            Severity: Major
            Found in dvc/commands/imp.py and 1 other location - About 1 hr to fix
            dvc/commands/get.py on lines 36..56

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 48.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                    try:
                        Repo.get(
                            self.args.url,
                            path=self.args.path,
                            out=self.args.out,
            Severity: Major
            Found in dvc/commands/get.py and 1 other location - About 1 hr to fix
            dvc/commands/imp.py on lines 14..37

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 48.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            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 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_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 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 _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

            Severity
            Category
            Status
            Source
            Language