KarrLab/wc_lang

View on GitHub

Showing 84 of 109 total issues

Function gbl has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

        def gbl(self, *args):
            parts = []
            for arg in args:
                if isinstance(arg, lark.lexer.Token) and \
                        arg.type == 'SPECIES_COEFFICIENT__SPECIES__COMPARTMENT__ID':
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

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

Function validate has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    def validate(self):
        """ Check if the reaction is valid

        * If the submodel is ODE or SSA, check that the reaction has a forward rate law
        * If the submodel is ODE or SSA and the reaction is reversible, check that the reaction has a
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

Function get_immediate_children has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    def get_immediate_children(self, kind=None, __type=None, __include_stop_conditions=True,
                               **kwargs):
        """ Get a kind of children.

        If :obj:`kind` is :obj:`None`, children are defined to be the values of the related attributes defined
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

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

    def run(self, path, model, models=None, get_related=True, include_all_attributes=False, validate=None,
Severity: Major
Found in wc_lang/io.py - About 2 hrs to fix

    Function parse_annotations has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        def parse_annotations(cls, sbml_obj):
            """ Import annotations from a model object to an SBML object
    
            Args:
                sbml_obj (:obj:`libsbml.SBase`): SBML object
    Severity: Minor
    Found in wc_lang/sbml/util.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 get_children has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_children(self, kind=None, __type=None, recursive=True, __include_stop_conditions=True,
                         **kwargs):
            """ Get a kind of children.
    
            If :obj:`kind` is :obj:`None`, children are defined to be the values of the related attributes defined
    Severity: Minor
    Found in wc_lang/core.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 evidence has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

            def evidence(self, *args):
                kwargs = {}
                for arg in args:
                    if isinstance(arg, lark.lexer.Token):
                        cls_name, _, attr_name = arg.type.partition('__')
    Severity: Minor
    Found in wc_lang/core.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 a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        def run(cls, sbml_doc):
            """ Import a `wc_lang` model from an SBML-encoded model
    
            Args:
                sbml_doc (:obj:`libsbml.SBMLDocument`): SBML document with SBML-encoded model
    Severity: Minor
    Found in wc_lang/sbml/io.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 validate has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        def validate(self):
            """ Check that the stop condition is valid
    
            * Check that `expression` has units `units`
    
    
    Severity: Minor
    Found in wc_lang/core.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 validate has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        def validate(self):
            """ Check that the Function is valid
    
            * Check that `expression` has units `units`
    
    
    Severity: Minor
    Found in wc_lang/core.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 lcl_part has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

            def lcl_part(self, *args):
                coeff = 1.
                for arg in args:
                    if arg.type == 'SPECIES_COEFFICIENT__SPECIES__SPECIES_TYPE__ID':
                        if arg.value not in self.objects.get(SpeciesType, {}):
    Severity: Minor
    Found in wc_lang/core.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 create_unit has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        def create_unit(cls, unit, sbml_model):
            """ Add a unit definition to a SBML model
    
            Args:
                unit (:obj:`unit_registry.Unit`): unit
    Severity: Minor
    Found in wc_lang/sbml/util.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 export_to_sbml has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        def export_to_sbml(self, sbml_model):
            """ Add this reaction to a SBML model.
    
            Args:
                sbml_model (:obj:`libsbml.Model`): SBML model
    Severity: Minor
    Found in wc_lang/core.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 get_sub_compartments has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_sub_compartments(self, nested=False):
            """ Get sub-compartments, optionally including all nested sub-compartments
    
            Returns:
                :obj:`list` of :obj:`Compartment`: list of sub-compartments
    Severity: Minor
    Found in wc_lang/core.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 serialize has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def serialize(self, participants, encoded=None):
            """ Serialize related object
    
            Args:
                participants (:obj:`list` of :obj:`SpeciesCoefficient`): Python representation of reaction participants
    Severity: Minor
    Found in wc_lang/core.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 10 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def run(self, path, models=None,
    Severity: Major
    Found in wc_lang/io.py - About 1 hr to fix

      Function lcl has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

              def lcl(self, *args):
                  parts = []
                  for arg in args:
                      if isinstance(arg, lark.tree.Tree):
                          if arg.data == 'lcl_reactants':
      Severity: Minor
      Found in wc_lang/core.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 validate has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          def validate(self):
              """ Determine if the dFBA objective expression is valid
      
              * Check that the expression is a linear function
              * Check if expression is a function of at least one reaction or dFBA objective reaction
      Severity: Minor
      Found in wc_lang/core.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 import_relations_from_sbml has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          def import_relations_from_sbml(self, sbml, objs):
              """ Load relationships from SBML species
      
              Args:
                  sbml (:obj:`libsbml.Species`): SBML species
      Severity: Minor
      Found in wc_lang/core.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

      Severity
      Category
      Status
      Source
      Language