KarrLab/datanator

View on GitHub
datanator/core/data_source.py

Summary

Maintainability
D
2 days
Test Coverage
F
39%

File data_source.py has 480 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""
:Author: Jonathan Karr <jonrkarr@gmail.com>
:Date: 2017-05-08
:Copyright: 2017, Karr Lab
:License: MIT
Severity: Minor
Found in datanator/core/data_source.py - About 7 hrs to fix

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

        def upload_backups(self):
            """ Backup the local sqlite database to Quilt """
    
            # create temporary directory to checkout package
            tmp_dirname = tempfile.mkdtemp()
    Severity: Minor
    Found in datanator/core/data_source.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 __init__ has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        def __init__(self, name=None, cache_dirname=None, clear_content=False, load_content=False, max_entries=float('inf'),
                     commit_intermediate_results=False, download_backups=True, verbose=False,
                     quilt_owner=None, quilt_package=None):
            """
            Args:
    Severity: Minor
    Found in datanator/core/data_source.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 12 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def __init__(self, name=None, cache_dirname=None, clear_content=False, load_content=False, max_entries=float('inf'),
    Severity: Major
    Found in datanator/core/data_source.py - About 1 hr to fix

      Function __init__ has 11 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def __init__(self, name=None,
      Severity: Major
      Found in datanator/core/data_source.py - About 1 hr to fix

        Function __init__ has 10 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def __init__(self, name=None, cache_dirname=None, clear_content=False, load_content=False, max_entries=float('inf'),
        Severity: Major
        Found in datanator/core/data_source.py - About 1 hr to fix

          Avoid deeply nested control flow statements.
          Open

                                  if rel_dirname == '.':
                                      rel_filename = filename
                                  else:
                                      rel_filename = os.path.join(rel_dirname, filename)
                                  os.symlink(os.path.join(root_cache_path, rel_filename),
          Severity: Major
          Found in datanator/core/data_source.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                    if rel_dirname == '.':
                                        rel_subdirname = subdirname
                                    else:
                                        rel_subdirname = os.path.join(rel_dirname, subdirname)
                                    os.makedirs(os.path.join(root_tmp_path, rel_subdirname))
            Severity: Major
            Found in datanator/core/data_source.py - About 45 mins to fix

              There are no issues that match your filters.

              Category
              Status