rosedu/wouso

View on GitHub

Showing 2,707 of 2,707 total issues

Function load has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

jQuery.fn.load = function( url, params, callback ) {
    if ( typeof url !== "string" && _load ) {
        return _load.apply( this, arguments );
    }

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

    Function fixCloneNodeIssues has 32 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function fixCloneNodeIssues( src, dest ) {
        var nodeName, e, data;
    
        // We do not need to do anything for non-Elements
        if ( dest.nodeType !== 1 ) {
    Severity: Minor
    Found in wouso/resources/static/js/jquery.js - About 1 hr to fix

      Function addClass has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          addClass: function( value ) {
              var classes, elem, cur, clazz, j, finalValue,
                  i = 0,
                  len = this.length,
                  proceed = typeof value === "string" && value;
      Severity: Minor
      Found in wouso/resources/static/js/jquery-1.11.1.min.js - About 1 hr to fix

        Function load has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        jQuery.fn.load = function( url, params, callback ) {
            if ( typeof url !== "string" && _load ) {
                return _load.apply( this, arguments );
            }
        
        
        Severity: Minor
        Found in wouso/resources/static/js/jquery-1.11.1.min.js - About 1 hr to fix

          Function fixCloneNodeIssues has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function fixCloneNodeIssues( src, dest ) {
              var nodeName, e, data;
          
              // We do not need to do anything for non-Elements
              if ( dest.nodeType !== 1 ) {
          Severity: Minor
          Found in wouso/resources/static/js/jquery-1.11.1.min.js - About 1 hr to fix

            Function data has 32 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                data: function( key, value ) {
                    var i, name, data,
                        elem = this[0],
                        attrs = elem && elem.attributes;
            
            
            Severity: Minor
            Found in wouso/resources/static/js/jquery-1.11.1.min.js - About 1 hr to fix

              Function removeClass has 32 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  removeClass: function( value ) {
                      var classes, elem, cur, clazz, j, finalValue,
                          i = 0,
                          len = this.length,
                          proceed = arguments.length === 0 || typeof value === "string" && value;
              Severity: Minor
              Found in wouso/resources/static/js/jquery-1.11.1.min.js - About 1 hr to fix

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

                    def read(self, request, player_id=None):
                        if player_id:
                            try:
                                player = Player.objects.get(pk=player_id)
                            except Player.DoesNotExist:
                Severity: Minor
                Found in wouso/interface/api/handlers.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_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 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 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

                Identical blocks of code found in 2 locations. Consider refactoring.
                Open

                        v[6].magic.cast_spell(spell1, v[0], datetime.now()+timedelta(days=1))
                Severity: Major
                Found in wouso/core/magic/tests.py and 1 other location - About 1 hr to fix
                wouso/core/magic/tests.py on lines 71..71

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 41.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Identical blocks of code found in 2 locations. Consider refactoring.
                Open

                        v[6].magic.cast_spell(spell1, v[0], datetime.now()+timedelta(days=1))
                Severity: Major
                Found in wouso/core/magic/tests.py and 1 other location - About 1 hr to fix
                wouso/core/magic/tests.py on lines 75..75

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 41.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                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 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 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 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
                            Severity
                            Category
                            Status
                            Source
                            Language