Showing 551 of 2,707 total issues
File achievements.py
has 336 lines of code (exceeds 250 allowed). Consider refactoring. Open
import logging
from datetime import datetime, timedelta
from django.utils.translation import ugettext_noop
from core import scoring
from core.scoring.sm import score
File models.py
has 325 lines of code (exceeds 250 allowed). Consider refactoring. Open
from django.db import models
from django.db.models import Q, Max
import logging
from wouso.core.config.models import IntegerSetting
from wouso.core.game.models import Game
Challenge
has 30 functions (exceeds 20 allowed). Consider refactoring. Open
class Challenge(models.Model):
STATUS = (
('L', 'Launched'),
('A', 'Accepted'),
('R', 'Refused'),
Function bazaar_exchange
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def bazaar_exchange(request):
gold_rate = scoring.calculate('gold-points-rate', gold=1)['points']
points_rate = scoring.calculate('points-gold-rate', points=1)['gold']
player = request.user.get_profile()
- Read upRead up
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 trigger
has 89 lines of code (exceeds 25 allowed). Consider refactoring. Open
trigger: function( event, data, elem, onlyHandlers ) {
var handle, ontype, cur,
bubbleType, special, tmp, i,
eventPath = [ elem || document ],
type = hasOwn.call( event, "type" ) ? event.type : event,
Function trigger
has 89 lines of code (exceeds 25 allowed). Consider refactoring. Open
trigger: function( event, data, elem, onlyHandlers ) {
var handle, ontype, cur,
bubbleType, special, tmp, i,
eventPath = [ elem || document ],
type = hasOwn.call( event, "type" ) ? event.type : event,
File views.py
has 310 lines of code (exceeds 250 allowed). Consider refactoring. Open
from django.contrib import messages
from django.template.loader import render_to_string
from django.utils.translation import ugettext as _
from django.core.urlresolvers import reverse
from django.http import Http404
Function clean
has a Cognitive Complexity of 24 (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
- Read upRead up
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 _calculate_points
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def _calculate_points(cls, responses):
""" Response contains a dict with question id and checked answers ids.
Example:
{1 : [14,], ...}, - has answered answer with id 14 at the question with id 1
"""
- Read upRead up
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 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,
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,
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;
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
- Read upRead up
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 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
- Read upRead up
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)
- Read upRead up
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
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):
- Read upRead up
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 initialize
has 80 lines of code (exceeds 25 allowed). Consider refactoring. Open
function initialize(options) {
// Check if moment.js is available
var momentJsAvailable = (typeof moment !== 'undefined');
// Set class based on sign parameter
Function read
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def read(self, request, challenge_id, action='play'):
player = request.user.get_profile()
challuser = player.get_extension(ChallengeUser)
try:
challenge = Challenge.objects.get(pk=challenge_id)
- Read upRead up
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 forms.py
has 294 lines of code (exceeds 250 allowed). Consider refactoring. Open
from django import forms
from django.contrib.auth.models import User, Group
from django.shortcuts import get_object_or_404
from ckeditor.widgets import CKEditorWidget
Function Sizzle
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
function Sizzle( selector, context, results, seed ) {
var match, elem, m, nodeType,
// QSA vars
i, groups, old, nid, newContext, newSelector;