KarrLab/wc_env_manager

View on GitHub
wc_env_manager/core.py

Summary

Maintainability
F
4 days
Test Coverage
F
15%

File core.py has 681 lines of code (exceeds 250 allowed). Consider refactoring.
Open

""" Tools for managing computing environments for whole-cell modeling

* Build the Docker image

    * *wc_env*: image with WC models and WC modeling tools and their dependencies
Severity: Major
Found in wc_env_manager/core.py - About 1 day to fix

    Function get_required_python_packages has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_required_python_packages(self):
            """ Get Python packages required for the WC models and WC modeling
                tools (`config['image']['python_packages']`)
    
            Returns:
    Severity: Minor
    Found in wc_env_manager/core.py - About 7 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 _build_image has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

        def _build_image(self, image_repo, image_tags,
                         dockerfile_path, build_args, context_path,
                         pull_base_image=False):
            """ Build Docker image
    
    
    Severity: Minor
    Found in wc_env_manager/core.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 setup_container has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

        def setup_container(self, upgrade=False):
            """ Install Python packages into Docker container
    
            Args:
                upgrade (:obj:`bool`, optional): if :obj:`True`, upgrade package
    Severity: Minor
    Found in wc_env_manager/core.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 get_config_file_paths_to_copy_to_image has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_config_file_paths_to_copy_to_image(self):
            """ Get list of configuration file paths to copy from ~/.wc to Docker image
    
            Returns:
                :obj:`list` of :obj:`dict`: configuration file paths to copy from ~/.wc to Docker image
    Severity: Minor
    Found in wc_env_manager/core.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_image has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def build_image(self):
            """ Build Docker image for WC modeling environment
    
            Returns:
                :obj:`docker.models.images.Image`: Docker image
    Severity: Minor
    Found in wc_env_manager/core.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_process_in_container has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def run_process_in_container(self, cmd, work_dir=None, env=None, check=True,
    Severity: Minor
    Found in wc_env_manager/core.py - About 45 mins to fix

      Function _build_image has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def _build_image(self, image_repo, image_tags,
      Severity: Minor
      Found in wc_env_manager/core.py - About 45 mins to fix

        Function push_image has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def push_image(self, image_repo, image_tags):
                """ Push Docker image to DockerHub
        
                Args:
                    image_repo (:obj:`str`): image repository
        Severity: Minor
        Found in wc_env_manager/core.py - About 45 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 copy_path_to_container has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def copy_path_to_container(self, local_path, container_path, overwrite=True, container_user=WcEnvUser.root):
        Severity: Minor
        Found in wc_env_manager/core.py - About 35 mins to fix

          Function run_process_in_container has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              def run_process_in_container(self, cmd, work_dir=None, env=None, check=True,
                                           container_user=WcEnvUser.root):
                  """ Run a process in the current Docker container
          
                  Args:
          Severity: Minor
          Found in wc_env_manager/core.py - About 35 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

          There are no issues that match your filters.

          Category
          Status