KarrLab/wc_kb

View on GitHub

Showing 42 of 90 total issues

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

""" Core schema to represent a knowledge base to build models

:Author: Balazs Szigeti <balazs.szigeti@mssm.edu>
:Author: Jonathan Karr <karr@mssm.edu>
:Author: Bilal Shaikh  <bilal.shaikh@columbia.edu>
Severity: Major
Found in wc_kb/core.py - About 4 days to fix

    File eukaryote.py has 559 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    """ Schema to represent a knowledge base to build models of eukaryotes
    
    :Author: Yin Hoon Chew <yinhoon.chew@mssm.edu>
    :Date: 2018-09-10
    :Copyright: 2018, Karr Lab
    Severity: Major
    Found in wc_kb/eukaryote.py - About 1 day to fix

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

      def transform(filename, taxon):
          # 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 run has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring.
      Open

          def run(self, core_path,
                  seq_path='', rewrite_seq_path=True, taxon='prokaryote',
                  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,
                  group_objects_by_model=True, validate=True, read_metadata=False):
      Severity: Minor
      Found in wc_kb/io.py - About 7 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 io.py has 368 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      """ Reading and writing knowledge bases to/from files.
      
      Supported file types:
      
      * Comma separated values (.csv)
      Severity: Minor
      Found in wc_kb/io.py - About 4 hrs to fix

        Function deserialize_side has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
        Open

            def deserialize_side(self, direction, value, objects, global_comp):
                """ Deserialize the LHS or RHS of a reaction equation
                Args:
                    direction (:obj:`float`): -1. indicates LHS, +1. indicates RHS
                    value (:obj:`str`): String representation
        Severity: Minor
        Found in wc_kb/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 transform has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
        Open

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

            def run(self, core_path, knowledge_base,
                    seq_path=None, rewrite_seq_path=True, taxon='prokaryote',
                    models=None, get_related=True, include_all_attributes=False, validate=True,
                    title=None, description=None, keywords=None, version=None, language=None, creator=None,
                    write_schema=False, write_toc=True,
        Severity: Minor
        Found in wc_kb/io.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 deserialize has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
        Open

            def deserialize(cls, attribute, value, objects):
                """ Deserialize value
        
                Args:
                    attribute (:obj:`Attribute`): attribute
        Severity: Minor
        Found in wc_kb/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_implicit_relationships has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
        Open

            def validate_implicit_relationships(cls):
                """ Check that relationships to :obj:`core.KnowledgeBase` and :obj:`core.Cell` do not need to be explicitly written to
                workbooks because they can be inferred by :obj:`Reader.run`
        
                Raises:
        Severity: Minor
        Found in wc_kb/io.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 transform has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
        Open

        def transform(filename, taxon):
            # 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 run has 21 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def run(self, core_path, knowledge_base,
        Severity: Major
        Found in wc_kb/io.py - About 2 hrs to fix

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

              def deserialize(cls, attribute, value, objects):
                  """ Deserialize value
          
                  Args:
                      attribute (:obj:`Attribute`): attribute
          Severity: Minor
          Found in wc_kb/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 deserialize has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
          Open

              def deserialize(self, value, objects, decoded=None):
                  """ Deserialize value
          
                  Args:
                      value (:obj:`str`): String representation
          Severity: Minor
          Found in wc_kb/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

          File prokaryote.py has 253 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          """ Schema to represent a knowledge base to build models of prokaryotes
          
          :Author: Balazs Szigeti <balazs.szigeti@mssm.edu>
          :Author: Jonathan Karr <jonrkarr@gmail.com>
          :Author: Bilal Shaikh  <bilal.shaikh@columbia.edu>
          Severity: Minor
          Found in wc_kb/prokaryote.py - About 2 hrs to fix

            Function deserialize has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
            Open

                def deserialize(cls, attribute, value, objects, compartment=None):
                    """ Deserialize value
            
                    Args:
                        attribute (:obj:`Attribute`): attribute
            Severity: Minor
            Found in wc_kb/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 deserialize has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
            Open

                def deserialize(cls, value, objects):
                    """ Deserialize value
                    Args:
                        value (:obj:`str`): String representation
                        objects (:obj:`dict`): dictionary of objects, grouped by model
            Severity: Minor
            Found in wc_kb/eukaryote.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 15 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def run(self, core_path,
            Severity: Major
            Found in wc_kb/io.py - About 1 hr to fix

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

                  def deserialize(self, value, objects, decoded=None):
                      """ Deserialize value
                      Args:
                          value (:obj:`str`): String representation
                          objects (:obj:`dict`): dictionary of objects, grouped by model
              Severity: Minor
              Found in wc_kb/eukaryote.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_empirical_formula has 32 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def get_empirical_formula(self, cds=True):
                      """ Get the empirical formula
              
                      Returns:
                          :obj:`chem.EmpiricalFormula`: empirical formula
              Severity: Minor
              Found in wc_kb/prokaryote.py - About 1 hr to fix
                Severity
                Category
                Status
                Source
                Language