KarrLab/wc_model_gen

View on GitHub

Showing 120 of 341 total issues

Avoid deeply nested control flow statements.
Open

                        if unknown_vmax_count > 0:
                            shared_vmax = (value - known_vmax)/unknown_vmax_count
                        for comp, kcat in comp_kcat.items():                            
Severity: Major
Found in wc_model_gen/eukaryote/metabolism.py - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                            if not numpy.isnan(kcat.value):
                                known_vmax += kcat.value*comp.distribution_init_concentration.mean
                            else:
                                comp_kcat[comp] = kcat    
                        if known_vmax < value and (value - known_vmax)/value > 0.01:
    Severity: Major
    Found in wc_model_gen/eukaryote/metabolism.py - About 45 mins to fix

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

          def run(self):
              self.gen_compartments()
      
              self.gen_parameters()
              self.clean_and_validate_options()
      Severity: Minor
      Found in wc_model_gen/prokaryote/initalize_model.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

      Avoid deeply nested control flow statements.
      Open

                              if serine_coefficient:
                                  old_coef = serine_coefficient.coefficient
                                  el_reaction.participants.remove(serine_coefficient)
                                  el_reaction.participants.add(
                                      serine_species.species_coefficients.get_or_create(
      Severity: Major
      Found in wc_model_gen/eukaryote/translation_translocation.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                for species in obs.expression.species:    
                                    trans_species_counts[species.id] = species.distribution_init_concentration.mean
        
        
        Severity: Major
        Found in wc_model_gen/eukaryote/translation_translocation.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                  if species_init_conc:
                                      species_init_conc.mean += flux * participant.coefficient
                                      
                                  else:
                                      conc_model = model.distribution_init_concentrations.create(
          Severity: Major
          Found in wc_model_gen/eukaryote/complexation.py - About 45 mins to fix

            Function gen_michaelis_menten_like_rate_law has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            def gen_michaelis_menten_like_rate_law(model, reaction, modifiers=None, modifier_reactants=None, exclude_substrates=None):
            Severity: Minor
            Found in wc_model_gen/utils.py - About 35 mins to fix

              Function gen_mass_action_rate_law has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              def gen_mass_action_rate_law(model, reaction, model_k, modifiers=None, modifier_reactants=None):
              Severity: Minor
              Found in wc_model_gen/utils.py - About 35 mins to fix

                Function test_metabolite_production has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                def test_metabolite_production(submodel, reaction_bounds, pseudo_reactions=None, 
                Severity: Minor
                Found in wc_model_gen/utils.py - About 35 mins to fix

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

                      def calibrate_submodel(self):
                          """ Calibrate the submodel using data in the KB """
                          model = self.model
                          beta = self.options.get('beta')
                  
                  
                  Severity: Minor
                  Found in wc_model_gen/prokaryote/rna_degradation.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

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

                      def gen_compartments(self):
                          """ Generate compartments for the model from knowledge base """
                          kb = self.knowledge_base
                          model = self.model
                  
                  
                  Severity: Minor
                  Found in wc_model_gen/eukaryote/initialize_model.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

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

                  def gen_michaelis_menten_like_propensity_function(model, reaction, substrates_as_modifiers=None, exclude_substrates=None):
                      """ Generate a Michaelis-Menten-like propensity function. 
                          For species that are considered 'substrates', the substrate term is formulated as the 
                          multiplication of a Hill equation with a coefficient of 1 for each 'substrate'. 
                          For species that are considered 'modifiers', the modifier term is formulated
                  Severity: Minor
                  Found in wc_model_gen/utils.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

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

                      def gen_rate_laws(self):
                          """ Generate rate laws for the reactions in the submodel """
                          model = self.model        
                          cell = self.knowledge_base.cell
                          nucleus = model.compartments.get_one(id='n')
                  Severity: Minor
                  Found in wc_model_gen/eukaryote/rna_degradation.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

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

                      def calibrate_submodel(self):
                          """ Calibrate the submodel using data in the KB """
                          model = self.model
                          beta = self.options.get('beta')
                  
                  
                  Severity: Minor
                  Found in wc_model_gen/prokaryote/protein_degradation.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

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

                      def conv_for_optim(self):
                          """ Convert metabolism reactions into an optimization problem model
                  
                          Returns:
                              :obj:`conv_opt.Model`: a conv_opt model for optimization
                  Severity: Minor
                  Found in wc_model_gen/eukaryote/metabolism.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

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

                      def calibrate_submodel(self):
                          """ Calibrate the submodel using data in the KB """
                          model = self.model
                          beta = self.options.get('beta')
                  
                  
                  Severity: Minor
                  Found in wc_model_gen/prokaryote/transcription.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

                  Function calc_gtp_per_translate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def calc_gtp_per_translate(self):
                          """ Calculates the average GTP needed for a translation reaction """
                          submodel = self.model.submodels.get_one(id='translation')
                  
                          gtp_per_translation = []
                  Severity: Minor
                  Found in wc_model_gen/prokaryote/metabolism.py - About 25 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 calc_h_per_transcript has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def calc_h_per_transcript(self):
                          """ Calculates the average H needed for a transcription reaction """
                          submodel = self.model.submodels.get_one(id='transcription')
                  
                          h_per_transcript = []
                  Severity: Minor
                  Found in wc_model_gen/prokaryote/metabolism.py - About 25 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 gen_rate_laws has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def gen_rate_laws(self):
                          """ Generate rate laws for carbohydrate and lipid formation reactions. High
                              rates are assumed so that the macromolecules are formed as soon as the
                              components are available.        
                          """
                  Severity: Minor
                  Found in wc_model_gen/eukaryote/metabolism.py - About 25 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 gen_kb_reactions has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def gen_kb_reactions(self):
                          """ Generate reactions encoded within KB
                              TODO: rxn.submodel attribute is removed from KB, so submodel assignement needs to be taken care of here.
                                    Since all rxns explicitly encoded in KB are metabolic ones, it is manually set to be metablism atm, but
                                    not more sophisticated approach
                  Severity: Minor
                  Found in wc_model_gen/prokaryote/initalize_model.py - About 25 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

                  Severity
                  Category
                  Status
                  Source
                  Language