Showing 26 of 44 total issues
Function set_form_fields
has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring. Open
def set_form_fields(self, form_field_dict, parent_key=None, field_type=None):
"""
Set the form fields for every key in the form_field_dict.
Params:
- 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_field_value
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def get_field_value(self, field_key):
"""
Given field_key will return value held at self.model_instance. If
model_instance has not been provided will return None.
"""
- 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 process_post_form
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def process_post_form(self, success_message=None):
"""
As long as the form is set on the view this method will validate the form
and save the submitted data. Only call this if you are posting data.
The given success_message will be used with the djanog messages framework
- 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_context_data
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def get_context_data(self, **kwargs):
"""Injects data into the context to replicate CBV ListView."""
context = super(DocumentListView, self).get_context_data(**kwargs)
context = self.set_permissions_in_context(context)
- 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_list_field
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def set_list_field(self, document, form_key, current_key, remaining_key, key_array_digit):
"""1. Figures out what value the list ought to have
2. Sets the list
"""
- 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 make_key
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def make_key(*args, **kwargs):
"""
Given any number of lists and strings will join them in order as one
string separated by the sep kwarg. sep defaults to u"_".
- 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_form_field
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def set_form_field(self, widget, model_field, field_key, default_value):
"""
Parmams:
widget -- the widget to use for displyaing the model_field
model_field -- the field on the model to create a form field with
- 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 addInputFromPrevious
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
function addInputFromPrevious(input, embeddedDoc){
/* This is a fuction to insert an input after an existing
input. It will correclty update the id and name so the
input can be posted as desired.
Function attachButtonEmbedded
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
function attachButtonEmbedded(inputs) {
/* Used to place the add button on the page. Upon each click it
copies the previous input and increments the id and name by using
the addInputFromPrevious function. */
var finalInput = null;
Function get_qset
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def get_qset(self, queryset, q):
"""Performs filtering against the default queryset returned by
mongoengine.
"""
if self.mongoadmin.search_fields and q:
- 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 create_doc_dict
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def create_doc_dict(self, document, doc_key=None, owner_document=None):
"""
Generate a dictionary representation of the document. (no recursion)
DO NOT CALL DIRECTLY
- 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 process_document
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def process_document(self, document, form_key, passed_key):
"""
Given the form_key will evaluate the document and set values correctly for
the document given.
"""
- 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_post_data
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def set_post_data(self):
"""
Need to set form data so that validation on all post data occurs and
places newly entered form data on the form object.
"""
- 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 addInputFromPrevious
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function addInputFromPrevious(input, embeddedDoc){
/* This is a fuction to insert an input after an existing
input. It will correclty update the id and name so the
input can be posted as desired.
- 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_mongoadmin
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def set_mongoadmin(self):
""" Returns the MongoAdmin object for an app_label/document_name style view
"""
if hasattr(self, "mongoadmin"):
return None
- 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_widget
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def get_widget(model_field, disabled=False):
"""Choose which widget to display for a field."""
attrs = get_attrs(model_field, disabled)
- 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_form_field_dict
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_form_field_dict(self, model_dict):
"""
Takes a model dictionary representation and creates a dictionary
keyed by form field. Each value is a keyed 4 tuple of:
(widget, mode_field_instance, model_field_type, field_key)
- 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
Avoid deeply nested control flow statements. Open
if field_type != EmbeddedDocumentField:
field_value.widget.attrs['class'] += ' listField {0}'.format(form_key)
set_list_class = True
Function set_list_field
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def set_list_field(self, document, form_key, current_key, remaining_key, key_array_digit):
Function create_document_dictionary
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def create_document_dictionary(self, document, document_key=None,
owner_document=None):
"""
Given document generates a dictionary representation of the document.
Includes the widget for each for each field in the document.
- 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"