rosedu/wouso

View on GitHub

Showing 551 of 2,707 total issues

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

def home(request, quiet=None, box=None):

    profile = request.user.get_profile()
    msg_user = profile.get_extension(MessagingUser)

Severity: Minor
Found in wouso/interface/apps/messaging/views.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

                                        if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) {
                                            // Cache the index of each encountered element
                                            if ( useCache ) {
                                                (node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ];
                                            }
        Severity: Major
        Found in wouso/resources/static/js/jquery.js - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                  if ( (elem = matcherOut[i]) ) {
                                      // Restore matcherIn since elem is not yet a final match
                                      temp.push( (matcherIn[i] = elem) );
                                  }
          Severity: Major
          Found in wouso/resources/static/js/jquery.js - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                    while ( cur.indexOf( " " + clazz + " " ) >= 0 ) {
                                        cur = cur.replace( " " + clazz + " ", " " );
                                    }
            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 ( (event.result = ret) === false ) {
                                            event.preventDefault();
                                            event.stopPropagation();
                                        }
                Severity: Major
                Found in wouso/resources/static/js/jquery.js - About 45 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

                                            for ( type in data.events ) {
                                                if ( special[ type ] ) {
                                                    jQuery.event.remove( elem, type );
                    
                                                // This is a shortcut to avoid jQuery.event.remove's overhead
                    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

                                                        if ( typeof xhr.responseText === "string" ) {
                                                            responses.text = xhr.responseText;
                                                        }
                        Severity: Major
                        Found in wouso/resources/static/js/jquery.js - About 45 mins to fix

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

                          function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
                          Severity: Minor
                          Found in wouso/resources/static/js/jquery.js - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                                                if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) {
                                                                    return false;
                                                                }
                            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 ( elem.id !== match[2] ) {
                                                            return rootjQuery.find( selector );
                                                        }
                                Severity: Major
                                Found in wouso/resources/static/js/jquery.js - About 45 mins to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language