aldryn/aldryn-faq

View on GitHub

Showing 39 of 39 total issues

Function populate has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
Open

    def populate(self):
        self.config = self.__get_faq_config()
        user = getattr(self.request, 'user', None)
        try:
            view_name = self.request.resolver_match.view_name
Severity: Minor
Found in aldryn_faq/cms_toolbars.py - About 6 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

Similar blocks of code found in 3 locations. Consider refactoring.
Open

        migrations.CreateModel(
            name='TopQuestionsPlugin',
            fields=[
                ('cmsplugin_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='cms.CMSPlugin')),
                ('questions', models.IntegerField(default=5, help_text='The number of questions to be displayed.')),
Severity: Major
Found in aldryn_faq/migrations/0001_initial.py and 2 other locations - About 3 hrs to fix
aldryn_faq/migrations/0001_initial.py on lines 88..97
aldryn_faq/migrations/0001_initial.py on lines 99..108

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 67.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

        migrations.CreateModel(
            name='MostReadQuestionsPlugin',
            fields=[
                ('cmsplugin_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='cms.CMSPlugin')),
                ('questions', models.IntegerField(default=5, help_text='The number of questions to be displayed.')),
Severity: Major
Found in aldryn_faq/migrations/0001_initial.py and 2 other locations - About 3 hrs to fix
aldryn_faq/migrations/0001_initial.py on lines 88..97
aldryn_faq/migrations/0001_initial.py on lines 171..180

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 67.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

        migrations.CreateModel(
            name='LatestQuestionsPlugin',
            fields=[
                ('cmsplugin_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='cms.CMSPlugin')),
                ('questions', models.IntegerField(default=5, help_text='The number of questions to be displayed.')),
Severity: Major
Found in aldryn_faq/migrations/0001_initial.py and 2 other locations - About 3 hrs to fix
aldryn_faq/migrations/0001_initial.py on lines 99..108
aldryn_faq/migrations/0001_initial.py on lines 171..180

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 67.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Function get_category has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

    def get_category(self, queryset=None):
        """
        Fetch the object using a translated slug. This is largely stolen from
        Parler, but modified to remove any assumptions that this is being used
        on a DetailView.
Severity: Minor
Found in aldryn_faq/views.py - About 3 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

Similar blocks of code found in 2 locations. Consider refactoring.
Open

            if change_category_perm and category:
                url_args = {}
                if language:
                    url_args = {'language': language, }
                url = get_admin_url('aldryn_faq_category_change',
Severity: Major
Found in aldryn_faq/cms_toolbars.py and 1 other location - About 3 hrs to fix
aldryn_faq/cms_toolbars.py on lines 212..218

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 63.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

            if change_question_perm and question:
                url_args = {}
                if language:
                    url_args = {'language': language, }
                url = get_admin_url('aldryn_faq_question_change',
Severity: Major
Found in aldryn_faq/cms_toolbars.py and 1 other location - About 3 hrs to fix
aldryn_faq/cms_toolbars.py on lines 181..187

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 63.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Function get_nodes has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

    def get_nodes(self, request):
        nodes = []
        language = get_language_from_request(request, check_path=True)
        # don't bother with categories that don't have appconfig.
        categories = Category.objects.active_translations(
Severity: Minor
Found in aldryn_faq/cms_menus.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

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

# -*- coding: utf-8 -*-

from __future__ import unicode_literals
from functools import partial

Severity: Minor
Found in aldryn_faq/models.py - About 2 hrs to fix

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

                if delete_question_perm and question:
                    redirect_url = self.get_on_delete_redirect_url(
                        question, language)
                    url = get_admin_url('aldryn_faq_question_delete',
                                        [question.pk, ])
    Severity: Major
    Found in aldryn_faq/cms_toolbars.py and 1 other location - About 2 hrs to fix
    aldryn_faq/cms_toolbars.py on lines 190..195

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 55.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

                if delete_category_perm and category:
                    redirect_url = self.get_on_delete_redirect_url(
                        category, language)
                    url = get_admin_url('aldryn_faq_category_delete',
                                        [category.pk, ])
    Severity: Major
    Found in aldryn_faq/cms_toolbars.py and 1 other location - About 2 hrs to fix
    aldryn_faq/cms_toolbars.py on lines 221..226

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 55.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        def __str__(self):
            pkstr = str(self.pk)
            if six.PY2:
                pkstr = six.u(pkstr)
            return self.safe_translation_getter('title', default=pkstr)
    Severity: Major
    Found in aldryn_faq/models.py and 1 other location - About 1 hr to fix
    aldryn_faq/models.py on lines 100..104

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 47.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        def __str__(self):
            pkstr = str(self.pk)
            if six.PY2:
                pkstr = six.u(pkstr)
            return self.safe_translation_getter('name', default=pkstr)
    Severity: Major
    Found in aldryn_faq/models.py and 1 other location - About 1 hr to fix
    aldryn_faq/models.py on lines 179..183

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 47.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 5 locations. Consider refactoring.
    Open

            migrations.AddField(
                model_name='faqconfig',
                name='placeholder_faq_sidebar_top',
                field=cms.models.fields.PlaceholderField(related_name='aldryn_faq_sidebar_top', slotname='faq_sidebar_top', editable=False, to='cms.Placeholder', null=True),
    Severity: Major
    Found in aldryn_faq/migrations/0004_auto_20150626_1205.py and 4 other locations - About 1 hr to fix
    aldryn_faq/migrations/0004_auto_20150626_1205.py on lines 16..19
    aldryn_faq/migrations/0004_auto_20150626_1205.py on lines 22..25
    aldryn_faq/migrations/0004_auto_20150626_1205.py on lines 28..31
    aldryn_faq/migrations/0004_auto_20150626_1205.py on lines 34..37

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 42.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 5 locations. Consider refactoring.
    Open

            migrations.AddField(
                model_name='faqconfig',
                name='placeholder_faq_content',
                field=cms.models.fields.PlaceholderField(related_name='aldryn_faq_content', slotname='faq_content', editable=False, to='cms.Placeholder', null=True),
    Severity: Major
    Found in aldryn_faq/migrations/0004_auto_20150626_1205.py and 4 other locations - About 1 hr to fix
    aldryn_faq/migrations/0004_auto_20150626_1205.py on lines 22..25
    aldryn_faq/migrations/0004_auto_20150626_1205.py on lines 28..31
    aldryn_faq/migrations/0004_auto_20150626_1205.py on lines 34..37
    aldryn_faq/migrations/0004_auto_20150626_1205.py on lines 40..43

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 42.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 5 locations. Consider refactoring.
    Open

            migrations.AddField(
                model_name='faqconfig',
                name='placeholder_faq_sidebar_bottom',
                field=cms.models.fields.PlaceholderField(related_name='aldryn_faq_sidebar_bottom', slotname='faq_sidebar_bottom', editable=False, to='cms.Placeholder', null=True),
    Severity: Major
    Found in aldryn_faq/migrations/0004_auto_20150626_1205.py and 4 other locations - About 1 hr to fix
    aldryn_faq/migrations/0004_auto_20150626_1205.py on lines 16..19
    aldryn_faq/migrations/0004_auto_20150626_1205.py on lines 22..25
    aldryn_faq/migrations/0004_auto_20150626_1205.py on lines 28..31
    aldryn_faq/migrations/0004_auto_20150626_1205.py on lines 40..43

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 42.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 5 locations. Consider refactoring.
    Open

            migrations.AddField(
                model_name='faqconfig',
                name='placeholder_faq_list_top',
                field=cms.models.fields.PlaceholderField(related_name='aldryn_faq_list_top', slotname='faq_list_top', editable=False, to='cms.Placeholder', null=True),
    Severity: Major
    Found in aldryn_faq/migrations/0004_auto_20150626_1205.py and 4 other locations - About 1 hr to fix
    aldryn_faq/migrations/0004_auto_20150626_1205.py on lines 16..19
    aldryn_faq/migrations/0004_auto_20150626_1205.py on lines 22..25
    aldryn_faq/migrations/0004_auto_20150626_1205.py on lines 34..37
    aldryn_faq/migrations/0004_auto_20150626_1205.py on lines 40..43

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 42.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 5 locations. Consider refactoring.
    Open

            migrations.AddField(
                model_name='faqconfig',
                name='placeholder_faq_list_bottom',
                field=cms.models.fields.PlaceholderField(related_name='aldryn_faq_list_bottom', slotname='faq_list_bottom', editable=False, to='cms.Placeholder', null=True),
    Severity: Major
    Found in aldryn_faq/migrations/0004_auto_20150626_1205.py and 4 other locations - About 1 hr to fix
    aldryn_faq/migrations/0004_auto_20150626_1205.py on lines 16..19
    aldryn_faq/migrations/0004_auto_20150626_1205.py on lines 28..31
    aldryn_faq/migrations/0004_auto_20150626_1205.py on lines 34..37
    aldryn_faq/migrations/0004_auto_20150626_1205.py on lines 40..43

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 42.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

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

        def get_absolute_url(self, language=None, slug=None):
            language = language or get_current_language()
    
            if not slug:
                slug = self.known_translation_getter(
    Severity: Minor
    Found in aldryn_faq/models.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 get_absolute_url has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_absolute_url(self, language=None):
            """
            Returns the absolute_url of this question object, respecting the
            configured fallback languages.
            """
    Severity: Minor
    Found in aldryn_faq/models.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

    Severity
    Category
    Status
    Source
    Language