KarrLab/obj_tables

View on GitHub

Showing 425 of 542 total issues

Function to_dict has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring.
Open

    def to_dict(object, models=None, encode_primary_objects=True, encoded=None):
        """ Encode a instance of :obj:`Model` or a collection of instances of :obj:`Model` using a simple Python representation
        (dict, list, str, float, bool, None) that is compatible with JSON and YAML. Use :obj:`__id` keys to avoid infinite recursion
        by encoding each object once and referring to objects by their __id for each repeated reference.

Severity: Minor
Found in obj_tables/core.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 deserialize has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring.
Open

    def deserialize(self, value, objects=None, decoded=None):
        """ Deserialize value

        Args:
            value (:obj:`str`): semantically equivalent representation
Severity: Minor
Found in obj_tables/chem/core.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

File refs.py has 525 lines of code (exceeds 250 allowed). Consider refactoring.
Open

""" Attributes for references

:Author: Jonathan Karr <karr@mssm.edu>
:Date: 2019-09-20
:Copyright: 2019, Karr Lab
Severity: Major
Found in obj_tables/sci/refs.py - About 1 day to fix

    Function difference has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
    Open

        def difference(self, other, tol=0.):
            """ Get the semantic difference between two models
    
            Args:
                other (:obj:`Model`): other :obj:`Model`
    Severity: Minor
    Found in obj_tables/core.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

    Function _get_inconsistencies has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
    Open

        def _get_inconsistencies(self, existing_model, migrated_model):
            """ Detect inconsistencies between `existing_model` and `migrated_model` model classes
    
            Detect inconsistencies between `existing_model` and `migrated_model`. Inconsistencies arise if the loaded `existing_model`
            or `migrated_model` definitions are not consistent with their model or attribute renaming specifications
    Severity: Minor
    Found in obj_tables/migrate.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

    Function deserialize_from_cell has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
    Open

        def deserialize_from_cell(self, values, objects, decoded=None):
            """ Deserialize value from cell
    
            Args:
                values (:obj:`str`): String representation
    Severity: Minor
    Found in obj_tables/core.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 units.py has 452 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    """ Unit attribute
    
    :Author: Jonathan Karr <karr@mssm.edu>
    :Date: 2019-01-20
    :Copyright: 2019, Karr Lab
    Severity: Minor
    Found in obj_tables/sci/units.py - About 6 hrs to fix

      Function _tree_str has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
      Open

          def _tree_str(self, printed_objs, depth, max_depth):
              """ Obtain a nested list of string representations of this Model.
      
                  Follows the graph of related :obj:`Model`'s up to a depth of :obj:`max_depth`. Called recursively.
      
      
      Severity: Minor
      Found in obj_tables/core.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

      File seq.py has 442 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      """ Biological attributes
      
      :Author: Jonathan Karr <karr@mssm.edu>
      :Date: 2017-05-10
      :Copyright: 2017, Karr Lab
      Severity: Minor
      Found in obj_tables/bio/seq.py - About 6 hrs to fix

        Function _render_difference has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
        Open

            def _render_difference(self, difference):
                """ Generate string representation of difference data structure
        
                Args:
                    difference (:obj:`dict`): representation of the semantic difference between two objects
        Severity: Minor
        Found in obj_tables/core.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 _simplify_difference has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
        Open

            def _simplify_difference(self, difference):
                """ Simplify difference data structure
        
                Args:
                    difference (:obj:`dict`): representation of the semantic difference between two objects
        Severity: Minor
        Found in obj_tables/core.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 read_sheet has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
        Open

            def read_sheet(self, model, reader, sheet_name, num_row_heading_columns=0, num_column_heading_rows=0,
                           ignore_empty_rows=False, ignore_empty_cols=False):
                """ Read worksheet or file into a two-dimensional list
        
                Args:
        Severity: Minor
        Found in obj_tables/io.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 38 (exceeds 5 allowed). Consider refactoring.
        Open

            def run(self, path, objects, schema_name=None, doc_metadata=None, model_metadata=None,
                    models=None, get_related=True, include_all_attributes=True,
                    validate=True, title=None, description=None, keywords=None, version=None, language=None, creator=None,
                    write_toc=False, write_schema=False, write_empty_models=True, write_empty_cols=True,
                    extra_entries=0, group_objects_by_model=True,
        Severity: Minor
        Found in obj_tables/io.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 eval has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
        Open

            def eval(self, values, with_units=False):
                """ Evaluate the expression
        
                Approach:
        
        
        Severity: Minor
        Found in obj_tables/math/expression.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 34 (exceeds 5 allowed). Consider refactoring.
        Open

            def run(self, path, objects, schema_name=None, doc_metadata=None, model_metadata=None,
                    models=None, get_related=True, include_all_attributes=True, validate=True,
                    title=None, description=None, keywords=None, version=None, language=None, creator=None,
                    write_toc=True, write_schema=False, write_empty_models=True, write_empty_cols=True,
                    extra_entries=0, group_objects_by_model=True, data_repo_metadata=False, schema_package=None,
        Severity: Minor
        Found in obj_tables/io.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 get_xlsx_validation has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
        Open

            def get_xlsx_validation(self, sheet_models=None, doc_metadata_model=None):
                """ Get XLSX validation
        
                Args:
                    sheet_models (:obj:`list` of :obj:`Model`, optional): models encoded as separate sheets
        Severity: Minor
        Found in obj_tables/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 validate_related_attributes has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
        Open

            def validate_related_attributes(metacls, name, bases, namespace):
                """ Check the related attributes
        
                Raises:
                    :obj:`ValueError`: if an :obj:`OneToManyAttribute` or :obj:`ManyToOneAttribute` has a :obj:`related_name`
        Severity: Minor
        Found in obj_tables/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 is_equal has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
        Open

            def is_equal(self, other, tol=0.):
                """ Determine whether two models are semantically equal
        
                Args:
                    other (:obj:`Model`): object to compare
        Severity: Minor
        Found in obj_tables/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 are_related_attributes_serializable has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
        Open

            def are_related_attributes_serializable(cls):
                """ Determine if the immediate related attributes of the class can be serialized
        
                Returns:
                    :obj:`bool`: :obj:`True` if the related attributes can be serialized
        Severity: Minor
        Found in obj_tables/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 get_xlsx_validation has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
        Open

            def get_xlsx_validation(self, sheet_models=None, doc_metadata_model=None):
                """ Get XLSX validation
        
                Args:
                    sheet_models (:obj:`list` of :obj:`Model`, optional): models encoded as separate sheets
        Severity: Minor
        Found in obj_tables/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

        Severity
        Category
        Status
        Source
        Language