myles/django-contacts

View on GitHub

Showing 9 of 29 total issues

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

from django.db import models
from django.db.models import permalink
from django.conf import settings
from django.utils.translation import ugettext as _
from django.utils.encoding import python_2_unicode_compatible
Severity: Minor
Found in contacts/models.py - About 2 hrs to fix

    Function create has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    def create(request, template='contacts/company/create.html'):
        """Create a company.
    
        :param template: A custom template.
        :param form: A custom form.
    Severity: Minor
    Found in contacts/views/company.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

    Consider simplifying this complex logical expression.
    Open

            if form.is_valid() and phone_formset.is_valid() and \
                    email_formset.is_valid() and im_formset.is_valid() and \
                    website_formset.is_valid() and address_formset.is_valid():
                form.save()
                phone_formset.save()
    Severity: Major
    Found in contacts/views/person.py - About 40 mins to fix

      Consider simplifying this complex logical expression.
      Open

              if form.is_valid() and phone_formset.is_valid() and \
                      email_formset.is_valid() and im_formset.is_valid() and \
                      website_formset.is_valid() and address_formset.is_valid():
                  form.save()
                  phone_formset.save()
      Severity: Major
      Found in contacts/views/company.py - About 40 mins to fix

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

        def update(request, pk, slug=None, template='contacts/person/update.html'):
            """Update a person.
        
            :param template: A custom template.
            """
        Severity: Minor
        Found in contacts/views/person.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 delete has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        def delete(request, pk, slug=None, template='contacts/company/delete.html'):
            """Update a company.
        
            :param template: A custom template.
            """
        Severity: Minor
        Found in contacts/views/company.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

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

        def update(request, pk, slug=None, template='contacts/company/update.html'):
            """Update a company.
        
            :param template: A custom template.
            :param form: A custom form.
        Severity: Minor
        Found in contacts/views/company.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

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

        def delete(request, pk, slug=None, template='contacts/group/delete.html'):
            """Update a group.
        
            :param template: A custom template.
            """
        Severity: Minor
        Found in contacts/views/group.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

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

        def delete(request, pk, slug=None, template='contacts/person/delete.html'):
            """Delete a company.
        
            :param template: A custom template.
            """
        Severity: Minor
        Found in contacts/views/person.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

        Severity
        Category
        Status
        Source
        Language