KarrLab/obj_tables

View on GitHub

Showing 425 of 542 total issues

Function validate_unique has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

    def validate_unique(cls, objects):
        """ Validate attribute uniqueness

        Args:
            objects (:obj:`list` of :obj:`Model`): list of objects
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 find_schema_modules has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

    def find_schema_modules():
        """ Find the modules used by a schema

        Useful for creating schema changes files for a schema repo

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

    def normalize(self):
        """ Normalize an object into a canonical form. Specifically, this method sorts the RelatedManagers
        into a canonical order because their order has no semantic meaning. Importantly, this canonical form
        is reproducible. Thus, this canonical form facilitates reproducible computations on top of :obj:`Model`
        objects.
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_related_obj_id has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

    def _get_related_obj_id(self, idx, case_fold_match=False):
        """ Try to parse a related object `ObjTables` id from :obj:`self._py_tokens` at :obj:`idx`

        Different `ObjTables` objects match different Python token patterns. The default pattern
        is (token.NAME, ), but an object of type :obj:`model_type` can define a custom pattern in
Severity: Minor
Found in obj_tables/math/expression.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 is_serializable has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

    def is_serializable(cls):
        """ Determine if the class (and its related classes) can be serialized

        Raises:
            :obj:`bool`: :obj:`True` if the class can be serialized
Severity: Minor
Found in obj_tables/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 index has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

    def index(self, *args, **kwargs):
        """ Get related object index by attribute/value pairs

        Args:
            *args (:obj:`Model`): object to find
Severity: Minor
Found in obj_tables/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 get_attribute_by_name has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

def get_attribute_by_name(cls, group_name, attr_name, verbose_name=False, case_insensitive=False):
    """ Return the attribute of :obj:`Model` class :obj:`cls` with name :obj:`name`

    Args:
        cls (:obj:`class`): Model class
Severity: Minor
Found in obj_tables/utils.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 numeric.py has 317 lines of code (exceeds 250 allowed). Consider refactoring.
Open

""" Math attributes

:Author: Jonathan Karr <karr@mssm.edu>
:Date: 2017-05-10
:Copyright: 2017, Karr Lab
Severity: Minor
Found in obj_tables/math/numeric.py - About 3 hrs to fix

    Function serialize_to_cell has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
    Open

        def serialize_to_cell(self, values, encoded=None):
            """ Serialize related object
    
            Args:
                values (:obj:`list` of :obj:`Model`): Python representation
    Severity: Minor
    Found in obj_tables/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 _generate_normalize_sort_key_all_attrs has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
    Open

        def _generate_normalize_sort_key_all_attrs(cls, processed_models=None):
            """ Generate a key for sorting models by all of their attributes into a normalized order. This method should
            be used for models which do not have unique attributes or sets of unique attributes.
    
            Args:
    Severity: Minor
    Found in obj_tables/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 get_related has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_related(self, forward=True, reverse=True):
            """ Get all related objects reachable from :obj:`self`
    
            Args:
                forward (:obj:`bool`, optional): if :obj:`True`, get all forward related objects
    Severity: Minor
    Found in obj_tables/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 are_attr_paths_equal has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
    Open

        def are_attr_paths_equal(cls, attr_path, other_attr_path):
            """ Determine if two attribute paths are semantically equal
    
            Args:
                attr_path (:obj:`list` of :obj:`list` of :obj:`object`):
    Severity: Minor
    Found in obj_tables/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 get_cls_and_model has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_cls_and_model(self, id):
            """ Get the class and instance of a related model with id `id`
    
            Args:
                id (:obj:`str`): id
    Severity: Minor
    Found in obj_tables/math/expression.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 307 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    """ Command line utilities for modeling data in tables (XLSX, CSV, TSV)
    
    :Author: Jonathan Karr <karr@mssm.edu>
    :Date: 2019-09-11
    :Copyright: 2019, Karr Lab
    Severity: Minor
    Found in obj_tables/__main__.py - About 3 hrs to fix

      Migrator has 28 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class Migrator(object):
          """ Support schema migration
      
          Attributes:
              existing_schema (:obj:`SchemaModule`): the existing schema, and its properties
      Severity: Minor
      Found in obj_tables/migrate.py - About 3 hrs to fix

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

            def validate(cls, model_obj, parent_obj):
                """ Determine whether an expression model is valid
        
                One check eval's its deserialized expression
        
        
        Severity: Minor
        Found in obj_tables/math/expression.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 _connect_models has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
        Open

            def _connect_models(self, existing_migrated_pairs):
                """ Connect migrated model instances
        
                Migrate :obj:`obj_tables.RelatedAttribute` connections among existing models to migrated models
        
        
        Severity: Minor
        Found in obj_tables/migrate.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 22 (exceeds 5 allowed). Consider refactoring.
        Open

            def deserialize(self, values, objects, decoded=None):
                """ Deserialize value
        
                Args:
                    values (:obj:`object`): String representation
        Severity: Minor
        Found in obj_tables/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 22 (exceeds 5 allowed). Consider refactoring.
        Open

            def run(self, path, schema_name=None, models=None,
                    allow_multiple_sheets_per_model=False,
                    ignore_missing_models=False, ignore_extra_models=False,
                    ignore_sheet_order=False,
                    include_all_attributes=True, ignore_missing_attributes=False, ignore_extra_attributes=False,
        Severity: Minor
        Found in obj_tables/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 run has 24 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def run(self, path, objects, schema_name=None, doc_metadata=None, model_metadata=None,
        Severity: Major
        Found in obj_tables/io.py - About 3 hrs to fix
          Severity
          Category
          Status
          Source
          Language