KarrLab/wc_sim

View on GitHub

Showing 141 of 141 total issues

File species_populations.py has 1555 lines of code (exceeds 250 allowed). Consider refactoring.
Open

""" Store species populations, and partition them among submodel private species and shared species

:Author: Arthur Goldberg <Arthur.Goldberg@mssm.edu>
:Author: Jonathan Karr <karr@mssm.edu>
:Author: Arthur Goldberg, Arthur.Goldberg@mssm.edu
Severity: Major
Found in wc_sim/species_populations.py - About 4 days to fix

    File verify.py has 1280 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    """
    :Author: Arthur Goldberg <Arthur.Goldberg@mssm.edu>
    :Author: Yin Hoon Chew <yinhoon.chew@mssm.edu>
    :Date: 2018-09-17
    :Copyright: 2018, Karr Lab
    Severity: Major
    Found in wc_sim/testing/verify.py - About 3 days to fix

      File dynamic_components.py has 1162 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      """ Dynamic components of a multialgorithm simulation
      
      :Author: Arthur Goldberg <Arthur.Goldberg@mssm.edu>
      :Author: Jonathan Karr <karr@mssm.edu>
      :Date: 2018-02-07
      Severity: Major
      Found in wc_sim/dynamic_components.py - About 2 days to fix

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

                    if rate_law_type.name == 'constant':
                        param = model.parameters.create(id='k_cat_{}_1_for'.format(submodel_num),
                                                        value=1., units=unit_registry.parse_units('s^-1'))
                        expression_str = param.id
                    elif rate_law_type.name == 'reactant_pop':
        Severity: Major
        Found in wc_sim/testing/make_models.py and 1 other location - About 1 day to fix
        wc_sim/testing/make_models.py on lines 213..230

        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 216.

        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

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

                        if rate_law_type.name == 'constant':
                            param = model.parameters.create(id='k_cat_{}_1_bck'.format(submodel_num),
                                                            value=1., units=unit_registry.parse_units('s^-1'))
                            expression_str = param.id
                        elif rate_law_type.name == 'reactant_pop':
        Severity: Major
        Found in wc_sim/testing/make_models.py and 1 other location - About 1 day to fix
        wc_sim/testing/make_models.py on lines 178..195

        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 216.

        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 dfba.py has 703 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        """ A submodel that uses Dynamic Flux Balance Analysis (dFBA) to model a set of reactions
        
        :Author: Yin Hoon Chew <yinhoon.chew@mssm.edu>
        :Author: Arthur Goldberg <Arthur.Goldberg@mssm.edu>
        :Date: 2020-07-29
        Severity: Major
        Found in wc_sim/submodels/dfba.py - About 1 day to fix

          Function read_model has a Cognitive Complexity of 64 (exceeds 5 allowed). Consider refactoring.
          Open

              def read_model(self, sbml_version='l3v2', model_file_suffix='-wc_lang.xlsx'):
                  """  Read a model into a `wc_lang` representation
          
                  dFBA test cases are read directly from SBML, whereas other cases are read from WC Lang spreadsheets.
          
          
          Severity: Minor
          Found in wc_sim/testing/verify.py - About 1 day 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 utils.py has 439 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          """ Utilities for testing
          
          :Author: Arthur Goldberg <Arthur.Goldberg@mssm.edu>
          :Date: 2019-10-26
          :Copyright: 2019, Karr Lab
          Severity: Minor
          Found in wc_sim/testing/utils.py - About 6 hrs to fix

            File time_ordered_list.py has 392 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            """ Doubly-linked list ordered by time
            
            :Author: Arthur Goldberg <Arthur.Goldberg@mssm.edu>
            :Date: 2019-11-20
            :Copyright: 2019, Karr Lab
            Severity: Minor
            Found in wc_sim/utils/time_ordered_list.py - About 5 hrs to fix

              File run_results.py has 386 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              """ Store and retrieve combined results of a multialgorithmic simulation run
              
              :Author: Arthur Goldberg <Arthur.Goldberg@mssm.edu>
              :Author: Jonathan Karr <karr@mssm.edu>
              :Date: 2018-05-20
              Severity: Minor
              Found in wc_sim/run_results.py - About 5 hrs to fix

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

                """ Initialize a multialgorithm simulation from a language model and run-time parameters
                
                :Author: Arthur Goldberg <Arthur.Goldberg@mssm.edu>
                :Date: 2017-02-07
                :Copyright: 2016-2019, Karr Lab
                Severity: Minor
                Found in wc_sim/multialgorithm_simulation.py - About 4 hrs to fix

                  Function add_test_submodel has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def add_test_submodel(cls, model, model_type, submodel_num, comp, species_types,
                                            default_species_copy_number, default_species_std,
                                            species_copy_numbers, species_stds, expressions,
                                            submodel_framework='WC:stochastic_simulation_algorithm'):
                          """ Create a test submodel
                  Severity: Minor
                  Found in wc_sim/testing/make_models.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 sim_config.py has 356 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  """ Classes to represent WC simulation configurations and import/export configurations to/from SED-ML
                  
                  :Author: Jonathan Karr <karr@mssm.edu>
                  :Author: Arthur Goldberg <Arthur.Goldberg@mssm.edu>
                  :Date: 2017-08-19
                  Severity: Minor
                  Found in wc_sim/sim_config.py - About 4 hrs to fix

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                    def get_debug_logs_config(extra=None):
                        """ Get debug logs configuration
                    
                        Args:
                            extra (:obj:`dict`, optional): additional configuration to override
                    Severity: Major
                    Found in wc_sim/config/core.py and 1 other location - About 4 hrs to fix
                    examples/config/core.py on lines 28..43

                    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 79.

                    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

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                    def get_debug_logs_config(extra=None):
                        """ Get debug logs configuration
                    
                        Args:
                            extra (:obj:`dict`, optional): additional configuration to override
                    Severity: Major
                    Found in examples/config/core.py and 1 other location - About 4 hrs to fix
                    wc_sim/config/core.py on lines 36..51

                    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 79.

                    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

                    Function verify_model has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def verify_model(self, num_discrete_stochastic_runs=None, discard_run_results=True, plot_file=None,
                                         ode_time_step_factor=None, tolerances=None, evaluate=False):
                            """ Verify a model
                    
                            Args:
                    Severity: Minor
                    Found in wc_sim/testing/verify.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 analyze has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def analyze(file):  # pragma: no cover
                        atols = set()
                        rtols = set()
                        cases = set()
                        data = {}
                    Severity: Minor
                    Found in wc_sim/testing/analyze_tolerances.py - About 3 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 a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def plot(model, time = np.zeros(0),
                        species_counts = None, volume = np.zeros(0), extracellular_volume = np.zeros(0),
                        selected_species_compartments = [],
                        yDatas = {},
                        units = 'mM', title = '', fileName = ''):
                    Severity: Minor
                    Found in temp_wc_analysis/analysis.py - About 3 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 determine_dependencies has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def determine_dependencies(self):
                            """ Determine the dependencies that rate laws have on executed reactions
                    
                            In a multi-algorithmic simulation, two types of dependencies arise when NRM considers which
                            rate laws to update after a reaction executes:
                    Severity: Minor
                    Found in wc_sim/submodels/nrm.py - About 3 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 obtain_expression_usage has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def obtain_expression_usage(model):
                        """ Obtain the use of expressions by rate laws in a WC Lang model
                    
                        Adapted from DynamicModel.obtain_dependencies.
                    
                    
                    Severity: Minor
                    Found in presentation_2020_07_06_WC_sim_for_H1_model/h1_model_properties.py - About 3 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