iterative/dvc

View on GitHub
dvc/command/experiments.py

Summary

Maintainability
F
5 days
Test Coverage

File experiments.py has 1379 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import argparse
import logging
from collections import Counter, OrderedDict, defaultdict
from datetime import date, datetime
from fnmatch import fnmatch
Severity: Major
Found in dvc/command/experiments.py - About 3 days to fix

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

        def run(self):
            names_only = self.args.names_only
            exps = self.repo.experiments.ls(
                rev=self.args.rev,
                git_remote=self.args.git_remote,
    Severity: Minor
    Found in dvc/command/experiments.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 _filter_name has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    def _filter_name(names, label, filter_strs):
        ret = defaultdict(dict)
        path_filters = defaultdict(list)
    
        for filter_s in filter_strs:
    Severity: Minor
    Found in dvc/command/experiments.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 experiments_table has 11 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def experiments_table(
    Severity: Major
    Found in dvc/command/experiments.py - About 1 hr to fix

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

          def run(self):
      
              try:
                  diff = self.repo.experiments.diff(
                      a_rev=self.args.a_rev,
      Severity: Minor
      Found in dvc/command/experiments.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_rows has 9 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def _collect_rows(
      Severity: Major
      Found in dvc/command/experiments.py - About 1 hr to fix

        Function run has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            def run(self):
                try:
                    all_experiments = self.repo.experiments.show(
                        all_branches=self.args.all_branches,
                        all_tags=self.args.all_tags,
        Severity: Minor
        Found in dvc/command/experiments.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 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def run(self):
                from dvc.compare import show_metrics
        
                if self.args.checkpoint_resume:
                    if self.args.reset:
        Severity: Minor
        Found in dvc/command/experiments.py - About 55 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 run has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def run(self):
                _raise_error_if_all_disabled(
                    all_branches=self.args.all_branches,
                    all_tags=self.args.all_tags,
                    all_commits=self.args.all_commits,
        Severity: Minor
        Found in dvc/command/experiments.py - About 55 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 show_experiments has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def show_experiments(
        Severity: Minor
        Found in dvc/command/experiments.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                              if key in ret[path]:
                                  del ret[path][key]
          
          
          Severity: Major
          Found in dvc/command/experiments.py - About 45 mins to fix

            Function _sort_exp has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            def _sort_exp(experiments, sort_path, sort_name, typ, reverse):
            Severity: Minor
            Found in dvc/command/experiments.py - About 35 mins to fix

              Function _extend_row has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              def _extend_row(row, names, items, precision, fill_value=FILL_VALUE):
              Severity: Minor
              Found in dvc/command/experiments.py - About 35 mins to fix

                There are no issues that match your filters.

                Category
                Status