KarrLab/wc_lang

View on GitHub

Showing 80 of 104 total issues

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

""" Data model to represent composite, multi-algorithmic biochemical models.

This module defines classes that represent the schema and provenance of a biochemical model:

* :obj:`Model`
Severity: Major
Found in wc_lang/core.py - About 1 wk to fix

    File util.py has 876 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    """ Utilities for writing/reading a `wc_lang` model to/from SBML
    
    * Higher level functions for creating, getting, and setting SBML objects
    * Utilities for wrapping libSBML calls
    
    
    Severity: Major
    Found in wc_lang/sbml/util.py - About 2 days to fix

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

          def run(self, model):
              """ Merge groups of algorithmically-like submodels into individual submodels
      
              * dFBA objectives are merged by summing
      
      
      Severity: Minor
      Found in wc_lang/transform/merge_submodels.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

      Function transform has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring.
      Open

      def transform(filename):
          # read
          wb = openpyxl.load_workbook(filename=filename)
      
          # TOC
      Severity: Minor
      Found in migrations/migration_2019_09_20.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

      Function get_authors_annotation has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
      Open

          def get_authors_annotation(cls, model, sbml_model, model_objs):
              """ Import the SBML annotation of the authors of a model to a model
      
              Args:
                  model (:obj:`wc_lang.core.Model`): model
      Severity: Minor
      Found in wc_lang/sbml/util.py - About 6 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 run has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
      Open

          def run(self, model):
              """ Split reversible reactions in non-dFBA submodels into separate forward and backward reactions
      
              Args:
                  model (:obj:`Model`): model definition
      Severity: Minor
      Found in wc_lang/transform/split_reversible_reactions.py - About 5 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 validate has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
      Open

          def validate(self, obj, value, tolerance=1E-10):
              """ Determine if `value` is a valid value of the attribute
      
              Args:
                  obj (:obj:`Reaction`): object being validated
      Severity: Minor
      Found in wc_lang/core.py - About 5 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 run has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
      Open

          def run(self, path, models=None,
                  ignore_missing_models=None, ignore_extra_models=None, ignore_sheet_order=None,
                  include_all_attributes=False, ignore_missing_attributes=None, ignore_extra_attributes=None,
                  ignore_attribute_order=None, validate=None):
              """ Read a list of model objects from file(s) and, optionally, validate them
      Severity: Minor
      Found in wc_lang/io.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

      LibSbmlInterface has 35 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class LibSbmlInterface(object):
          ''' Methods for compactly using libSBML to create SBML objects.
      
          The libSBML method calls provide narrow interfaces, typically exchanging one
          value per call, which creates verbose code. The methods below aggregate multiple
      Severity: Minor
      Found in wc_lang/sbml/util.py - About 4 hrs to fix

        Function get_products has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
        Open

            def get_products(self, __type=None, **kwargs):
                """ Get the species produced by this objective function
        
                Args:
                    __type (:obj:`types.TypeType` or :obj:`tuple` of :obj:`types.TypeType`): subclass(es) of :obj:`Model`
        Severity: Minor
        Found in wc_lang/core.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 call_libsbml has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
        Open

            def call_libsbml(cls, method, *args, returns_int=False, debug=False):
                """ Call a libSBML method and handle any errors.
        
                Unfortunately, libSBML methods that do not return data usually report errors via return codes,
                instead of exceptions, and the generic return codes contain virtually no information.
        Severity: Minor
        Found in wc_lang/sbml/util.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

        Model has 31 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class Model(obj_tables.Model, SbmlModelMixin):
            """ Model
        
            Attributes:
                id (:obj:`str`): unique identifier
        Severity: Minor
        Found in wc_lang/core.py - About 3 hrs to fix

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

              def run(self, model):
                  """ Transform model
          
                  Args:
                      model (:obj:`Model`): model
          Severity: Minor
          Found in wc_lang/transform/set_finite_dfba_flux_bounds.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 _get_cyclic_deps has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
          Open

              def _get_cyclic_deps(self):
                  """ Verify that the networks of depencencies for observables and functions are acyclic
          
                  Returns:
                      :obj:`dict`: dictionary of dictionary of lists of objects with cyclic dependencies,
          Severity: Minor
          Found in wc_lang/core.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 run has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
          Open

              def run(self, model):
                  """ Create implicit exchange reactions for dFBA submodels
          
                  Args:
                      model (:obj:`Model`): model
          Severity: Minor
          Found in wc_lang/transform/create_implicit_dfba_ex_rxns.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

          File __main__.py has 301 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          """ Command line programs for manipulating model definitions
          
          :Author: Jonathan Karr <karr@mssm.edu>
          :Author: Arthur Goldberg <Arthur.Goldberg@mssm.edu>
          :Date: 2016-12-07
          Severity: Minor
          Found in wc_lang/__main__.py - About 3 hrs to fix

            Function import_from_sbml has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
            Open

                def import_from_sbml(self, sbml_rxn):
                    """ Load from SBML reaction
            
                    Args:
                        sbml (:obj:`libsbml.Reaction`): SBML reaction
            Severity: Minor
            Found in wc_lang/core.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 validate has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
            Open

                def validate(self):
                    """ Check that the structure is valid
            
                    * Format provided when structure is not None
                    * Value provided when format is not None
            Severity: Minor
            Found in wc_lang/core.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 transform has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
            Open

            def transform(filename):
                # read
                wb = openpyxl.load_workbook(filename=filename)
            
                for ws in wb:
            Severity: Minor
            Found in migrations/migration_2019_10_10.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 validate has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
            Open

                def validate(self):
                    """ Determine whether this `RateLaw` is valid
            
                    * Check if identifier equal to `{reaction.id}-{direction.name}`
            
            
            Severity: Minor
            Found in wc_lang/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

            Severity
            Category
            Status
            Source
            Language