rosedu/wouso

View on GitHub

Showing 2,707 of 2,707 total issues

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

    def __init__(self, *args, **kwargs):
        # Set parent's fields
        self._meta.get_field('verbose_name').default = "Question of the Day"
        self._meta.get_field('short_name').default = ""
        # the url field takes as value only a named url from module's urls.py
Severity: Major
Found in wouso/games/qotd/models.py and 7 other locations - About 3 hrs to fix
wouso/games/challenge/models.py on lines 711..717
wouso/games/grandchallenge/models.py on lines 181..187
wouso/games/quest/models.py on lines 304..310
wouso/games/specialchallenge/models.py on lines 103..107
wouso/games/specialquest/models.py on lines 148..154
wouso/games/quiz/models.py on lines 147..151
wouso/games/workshop/models.py on lines 380..385

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 8 locations. Consider refactoring.
Open

    def __init__(self, *args, **kwargs):
        # Set parent's fields
        self._meta.get_field('verbose_name').default = "GrandChallenges"
        self._meta.get_field('short_name').default = ""
        # the url field takes as value only a named url from module's urls.py
Severity: Major
Found in wouso/games/grandchallenge/models.py and 7 other locations - About 3 hrs to fix
wouso/games/challenge/models.py on lines 711..717
wouso/games/qotd/models.py on lines 87..93
wouso/games/quest/models.py on lines 304..310
wouso/games/specialchallenge/models.py on lines 103..107
wouso/games/specialquest/models.py on lines 148..154
wouso/games/quiz/models.py on lines 147..151
wouso/games/workshop/models.py on lines 380..385

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 8 locations. Consider refactoring.
Open

    def __init__(self, *args, **kwargs):
        self._meta.get_field('verbose_name').default = "Quiz"
        self._meta.get_field('short_name').default = ""
        self._meta.get_field('url').default = "quiz_index_view"
        super(QuizGame, self).__init__(*args, **kwargs)
Severity: Major
Found in wouso/games/quiz/models.py and 7 other locations - About 3 hrs to fix
wouso/games/challenge/models.py on lines 711..717
wouso/games/grandchallenge/models.py on lines 181..187
wouso/games/qotd/models.py on lines 87..93
wouso/games/quest/models.py on lines 304..310
wouso/games/specialchallenge/models.py on lines 103..107
wouso/games/specialquest/models.py on lines 148..154
wouso/games/workshop/models.py on lines 380..385

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 8 locations. Consider refactoring.
Open

    def __init__(self, *args, **kwargs):
        # Set parent's fields
        self._meta.get_field('verbose_name').default = "Special Quest"
        self._meta.get_field('short_name').default = ""
        # the url field takes as value only a named url from module's urls.py
Severity: Major
Found in wouso/games/specialquest/models.py and 7 other locations - About 3 hrs to fix
wouso/games/challenge/models.py on lines 711..717
wouso/games/grandchallenge/models.py on lines 181..187
wouso/games/qotd/models.py on lines 87..93
wouso/games/quest/models.py on lines 304..310
wouso/games/specialchallenge/models.py on lines 103..107
wouso/games/quiz/models.py on lines 147..151
wouso/games/workshop/models.py on lines 380..385

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 8 locations. Consider refactoring.
Open

    def __init__(self, *args, **kwargs):
        # Set parent's fields
        self._meta.get_field('verbose_name').default = "Weekly Quest"
        self._meta.get_field('short_name').default = ""
        # the url field takes as value only a named url from module's urls.py
Severity: Major
Found in wouso/games/quest/models.py and 7 other locations - About 3 hrs to fix
wouso/games/challenge/models.py on lines 711..717
wouso/games/grandchallenge/models.py on lines 181..187
wouso/games/qotd/models.py on lines 87..93
wouso/games/specialchallenge/models.py on lines 103..107
wouso/games/specialquest/models.py on lines 148..154
wouso/games/quiz/models.py on lines 147..151
wouso/games/workshop/models.py on lines 380..385

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 8 locations. Consider refactoring.
Open

    def __init__(self, *args, **kwargs):
        # Set parent's fields
        self._meta.get_field('verbose_name').default = "Challenges"
        self._meta.get_field('short_name').default = ""
        # the url field takes as value only a named url from module's urls.py
Severity: Major
Found in wouso/games/challenge/models.py and 7 other locations - About 3 hrs to fix
wouso/games/grandchallenge/models.py on lines 181..187
wouso/games/qotd/models.py on lines 87..93
wouso/games/quest/models.py on lines 304..310
wouso/games/specialchallenge/models.py on lines 103..107
wouso/games/specialquest/models.py on lines 148..154
wouso/games/quiz/models.py on lines 147..151
wouso/games/workshop/models.py on lines 380..385

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 8 locations. Consider refactoring.
Open

    def __init__(self, *args, **kwargs):
        self._meta.get_field('verbose_name').default = "Workshop"
        self._meta.get_field('short_name').default = ""
        # the url field takes as value only a named url from module's urls.py
        self._meta.get_field('url').default = "workshop_index_view"
Severity: Major
Found in wouso/games/workshop/models.py and 7 other locations - About 3 hrs to fix
wouso/games/challenge/models.py on lines 711..717
wouso/games/grandchallenge/models.py on lines 181..187
wouso/games/qotd/models.py on lines 87..93
wouso/games/quest/models.py on lines 304..310
wouso/games/specialchallenge/models.py on lines 103..107
wouso/games/specialquest/models.py on lines 148..154
wouso/games/quiz/models.py on lines 147..151

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 8 locations. Consider refactoring.
Open

    def __init__(self, *args, **kwargs):
        self._meta.get_field('verbose_name').default = "Special Challenge"
        self._meta.get_field('short_name').default = ""
        self._meta.get_field('url').default = "specialchallenge_index"
        super(SpecialChallengeGame, self).__init__(*args, **kwargs)
Severity: Major
Found in wouso/games/specialchallenge/models.py and 7 other locations - About 3 hrs to fix
wouso/games/challenge/models.py on lines 711..717
wouso/games/grandchallenge/models.py on lines 181..187
wouso/games/qotd/models.py on lines 87..93
wouso/games/quest/models.py on lines 304..310
wouso/games/specialquest/models.py on lines 148..154
wouso/games/quiz/models.py on lines 147..151
wouso/games/workshop/models.py on lines 380..385

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 Animation has 84 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function Animation( elem, properties, options ) {
    var result,
        stopped,
        index = 0,
        length = animationPrefilters.length,
Severity: Major
Found in wouso/resources/static/js/jquery.js - About 3 hrs to fix

    Function Animation has 84 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function Animation( elem, properties, options ) {
        var result,
            stopped,
            index = 0,
            length = animationPrefilters.length,
    Severity: Major
    Found in wouso/resources/static/js/jquery-1.11.1.min.js - About 3 hrs to fix

      Consider simplifying this complex logical expression.
      Open

          if (successful && (!n || el.disabled || t == 'reset' || t == 'button' ||
              (t == 'checkbox' || t == 'radio') && !el.checked ||
              (t == 'submit' || t == 'image') && el.form && el.form.clk != el ||
              tag == 'select' && el.selectedIndex == -1)) {
                  return null;
      Severity: Critical
      Found in wouso/resources/static/js/jquery.form.js - About 3 hrs to fix

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

            if args.update_race:
                name = args.update_race[0]
                title = args.update_race[1]
                can_play = (True if args.update_race[2] == '1' else False)
                update_race(name, title, can_play)
        Severity: Major
        Found in wouso/utils/user_util.py and 1 other location - About 3 hrs to fix
        wouso/utils/user_util.py on lines 283..287

        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 66.

        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

            @classmethod
            def get_user_position(kls, user, relative_to=None):
                try:
                    history = History.objects.filter(user=user, relative_to=relative_to).order_by('-date')[0]
                    return history.position
        Severity: Major
        Found in wouso/interface/top/models.py and 1 other location - About 3 hrs to fix
        wouso/interface/top/models.py on lines 227..235

        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 66.

        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

            @classmethod
            def get_group_position(kls, group, relative_to=None):
                try:
                    history = History.objects.filter(group=group, relative_to=relative_to).order_by('-date')[0]
                    return history.position
        Severity: Major
        Found in wouso/interface/top/models.py and 1 other location - About 3 hrs to fix
        wouso/interface/top/models.py on lines 217..225

        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 66.

        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 args.add_race:
                name = args.add_race[0]
                title = args.add_race[1]
                can_play = (True if args.add_race[2] == '1' else False)
                add_race(name, title, can_play)
        Severity: Major
        Found in wouso/utils/user_util.py and 1 other location - About 3 hrs to fix
        wouso/utils/user_util.py on lines 299..303

        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 66.

        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 clean has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
        Open

            def clean(self):
                data = self.cleaned_data
                num = IntegerSetting.get('question_number_of_answers').get_value()
        
                # Check the question text. If the normal text is missing, check for the
        Severity: Minor
        Found in wouso/interface/cpanel/forms.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

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

        def main(args):
            from django.db import models
            from wouso.core.user.models import Player
            from wouso.core.scoring.models import History, Formula
        
        
        Severity: Minor
        Found in wouso/utils/stats.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

            @classmethod
            def is_winner(cls):
                arb_win  = cls.eligible(0)
                arb_lose = cls.eligible(1)
                if (len(arb_win) == 0) and (len(arb_lose) == 2):
        Severity: Major
        Found in wouso/games/grandchallenge/models.py and 1 other location - About 3 hrs to fix
        wouso/games/grandchallenge/models.py on lines 243..249

        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 65.

        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 score has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
        Open

            def score(self):
                if not self.challenge.SCORING:
                    return
        
                for u in (self.challenge.user_to, self.challenge.user_from):
        Severity: Minor
        Found in wouso/games/challenge/models.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

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

        def workshop_grade_assessment(request, assessment):
            assessment = get_object_or_404(Assessment, pk=assessment)
            assistant = request.user.get_profile()
            next_ass = get_next_assessment(assessment)
        
        
        Severity: Minor
        Found in wouso/games/workshop/cpanel.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

        Severity
        Category
        Status
        Source
        Language