KarrLab/wc_sim

View on GitHub

Showing 107 of 141 total issues

Function quantify_stoch_diff has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    def quantify_stoch_diff(self, evaluate=False):
        """ Quantify the difference between stochastic simulation population(s) and expected population(s)

        Used to tune multialgorithmic models

Severity: Minor
Found in wc_sim/testing/verify.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 read_settings has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    def read_settings(self):
        """ Read a test case's settings into a key-value dictionary

        Returns:
            :obj:`dict`: key-value pairs for the test case's settings
Severity: Minor
Found in wc_sim/testing/verify.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 semantically_equal has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    def semantically_equal(self, other, debug=False):
        """ Are the predictions and metadata in two :obj:`RunResults` objects semantically equal?

        Uses `numpy.allclose()` to compare predictions.
        Uses `semantically_equal` to ignore semantically insignificant metadata, such as the timestamp of a simulation's
Severity: Minor
Found in wc_sim/run_results.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 _check_species has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    def _check_species(self, time, species=None, check_early_accesses=True):
        """ Check whether the species are a set, or not known by this LocalSpeciesPopulation

        Also checks whether the species are being accessed in time order if `check_early_accesses`
        is set.
Severity: Minor
Found in wc_sim/species_populations.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 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def plot(model, results, filename):
    # get expected results
    c = model.compartments.get_one(id='c')

    species_type = model.species_types.get_one(id='rna')
Severity: Minor
Found in examples/transcription_translation_hybrid_model/run_with_wc_sim.py - About 1 hr to fix

    Function make_test_model has 14 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def make_test_model(cls, model_type,
    Severity: Major
    Found in wc_sim/testing/make_models.py - About 1 hr to fix

      Function get_dynamic_model_type has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          def get_dynamic_model_type(model_type):
              """ Get a simulation's dynamic component type
      
              Obtain a dynamic component type from a corresponding `wc_lang` Model type, instance or
              string name.
      Severity: Minor
      Found in wc_sim/dynamic_components.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 12 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def run(self, max_time, results_dir=None, progress_bar=True, checkpoint_period=None,
      Severity: Major
      Found in wc_sim/simulation.py - About 1 hr to fix

        Function sim_hyb has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

        def sim_hyb(rxns, rate_params, init_species, init_time, max_time, checkpoint_period):
            """ Simulate model with SSA/ODE hybrid
        
            Args:
                rxns (:obj:`dict`): reaction participants and rate laws

        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 sample_copy_num_from_concentration has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            def sample_copy_num_from_concentration(species, volume, random_state):
                """ Provide the initial copy number of `species` from its specified value
        
                The initial copy number is sampled from a specified distribution whose mean is given
                in molecules or molarity.
        Severity: Minor
        Found in wc_sim/model_utilities.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 heatmap has 11 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def heatmap(data, row_labels, col_labels, ax=None, size=None,
        Severity: Major
        Found in wc_sim/testing/analyze_tolerances.py - About 1 hr to fix

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

              def add_test_submodel(cls, model, model_type, submodel_num, comp, species_types,
          Severity: Major
          Found in wc_sim/testing/make_models.py - About 1 hr to fix

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

                def slope(self, time, left_node=None):
                    """ Get the population slope at time `time`
            
                    Args:
                        time (:obj:`Rational`): time value
            Severity: Minor
            Found in wc_sim/utils/time_ordered_list.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 del_species_locations has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

                def del_species_locations(self, species_ids, force=False):
                    """ Delete entries from the species location map
            
                    Remove species location mappings for the species in `species_ids`. To avoid raising an
                    exception when a species is not in the location map, set `force` to `True`.
            Severity: Minor
            Found in wc_sim/species_populations.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 plot has 10 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            def plot(model, time = np.zeros(0),
            Severity: Major
            Found in temp_wc_analysis/analysis.py - About 1 hr to fix

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

                  def __init__(self, id, dynamic_model, reactions, species, dynamic_compartments,
              Severity: Major
              Found in wc_sim/submodels/dynamic_submodel.py - About 1 hr to fix

                Function _run_test has 9 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    def _run_test(self, case_type_name, case_num, num_stochastic_runs=None,
                Severity: Major
                Found in wc_sim/testing/verify.py - About 1 hr to fix

                  Function _run_tests has 9 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      def _run_tests(self, case_type_name, case_num, num_stochastic_runs=None,
                  Severity: Major
                  Found in wc_sim/testing/verify.py - About 1 hr to fix

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

                        def __init__(self, name, initial_population, molecular_weights, cont_submodel_ids=None,
                    Severity: Major
                    Found in wc_sim/species_populations.py - About 1 hr to fix

                      Function run has 9 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          def run(self, test_case_type_name=None, cases=None, num_stochastic_runs=None,
                      Severity: Major
                      Found in wc_sim/testing/verify.py - About 1 hr to fix
                        Severity
                        Category
                        Status
                        Source
                        Language