iterative/dvc

View on GitHub

Showing 471 of 516 total issues

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

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

    File base.py has 655 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 base.py has 596 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import logging
      import os
      from abc import ABC, abstractmethod
      from dataclasses import asdict, dataclass
      from typing import (
      Severity: Major
      Found in dvc/repo/experiments/queue/base.py - About 1 day to fix

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

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

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

          class Output:
              IS_DEPENDENCY = False
          
              PARAM_PATH = "path"
              PARAM_CACHE = "cache"
          Severity: Major
          Found in dvc/output.py - About 1 day to fix

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

            import csv
            import io
            import logging
            import os
            from collections import OrderedDict, defaultdict
            Severity: Minor
            Found in dvc/repo/plots/__init__.py - About 7 hrs to fix

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

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

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

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

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

                  import logging
                  import os
                  import re
                  import time
                  from typing import Dict, Iterable, Optional
                  Severity: Minor
                  Found in dvc/repo/experiments/__init__.py - About 6 hrs to fix

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

                    import logging
                    from collections import OrderedDict, defaultdict
                    from datetime import datetime
                    from enum import Enum
                    from itertools import chain
                    Severity: Minor
                    Found in dvc/repo/experiments/show.py - About 5 hrs to fix

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

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

                        File compare.py has 394 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 5 hrs to fix

                          Function _collect_rows has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
                          Open

                          def _collect_rows(
                              base_rev,
                              experiments,
                              all_headers,
                              metric_headers,
                          Severity: Minor
                          Found in dvc/commands/experiments/show.py - About 5 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

                          File plots.py has 376 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          import argparse
                          import json
                          import logging
                          import os
                          
                          
                          Severity: Minor
                          Found in dvc/commands/plots.py - About 5 hrs to fix

                            Function move_properties_to_head has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
                            Open

                            def move_properties_to_head(result: Dict[str, Dict[str, Dict[str, Any]]]):
                                for _, baseline_results in result.items():
                                    checkpoint: bool = False
                                    head: Dict[str, Any] = {}
                                    for rev, rev_data in baseline_results.items():
                            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

                            File index.py has 370 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            from contextlib import suppress
                            from typing import (
                                TYPE_CHECKING,
                                Any,
                                Callable,
                            Severity: Minor
                            Found in dvc/repo/index.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/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

                              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

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

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

                                Function _ has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
                                Open

                                def _(obj: dict):
                                    from dvc.config import Config
                                
                                    config = Config().get("parsing", {})
                                
                                
                                Severity: Minor
                                Found in dvc/parsing/interpolate.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

                                Severity
                                Category
                                Status
                                Source
                                Language