rosedu/wouso

View on GitHub

Showing 551 of 2,707 total issues

Function list_players has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

def list_players(race=None):
    """List players belonging to a particular race. In case race is missing,
    list all players. Add printing of race name."""
    _players = Player.objects.all()
    if race:
Severity: Minor
Found in wouso/utils/user_util.py - About 1 hr 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 groupset has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

def groupset(request, id):
    profile = get_object_or_404(Player, pk=id)

    from django.forms import ModelForm, SelectMultiple

Severity: Minor
Found in wouso/interface/cpanel/views.py - About 1 hr 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 list_users has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

def list_users(race=None):
    """List users belonging to a particular race. In case race is missing,
    list all users."""
    players = Player.objects.all()
    if race:
Severity: Minor
Found in wouso/utils/user_util.py - About 1 hr 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 scoring_activity_stats has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

def scoring_activity_stats():
    from wouso.core.user.models import Player
    from wouso.core.scoring.models import History

    data = []
Severity: Minor
Found in wouso/utils/stats.py - About 1 hr 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 applyPlacement has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  Tooltip.prototype.applyPlacement = function (offset, placement) {
    var $tip   = this.tip()
    var width  = $tip[0].offsetWidth
    var height = $tip[0].offsetHeight

Severity: Minor
Found in wouso/resources/static/js/bootstrap.js - About 1 hr to fix

    Function main has 31 lines of code (exceeds 25 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 1 hr to fix

      Function handlers has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          handlers: function( event, handlers ) {
              var sel, handleObj, matches, i,
                  handlerQueue = [],
                  delegateCount = handlers.delegateCount,
                  cur = event.target;
      Severity: Minor
      Found in wouso/resources/static/js/jquery.js - About 1 hr to fix

        Function attr has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            attr: function( elem, name, value ) {
                var hooks, ret,
                    nType = elem.nodeType;
        
                // don't get/set attributes on text, comment and attribute nodes
        Severity: Minor
        Found in wouso/resources/static/js/jquery.js - About 1 hr to fix

          Function promise has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          jQuery.ready.promise = function( obj ) {
              if ( !readyList ) {
          
                  readyList = jQuery.Deferred();
          
          
          Severity: Minor
          Found in wouso/resources/static/js/jquery.js - About 1 hr to fix

            Function promise has 30 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            jQuery.ready.promise = function( obj ) {
                if ( !readyList ) {
            
                    readyList = jQuery.Deferred();
            
            
            Severity: Minor
            Found in wouso/resources/static/js/jquery-1.11.1.min.js - About 1 hr to fix

              Function attr has 30 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  attr: function( elem, name, value ) {
                      var hooks, ret,
                          nType = elem.nodeType;
              
                      // don't get/set attributes on text, comment and attribute nodes
              Severity: Minor
              Found in wouso/resources/static/js/jquery-1.11.1.min.js - About 1 hr to fix

                Function handlers has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    handlers: function( event, handlers ) {
                        var sel, handleObj, matches, i,
                            handlerQueue = [],
                            delegateCount = handlers.delegateCount,
                            cur = event.target;
                Severity: Minor
                Found in wouso/resources/static/js/jquery-1.11.1.min.js - About 1 hr to fix

                  Function checkPosition has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    Affix.prototype.checkPosition = function () {
                      if (!this.$element.is(':visible')) return
                  
                      var scrollHeight = $(document).height()
                      var scrollTop    = this.$target.scrollTop()
                  Severity: Minor
                  Found in wouso/resources/static/js/bootstrap.js - About 1 hr to fix

                    Function html has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        html: function( value ) {
                            return access( this, function( value ) {
                                var elem = this[ 0 ] || {},
                                    i = 0,
                                    l = this.length;
                    Severity: Minor
                    Found in wouso/resources/static/js/jquery.js - About 1 hr to fix

                      Function toggleClass has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          toggleClass: function( value, stateVal ) {
                              var type = typeof value;
                      
                              if ( typeof stateVal === "boolean" && type === "string" ) {
                                  return stateVal ? this.addClass( value ) : this.removeClass( value );
                      Severity: Minor
                      Found in wouso/resources/static/js/jquery.js - About 1 hr to fix

                        Function show has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          Collapse.prototype.show = function () {
                            if (this.transitioning || this.$element.hasClass('in')) return
                        
                            var startEvent = $.Event('show.bs.collapse')
                            this.$element.trigger(startEvent)
                        Severity: Minor
                        Found in wouso/resources/static/js/bootstrap.js - About 1 hr to fix

                          Function html has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              html: function( value ) {
                                  return access( this, function( value ) {
                                      var elem = this[ 0 ] || {},
                                          i = 0,
                                          l = this.length;
                          Severity: Minor
                          Found in wouso/resources/static/js/jquery-1.11.1.min.js - About 1 hr to fix

                            Function toggleClass has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                toggleClass: function( value, stateVal ) {
                                    var type = typeof value;
                            
                                    if ( typeof stateVal === "boolean" && type === "string" ) {
                                        return stateVal ? this.addClass( value ) : this.removeClass( value );
                            Severity: Minor
                            Found in wouso/resources/static/js/jquery-1.11.1.min.js - About 1 hr to fix

                              Function fix has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  fix: function( event ) {
                                      if ( event[ jQuery.expando ] ) {
                                          return event;
                                      }
                              
                              
                              Severity: Minor
                              Found in wouso/resources/static/js/jquery.js - About 1 hr to fix

                                Function finish has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    finish: function( type ) {
                                        if ( type !== false ) {
                                            type = type || "fx";
                                        }
                                        return this.each(function() {
                                Severity: Minor
                                Found in wouso/resources/static/js/jquery.js - About 1 hr to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language