django_find/models.py
Searchable
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
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.
"""
File models.py
has 252 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
"""
This module contains the Searchable mixin, the main public API of
django-find.
"""
from collections import OrderedDict
Function get_class_from_fullname
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
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".
- Read upRead up
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
Open
def get_fullnames(cls, unique=False):
"""
Like get_aliases(), but returns the aliases prefixed by the class
name.
"""
- Read upRead up
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"