File __init__.py
has 690 lines of code (exceeds 250 allowed). Consider refactoring. Open
from functools import partial
from itertools import chain
from operator import attrgetter
import collections.abc
import copy
Function __new__
has a Cognitive Complexity of 69 (exceeds 5 allowed). Consider refactoring. Open
def __new__(cls, name, bases, attrs):
parents = [b for b in bases if isinstance(b, DjangoCassandraModelMetaClass)]
if not parents:
return super(ModelBase, cls).__new__(cls, name, bases, attrs)
- 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 python_order_by
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def python_order_by(self, qset, colnames):
if not isinstance(qset, list):
raise TypeError("qset must be a list")
colnames = convert_pk_field_names_to_real(
model=self.model, field_names=colnames
- 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 __new__
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
def __new__(cls, name, bases, attrs):
parents = [b for b in bases if isinstance(b, DjangoCassandraModelMetaClass)]
if not parents:
return super(ModelBase, cls).__new__(cls, name, bases, attrs)
Function order_by
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def order_by(self, *colnames):
if len(colnames) == 0:
clone = copy.deepcopy(self)
clone._order = []
return clone
- 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 convert_pk_field_names_to_real
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def convert_pk_field_names_to_real(model, field_names):
"""
Convert field names including 'pk' to the real field names:
>>> convert_pk_field_names_to_real(['pk', 'another_field'])
['real_pk_field', 'another_field']
- 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 _add_django_meta_and_register_model
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def _add_django_meta_and_register_model(cls, klass, attrs, name):
# Create the class.
module = attrs.get("__module__")
if not module:
return klass
- 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 _set_column_django_attributes
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def _set_column_django_attributes(self, cql_column, name):
allow_null = (
(
not cql_column.required
and not cql_column.is_primary_key
Function exclude
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def exclude(self, *args, **kwargs):
new_queryset = []
for model in self.get_queryset():
should_exclude_model = False
for field_name, field_value in kwargs.items():
- 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 _give_columns_django_field_attributes
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _give_columns_django_field_attributes(self):
"""
Add Django Field attributes to each cqlengine.Column instance.
So that the Django Options class may interact with it as if it were
a Django Field.
- 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"