rosedu/wouso

View on GitHub

Showing 551 of 2,707 total issues

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

    def activity_handler(cls, sender, **kwargs):
        action = kwargs.get('action', None)
        rules = filter(lambda x: x[2] == action, cls.SECURITY_RULES)
        for rule in rules:
            # check if rule is not disabled
Severity: Minor
Found in wouso/core/security/sec.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 setup_staff_groups has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def setup_staff_groups():
    for g in get_games():
        for group in g.get_staff_and_permissions():
            group_obj = Group.objects.get_or_create(name=group['name'])[0]
            for p in group.get('permissions', []):
Severity: Minor
Found in wouso/core/user/utils.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 test_post_challenge has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def test_post_challenge(self):
        # create an active challenge, with fake questions
        Formula.add('chall-warranty')
        Formula.add('chall-timer')
        category = Category.add('challenge')
Severity: Minor
Found in wouso/games/challenge/tests.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 get_questions_with_tag_for_day has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def get_questions_with_tag_for_day(tag, select):
    if isinstance(tag, str):
        query = Question.objects.filter(tags__name=tag).exclude(endorsed_by__isnull=True)
        for q in query:
            if q.day == select:
Severity: Minor
Found in wouso/core/qpool/__init__.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 check_self_boxes has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def check_self_boxes(self):
        for i in range(len(self.visible_fields())):
            field = self.visible_fields()[i]
            checked_boxes = self.data.getlist(field.html_name)
            for j in range(len(field.field.choices)):
Severity: Minor
Found in wouso/games/challenge/forms.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_points has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def update_points(player, game):
    level = God.get_level_for_points(player.points)

    if level == player.level_no:
        return
Severity: Minor
Found in wouso/core/scoring/sm.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 api_enabled_required has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def api_enabled_required(function=None):

    def _dec(function):
        def _view(request, *args, **kwargs):
            from django.conf import settings
Severity: Minor
Found in wouso/core/decorators.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 chall_was_set_up has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def chall_was_set_up(cls, **kwargs):
        """
        Parse the chall-won activity message to
        check the time it took for the loser to finish the challenge
        """
Severity: Minor
Found in wouso/core/security/sec.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 get_result has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def get_result(self):
        for u in (self.challenge.user_to, self.challenge.user_from):
            if u.user.magic.has_modifier('challenge-always-lose'):
                u.score = -1

Severity: Minor
Found in wouso/games/challenge/models.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 handle has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def handle(self, *args, **options):
        self.stdout.write('Starting at: %s\n' % datetime.now())

        # Now handle other apps
        from wouso.interface.apps import get_apps
Severity: Minor
Found in wouso/core/game/management/commands/wousocron.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 _get_cache_key has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def _get_cache_key(function, *args, **kwargs):
    params = inspect.getargspec(function)[0]
    cache_key = 'F-%s-' % function.__name__
    for i, param_name in enumerate(params):
        if i < len(args):
Severity: Minor
Found in wouso/core/decorators.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