KarrLab/rand_wc_model_gen

View on GitHub
rand_wc_model_gen/model_gen/core.py

Summary

Maintainability
F
4 days
Test Coverage
D
63%

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

""" Classes to generate random wc models

:Author: Mike Zheng <xzheng20@colby.edu>
:Author: Jonathan Karr <karr@mssm.edu>
:Date: 2019-08-13
Severity: Major
Found in rand_wc_model_gen/model_gen/core.py - About 1 day to fix

    Function run has 268 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def run(self):
            """ Generate a :obj:`wc_lang` model
    
            Returns:
                :obj:`wc_lang.Model`: model
    Severity: Major
    Found in rand_wc_model_gen/model_gen/core.py - About 1 day to fix

      Function gen_reactions has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
      Open

          def gen_reactions(self, model, options):
              """ Generate reactions and rate laws of the random model
      
              Args:
                  model (:obj:`wc_lang.Model`): model
      Severity: Minor
      Found in rand_wc_model_gen/model_gen/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 gen_species has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

          def gen_species(self, model, options, misc_options):
              """ Generate species type, species, and init concentrations of the random model
      
              Args:
                  model (:obj:`wc_lang.Model`): model
      Severity: Minor
      Found in rand_wc_model_gen/model_gen/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 plot has 36 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      def plot(model, results, filename):
          """ plot simulation results of the hard-coded rna model
      
          """
      
      
      Severity: Minor
      Found in rand_wc_model_gen/model_gen/core.py - About 1 hr to fix

        There are no issues that match your filters.

        Category
        Status