rosedu/wouso

View on GitHub

Showing 551 of 2,707 total issues

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

def main():
    ulist = User.objects.all()
    accounts_per_race_dict = {}
    for u in ulist:
        p = Player.objects.get(user__username=u.username)
Severity: Minor
Found in wouso/utils/get_stats.py - About 55 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 basic_cast has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def basic_cast(self, player_dest, spell, due):
        # Pre-cast God actions: immunity and curse ar done by this
        # check
        can_cast, error = God.can_cast(spell=spell, source=self.player, destination=player_dest)
        if not can_cast:
Severity: Minor
Found in wouso/core/magic/manager.py - About 55 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 time_took has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def time_took(self):
        if not self.finished_time:
            if self.current_quest:
                if self.current_quest.end < datetime.datetime.now():
                    return self.current_quest.end - self.started_time
Severity: Minor
Found in wouso/games/quest/models.py - About 55 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_neighbours_from_top has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def get_neighbours_from_top(self, count, user_race=None, spell_type=None):
        """ Returns an array of neighbouring players from top: count up and count down
            user_race and spell_type are used by mass spells for neighbours list.
        """
        base_query = Player.objects.exclude(user__is_superuser=True).exclude(race__can_play=False)
Severity: Minor
Found in wouso/core/user/models.py - About 55 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 access has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

var access = jQuery.access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
Severity: Major
Found in wouso/resources/static/js/jquery.js - About 50 mins to fix

    Function access has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    var access = jQuery.access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
    Severity: Major
    Found in wouso/resources/static/js/jquery-1.11.1.min.js - About 50 mins to fix

      Function score_simple has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def score_simple(player, coin, amount, game=None, formula=None,
      Severity: Major
      Found in wouso/core/scoring/sm.py - About 50 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                while ( j-- ) {
                                    if ( jQuery.nodeName( (tbody = elem.childNodes[j]), "tbody" ) && !tbody.childNodes.length ) {
                                        elem.removeChild( tbody );
                                    }
                                }
        Severity: Major
        Found in wouso/resources/static/js/jquery.js - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                      if ( !(unmatched[i] || setMatched[i]) ) {
                                          setMatched[i] = pop.call( results );
                                      }
          Severity: Major
          Found in wouso/resources/static/js/jquery.js - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                    if ( deleteExpando ) {
                                        delete elem[ internalKey ];
            
                                    } else if ( typeof elem.removeAttribute !== strundefined ) {
                                        elem.removeAttribute( internalKey );
            Severity: Major
            Found in wouso/resources/static/js/jquery.js - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                      for ( match in context ) {
                                          // Properties of context are called as methods if possible
                                          if ( jQuery.isFunction( this[ match ] ) ) {
                                              this[ match ]( context[ match ] );
              
              
              Severity: Major
              Found in wouso/resources/static/js/jquery.js - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                        if ( hasScripts ) {
                                            jQuery.merge( scripts, getAll( node, "script" ) );
                                        }
                Severity: Major
                Found in wouso/resources/static/js/jquery.js - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                              if (elements) 
                                  elements.push(el);
                  Severity: Major
                  Found in wouso/resources/static/js/jquery.form.js - About 45 mins to fix

                    Function init has 6 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        init: function( elem, options, prop, end, easing, unit ) {
                    Severity: Minor
                    Found in wouso/resources/static/js/jquery.js - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                          if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) &&
                                              contains( context, elem ) && elem.id === m ) {
                                              results.push( elem );
                                              return results;
                                          }
                      Severity: Major
                      Found in wouso/resources/static/js/jquery.js - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                            if ( Expr.relative[ tokens[j].type ] ) {
                                                break;
                                            }
                        Severity: Major
                        Found in wouso/resources/static/js/jquery.js - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                                  if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
                                                      cur += clazz + " ";
                                                  }
                          Severity: Major
                          Found in wouso/resources/static/js/jquery.js - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                                            if ( xhr.readyState !== 4 ) {
                                                                xhr.abort();
                                                            }
                            Severity: Major
                            Found in wouso/resources/static/js/jquery.js - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                                      if ( matches[ sel ] ) {
                                                          matches.push( handleObj );
                                                      }
                              Severity: Major
                              Found in wouso/resources/static/js/jquery.js - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                Open

                                                    if ( conv && s[ "throws" ] ) {
                                                        response = conv( response );
                                                    } else {
                                                        try {
                                                            response = conv( response );
                                Severity: Major
                                Found in wouso/resources/static/js/jquery.js - About 45 mins to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language