knipknap/django-find

View on GitHub
django_find/models.py

Summary

Maintainability
B
5 hrs
Test Coverage

Searchable has 24 functions (exceeds 20 allowed). Consider refactoring.
Open

class Searchable(object):
    """
    This class is a mixin for Django models that provides methods for
    searching the model using query strings and other tools.
    """
Severity: Minor
Found in django_find/models.py - About 2 hrs to fix

    File models.py has 252 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    """
    This module contains the Searchable mixin, the main public API of
    django-find.
    """
    from collections import OrderedDict
    Severity: Minor
    Found in django_find/models.py - About 2 hrs to fix

      Function get_class_from_fullname has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def get_class_from_fullname(cls, fullname):
              """
              Given a name in the format "Model.hostname", this
              function returns a tuple, where the first element is the Model
              class, and the second is the field name "hostname".
      Severity: Minor
      Found in django_find/models.py - About 35 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 get_fullnames has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def get_fullnames(cls, unique=False):
              """
              Like get_aliases(), but returns the aliases prefixed by the class
              name.
              """
      Severity: Minor
      Found in django_find/models.py - About 35 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

      There are no issues that match your filters.

      Category
      Status