rosedu/wouso

View on GitHub

Showing 551 of 2,707 total issues

File tests.py has 484 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import json
import unittest
from datetime import datetime,timedelta
from mock import patch
from django.contrib.auth.models import User
Severity: Minor
Found in wouso/games/challenge/tests.py - About 7 hrs to fix

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

    from math import ceil
    from random import shuffle
    from datetime import datetime, time, timedelta
    from django.db import models
    from django.template.loader import render_to_string
    Severity: Minor
    Found in wouso/games/workshop/models.py - About 6 hrs to fix

      File tests.py has 439 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      from django.core.cache import cache
      import unittest
      from datetime import datetime
      from django.contrib.auth.models import User, Group, Permission
      from django.contrib.contenttypes.models import ContentType
      Severity: Minor
      Found in wouso/interface/cpanel/tests.py - About 6 hrs to fix

        File handlers.py has 435 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        from datetime import datetime, timedelta
        from django.shortcuts import get_object_or_404
        from django.template.defaultfilters import slugify
        from django.utils.html import strip_tags
        from piston.handler import BaseHandler
        Severity: Minor
        Found in wouso/interface/api/handlers.py - About 6 hrs to fix

          File jquery.autocomplete.js has 420 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          /**
           * Jquery Auto Complete Plugin by Dylan Verheul
           * url: http://www.dyve.net/jquery/?autocomplete
           * from the site: "Licensed like jQuery, see http://docs.jquery.com/License."
           */
          Severity: Minor
          Found in wouso/resources/static/js/jquery.autocomplete.js - About 6 hrs to fix

            Function try_using_cookie has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
            Open

            def try_using_cookie(username, first_name, last_name, email, password, cookie):
                (username, ret) = try_using_cookie_no_recurse(username, first_name, last_name, email, password, cookie)
            
                if ret == OP_SUCCESS:
                    return (username, True)
            Severity: Minor
            Found in wouso/utils/add_users_force.py - About 5 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 try_using_cookie has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
            Open

            def try_using_cookie(username, first_name, last_name, email, password, cookie):
                (username, ret) = try_using_cookie_no_recurse(username, first_name, last_name, email, password, cookie)
            
                if ret == OP_SUCCESS:
                    return (username, True)
            Severity: Minor
            Found in wouso/utils/add_users_force_to_race.py - About 5 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 tests.py has 394 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import unittest
            from datetime import datetime, timedelta
            from django.contrib.auth.models import User
            from django.core.urlresolvers import reverse
            from django.db import IntegrityError
            Severity: Minor
            Found in wouso/core/magic/tests.py - About 5 hrs to fix

              CpanelViewsTest has 40 functions (exceeds 20 allowed). Consider refactoring.
              Open

              class CpanelViewsTest(WousoTest):
                  def setUp(self):
                      super(CpanelViewsTest, self).setUp()
                      self.admin = self._get_superuser()
                      self.client = Client()
              Severity: Minor
              Found in wouso/interface/cpanel/tests.py - About 5 hrs to fix

                Function Callbacks has 128 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                jQuery.Callbacks = function( options ) {
                
                    // Convert options from String-formatted to Object-formatted if needed
                    // (we check in cache first)
                    options = typeof options === "string" ?
                Severity: Major
                Found in wouso/resources/static/js/jquery.js - About 5 hrs to fix

                  Function Callbacks has 128 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  jQuery.Callbacks = function( options ) {
                  
                      // Convert options from String-formatted to Object-formatted if needed
                      // (we check in cache first)
                      options = typeof options === "string" ?
                  Severity: Major
                  Found in wouso/resources/static/js/jquery-1.11.1.min.js - About 5 hrs to fix

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

                    def main():
                        """In main, parse command line arguments and call corresponding functions.
                        """
                    
                        parser = argparse.ArgumentParser()
                    Severity: Minor
                    Found in wouso/utils/user_util.py - About 5 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 cb has 125 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            function cb(e) {
                                if (xhr.aborted || callbackProcessed) {
                                    return;
                                }
                                try {
                    Severity: Major
                    Found in wouso/resources/static/js/jquery.form.js - About 5 hrs to fix

                      Consider simplifying this complex logical expression.
                      Open

                                  if ( event.pageX == null && original.clientX != null ) {
                                      eventDoc = event.target.ownerDocument || document;
                                      doc = eventDoc.documentElement;
                                      body = eventDoc.body;
                      
                      
                      Severity: Critical
                      Found in wouso/resources/static/js/jquery.js - About 5 hrs to fix

                        Consider simplifying this complex logical expression.
                        Open

                                    if ( event.pageX == null && original.clientX != null ) {
                                        eventDoc = event.target.ownerDocument || document;
                                        doc = eventDoc.documentElement;
                                        body = eventDoc.body;
                        
                        
                        Severity: Critical
                        Found in wouso/resources/static/js/jquery-1.11.1.min.js - About 5 hrs to fix

                          File cpanel.py has 363 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          from django import forms
                          from django.shortcuts import render_to_response, redirect, get_object_or_404
                          from django.template.context import RequestContext
                          from django.views.generic import View, ListView, UpdateView, CreateView, \
                              DetailView
                          Severity: Minor
                          Found in wouso/games/workshop/cpanel.py - About 4 hrs to fix

                            Function remove has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
                            Open

                                    remove: function(element, label, fn) {
                                        var timers = element.$timers, ret;
                                        
                                        if ( timers ) {
                                            
                            Severity: Minor
                            Found in wouso/resources/static/js/jquery.timers.js - About 4 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 346 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            # Quest will use QPool questions tagged 'quest'
                            import os
                            import logging
                            import datetime
                            import subprocess
                            Severity: Minor
                            Found in wouso/games/quest/models.py - About 4 hrs to fix

                              Function defaultPrefilter has 105 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              function defaultPrefilter( elem, props, opts ) {
                                  /* jshint validthis: true */
                                  var prop, value, toggle, tween, hooks, oldfire, display, checkDisplay,
                                      anim = this,
                                      orig = {},
                              Severity: Major
                              Found in wouso/resources/static/js/jquery.js - About 4 hrs to fix

                                Function defaultPrefilter has 105 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                function defaultPrefilter( elem, props, opts ) {
                                    /* jshint validthis: true */
                                    var prop, value, toggle, tween, hooks, oldfire, display, checkDisplay,
                                        anim = this,
                                        orig = {},
                                Severity: Major
                                Found in wouso/resources/static/js/jquery-1.11.1.min.js - About 4 hrs to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language