rosedu/wouso

View on GitHub

Showing 551 of 2,707 total issues

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

def review_change(request, review):
    review = get_object_or_404(Review, pk=review)
    player = request.user.get_profile()

    if review.reviewer != player:
Severity: Minor
Found in wouso/games/workshop/views.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 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_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 header_link has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def header_link(context):
    user = context.get('user', None)
    if not user or not user.is_authenticated():
        return dict(text=_('Challenges'))

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

    def save(self, commit=True):
        data = self.cleaned_data

        # Create a dict containing tags as keys and the corresponding number of
        # questions to be taken from the pool as values
Severity: Minor
Found in wouso/games/quiz/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 give_modifier has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def give_modifier(self, modifier, amount=1):
        """ Add given amount to existing, or create new artifact amount
        for the current user.

        Return the PlayerArtifactAmount object after applying changes.
Severity: Minor
Found in wouso/core/magic/manager.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

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

def spell_cleanup(spell, destination, spell_name):
    """
    This function eliminates same type spells with contrary sign +/-
    """
    existing = destination.magic.spells.filter(spell__name=spell_name)
Severity: Minor
Found in wouso/core/god/god.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 score_simple has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def score_simple(player, coin, amount, game=None, formula=None,
                 external_id=None, percents=100):

    """ Give amount of coin to the player.
    """
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

Severity
Category
Status
Source
Language