KarrLab/obj_tables

View on GitHub

Showing 425 of 542 total issues

Function __init__ has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def __init__(self, min_length=0, max_length=255, none=False, default='', default_cleaned_value='', none_value='',
                 verbose_name='', description='',
                 primary=False, unique=False, unique_case_insensitive=False):
        """
        Args:
Severity: Minor
Found in obj_tables/core.py - About 55 mins 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 related_validate has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def related_validate(self, obj, value):
        """ Determine if :obj:`value` is a valid value of the related attribute

        Args:
            obj (:obj:`Model`): object being validated
Severity: Minor
Found in obj_tables/core.py - About 55 mins 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 set_value has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def set_value(self, obj, new_value):
        """ Update the values of the related attributes of the attribute

        Args:
            obj (:obj:`object`): object whose attribute should be set
Severity: Minor
Found in obj_tables/core.py - About 55 mins 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 split_separated_list has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def split_separated_list(joined_values, separator=','):
    """ Parse a separator list of values into a list of values

    Args:
        joined_values (:obj:`str`): seperator-separated list of values
Severity: Minor
Found in obj_tables/core.py - About 55 mins 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 make_obj has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def make_obj(cls, model, model_type, primary_attr, expression, objs, allow_invalid_objects=False):
Severity: Major
Found in obj_tables/math/expression.py - About 50 mins to fix

    Function __init__ has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def __init__(self, default=None, none_value=None, verbose_name='', description='',
    Severity: Major
    Found in obj_tables/math/symbolic.py - About 50 mins to fix

      Function __init__ has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def __init__(self, default=None, none_value=None, verbose_name='', description='',
      Severity: Major
      Found in obj_tables/math/symbolic.py - About 50 mins to fix

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

            def run(self, objects, schema_name=None, models=None, get_related=True,
        Severity: Major
        Found in obj_tables/io.py - About 50 mins to fix

          Function read_sheet has 7 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def read_sheet(self, model, reader, sheet_name, num_row_heading_columns=0, num_column_heading_rows=0,
          Severity: Major
          Found in obj_tables/io.py - About 50 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                    if cls.__module__ + '.' + cls.__name__ == self.species_cls:
                                        self.species_cls = cls
                                        break
                                else:
            Severity: Major
            Found in obj_tables/chem/core.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                      if existing_rel_attr_name in self.deleted_models:
                                          inconsistencies.append("existing model '{}' is not migrated, "
                                                                 "but is referenced by migrated attribute {}.{}".format(existing_rel_attr_name,
                                                                                                                        migrated_class, migrated_attr))
                                      else:
              Severity: Major
              Found in obj_tables/migrate.py - About 45 mins to fix

                Function value_equal has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    def value_equal(self, val1, val2, tol=1e-12):
                        """ Determine if attribute values are equal
                
                        Args:
                            val1 (:obj:`pint.quantity._Quantity`): first value
                Severity: Minor
                Found in obj_tables/sci/units.py - About 45 mins 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 write_migrated_file has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    def write_migrated_file(self, migrated_models, model_order, existing_file, migrated_file=None,
                Severity: Minor
                Found in obj_tables/migrate.py - About 45 mins to fix

                  Function validate has a Cognitive Complexity of 8 (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/sci/onto.py - About 45 mins 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 _write has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      def _write(self, existing_file, migrated_models, schema_metadata_model=None, migrated_file=None,
                  Severity: Minor
                  Found in obj_tables/migrate.py - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                                for attr_spec in attribute_renaming:
                                                    if len(attr_spec) != 2 or not isinstance(attr_spec[0], str) or \
                                                            not isinstance(attr_spec[1], str):
                                                        errors.append(required_structure)
                                except TypeError as e:
                    Severity: Major
                    Found in obj_tables/migrate.py - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                              if cls.__name__ == self.compartment_cls:
                                                  self.compartment_cls = cls
                                                  break
                      
                      
                      Severity: Major
                      Found in obj_tables/chem/core.py - About 45 mins to fix

                        Function __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            def __init__(self, verbose_name='', description="A reaction equation (e.g. 'A[c] <=> B[e]', '[c]: A <=> B')",
                        Severity: Minor
                        Found in obj_tables/chem/core.py - About 45 mins to fix

                          Function __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                              def __init__(self, existing_defs_file=None, migrated_defs_file=None, renamed_models=None,
                          Severity: Minor
                          Found in obj_tables/migrate.py - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                                    if cls.__name__ == self.species_cls:
                                                        self.species_cls = cls
                                                        break
                            
                            
                            Severity: Major
                            Found in obj_tables/chem/core.py - About 45 mins to fix
                              Severity
                              Category
                              Status
                              Source
                              Language