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)
- Read upRead up
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:
- Read upRead up
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
- Read upRead up
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)
- Read upRead up
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 ) {
Function access
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
var access = jQuery.access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
Function score_simple
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def score_simple(player, coin, amount, game=None, formula=None,
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 ];
}
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) );
}
Avoid deeply nested control flow statements. Open
while ( cur.indexOf( " " + clazz + " " ) >= 0 ) {
cur = cur.replace( " " + clazz + " ", " " );
}
Avoid deeply nested control flow statements. Open
if ( hasScripts ) {
jQuery.merge( scripts, getAll( node, "script" ) );
}
Avoid deeply nested control flow statements. Open
if ( (event.result = ret) === false ) {
event.preventDefault();
event.stopPropagation();
}
Avoid deeply nested control flow statements. Open
while ( j-- ) {
if ( jQuery.nodeName( (tbody = elem.childNodes[j]), "tbody" ) && !tbody.childNodes.length ) {
elem.removeChild( tbody );
}
}
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
Avoid deeply nested control flow statements. Open
if ( deleteExpando ) {
delete elem[ internalKey ];
} else if ( typeof elem.removeAttribute !== strundefined ) {
elem.removeAttribute( internalKey );
Avoid deeply nested control flow statements. Open
if ( typeof xhr.responseText === "string" ) {
responses.text = xhr.responseText;
}
Function setMatcher
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
Avoid deeply nested control flow statements. Open
if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) {
return false;
}
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 ] );
Avoid deeply nested control flow statements. Open
if ( elem.id !== match[2] ) {
return rootjQuery.find( selector );
}