KarrLab/obj_tables

View on GitHub

Showing 425 of 542 total issues

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

    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

      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

        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

          Function init_related_attributes has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
          Open

              def init_related_attributes(cls, model_cls):
                  """ Initialize related attributes """
                  for attr in model_cls.Meta.attributes.values():
                      if isinstance(attr, RelatedAttribute):
          
          
          Severity: Minor
          Found in obj_tables/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 21 (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 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 cut_relations has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
          Open

              def cut_relations(self, objs_to_keep=None):
                  """ Cut relations to objects not in :obj:`objs`.
          
                  Args:
                      objs_to_keep (:obj:`set` of :obj:`Model`, optional): objects to retain relations to
          Severity: Minor
          Found in obj_tables/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 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 read_worksheet_metadata has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
          Open

              def read_worksheet_metadata(cls, sheet_name, rows):
                  """ Read worksheet metadata
          
                  Args:
                      sheet_name (:obj:`str`): sheet name
          Severity: Minor
          Found in obj_tables/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 viz_schema has 21 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def viz_schema(module, filename, attributes=True, tail_labels=True, hidden_classes=None, extra_edges=None,
          Severity: Major
          Found in obj_tables/utils.py - About 2 hrs to fix

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

            def decode_data(encoded_data):
                """ Decode a data structure (arbitrary combination of list and dictionaries) that contains
                dictionaries that represent encoded objects and their relationships, preserving the high-level
                structure of the data structure. Objects and their relationships should be encoded into the
                data structure as follows:
            Severity: Minor
            Found in examples/decode_json_data.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, obj, value):
                    """ Determine if :obj:`value` is a valid value
            
                    Args:
                        obj (:obj:`Model`): class being validated
            Severity: Minor
            Found in obj_tables/math/numeric.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 standardize has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
            Open

                def standardize(self):
                    """ Standardize the attributes of a :obj:`MigrationSpec`
            
                    In particular, standardize a :obj:`MigrationSpec` that has been read from a YAML config file
                    """
            Severity: Minor
            Found in obj_tables/migrate.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 __init__ has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
            Open

                def __init__(self, enum_class, none=False, default=None, default_cleaned_value=None, none_value=None, verbose_name='', description='',
                             primary=False, unique=False, unique_case_insensitive=False):
                    """
                    Args:
                        enum_class (:obj:`type` or :obj:`list`): subclass of :obj:`Enum`, :obj:`list` of enumerated names,
            Severity: Minor
            Found in obj_tables/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 __new__ has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
            Open

                def __new__(metacls, name, bases, namespace):
                    """
                    Args:
                        metacls (:obj:`Model`): :obj:`Model`, or a subclass of :obj:`Model`
                        name (:obj:`str`): :obj:`Model` class name
            Severity: Minor
            Found in obj_tables/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, obj, value):
                    """ Determine if :obj:`value` is a valid value of the attribute
            
                    Args:
                        obj (:obj:`Model`): object being validated
            Severity: Minor
            Found in obj_tables/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_xlsx_validation has a Cognitive Complexity of 19 (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 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_xlsx_validation has a Cognitive Complexity of 19 (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 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 diff_workbooks has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
            Open

            def diff_workbooks(filename_1, filename_2, models, model_name, schema_name=None, **kwargs):
                """ Get difference of models in two workbooks
            
                Args:
                    filename_1 (:obj:`str`): path to first workbook
            Severity: Minor
            Found in obj_tables/utils.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

            Manager has 23 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class Manager(object):
                """ Enable O(1) dictionary-based searching of a Model's instances
            
                This class is inspired by Django's :obj:`Manager` class. An instance of :obj:`Manger` is associated with
                each :obj:`Model` and accessed as the class attribute :obj:`objects` (as in Django).
            Severity: Minor
            Found in obj_tables/core.py - About 2 hrs to fix
              Severity
              Category
              Status
              Source
              Language