iterative/dvc

View on GitHub

Showing 447 of 518 total issues

File output.py has 848 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import logging
import os
from collections import defaultdict
from typing import TYPE_CHECKING, Dict, Optional, Set, Type
from urllib.parse import urlparse
Severity: Major
Found in dvc/output.py - About 2 days to fix

    File __init__.py has 706 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import logging
    import os
    import re
    from functools import wraps
    from typing import Dict, Iterable, List, Mapping, Optional, Type
    Severity: Major
    Found in dvc/repo/experiments/__init__.py - About 1 day to fix

      File show.py has 649 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import argparse
      import logging
      import os
      from collections import Counter, OrderedDict, defaultdict
      from datetime import date, datetime
      Severity: Major
      Found in dvc/command/experiments/show.py - About 1 day to fix

        File base.py has 594 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import logging
        import os
        import pickle
        from abc import ABC, abstractmethod
        from contextlib import contextmanager
        Severity: Major
        Found in dvc/repo/experiments/executor/base.py - About 1 day to fix

          File template.py has 517 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import json
          import os
          from typing import Any, Dict, Optional
          
          from funcy import cached_property
          Severity: Major
          Found in dvc/repo/plots/template.py - About 1 day to fix

            Output has 50 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class Output:
                IS_DEPENDENCY = False
            
                PARAM_PATH = "path"
                PARAM_CACHE = "cache"
            Severity: Minor
            Found in dvc/output.py - About 7 hrs to fix

              File context.py has 438 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import logging
              import os
              from abc import ABC, abstractmethod
              from collections import defaultdict
              from collections.abc import Mapping, MutableMapping, MutableSequence, Sequence
              Severity: Minor
              Found in dvc/parsing/context.py - About 6 hrs to fix

                File machine.py has 429 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import argparse
                
                from dvc.command.base import CmdBase, append_doc_link, fix_subparsers
                from dvc.command.config import CmdConfig
                from dvc.compare import TabularData
                Severity: Minor
                Found in dvc/command/machine.py - About 6 hrs to fix

                  File stage.py has 404 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import fnmatch
                  import logging
                  import os
                  import typing
                  from contextlib import suppress
                  Severity: Minor
                  Found in dvc/repo/stage.py - About 5 hrs to fix

                    File repo.py has 395 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import errno
                    import logging
                    import os
                    import threading
                    from contextlib import suppress
                    Severity: Minor
                    Found in dvc/fs/repo.py - About 5 hrs to fix

                      File db.py has 373 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      import itertools
                      import logging
                      from concurrent.futures import ThreadPoolExecutor
                      from contextlib import suppress
                      from copy import copy
                      Severity: Minor
                      Found in dvc/objects/db.py - About 4 hrs to fix

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

                        if args.path:
                            pkg = pathlib.Path(args.path)
                        else:
                            pkgs = list(path.glob("*.pkg"))
                            if not pkgs:
                        Severity: Major
                        Found in scripts/fpm/sign.py and 1 other location - About 4 hrs to fix
                        scripts/fpm/notarize.py on lines 33..45

                        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 84.

                        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

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

                        if args.path:
                            pkg = pathlib.Path(args.path)
                        else:
                            pkgs = list(path.glob("*.pkg"))
                            if not pkgs:
                        Severity: Major
                        Found in scripts/fpm/notarize.py and 1 other location - About 4 hrs to fix
                        scripts/fpm/sign.py on lines 25..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 84.

                        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

                        File data_sync.py has 366 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        import argparse
                        import logging
                        
                        from dvc.command import completion
                        from dvc.command.base import CmdBase, append_doc_link
                        Severity: Minor
                        Found in dvc/command/data_sync.py - About 4 hrs to fix

                          File compare.py has 361 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          from collections import abc
                          from itertools import chain, repeat, zip_longest
                          from operator import itemgetter
                          from typing import (
                              TYPE_CHECKING,
                          Severity: Minor
                          Found in dvc/compare.py - About 4 hrs to fix

                            Function _collect_experiment_commit has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
                            Open

                            def _collect_experiment_commit(
                                repo,
                                exp_rev,
                                stash=False,
                                sha_only=True,
                            Severity: Minor
                            Found in dvc/repo/experiments/show.py - About 4 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 diff has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
                            Open

                            def diff(
                                old: Optional["HashFile"], new: Optional["HashFile"], cache
                            ) -> DiffResult:
                                from .tree import Tree
                            
                            
                            Severity: Minor
                            Found in dvc/data/diff.py - About 4 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

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

                                    self.repo.gc(
                                        all_branches=self.args.all_branches,
                                        all_tags=self.args.all_tags,
                                        all_commits=self.args.all_commits,
                                        all_experiments=self.args.all_experiments,
                            Severity: Major
                            Found in dvc/command/gc.py and 1 other location - About 4 hrs to fix
                            dvc/command/data_sync.py on lines 57..67

                            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 78.

                            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

                                        processed_files_count = self.repo.push(
                                            targets=self.args.targets,
                                            jobs=self.args.jobs,
                                            remote=self.args.remote,
                                            all_branches=self.args.all_branches,
                            Severity: Major
                            Found in dvc/command/data_sync.py and 1 other location - About 4 hrs to fix
                            dvc/command/gc.py on lines 50..60

                            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 78.

                            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

                            Severity: Major
                            Found in dvc/scheme.py and 1 other location - About 3 hrs to fix
                            dvc/stage/params.py on lines 0..15

                            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 72.

                            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

                            Severity
                            Category
                            Status
                            Source
                            Language