jazzband/django-mongonaut

View on GitHub
mongonaut/mixins.py

Summary

Maintainability
C
7 hrs
Test Coverage

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
Severity: Minor
Found in mongonaut/mixins.py - About 2 hrs 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_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
        """

Severity: Minor
Found in mongonaut/mixins.py - About 1 hr 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 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.
        """
Severity: Minor
Found in mongonaut/mixins.py - About 1 hr 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_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
Severity: Minor
Found in mongonaut/mixins.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_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):
Severity: Minor
Found in mongonaut/mixins.py - About 35 mins to fix

    Function get_mongoadmins has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_mongoadmins(self):
            """ Returns a list of all mongoadmin implementations for the site """
            apps = []
            for app_name in settings.INSTALLED_APPS:
                mongoadmin = "{0}.mongoadmin".format(app_name)
    Severity: Minor
    Found in mongonaut/mixins.py - About 25 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