Showing 551 of 2,707 total issues
Consider simplifying this complex logical expression. Open
if ( forward && useCache ) {
// Seek `elem` from a previously-cached index
outerCache = parent[ expando ] || (parent[ expando ] = {});
cache = outerCache[ type ] || [];
nodeIndex = cache[0] === dirruns && cache[1];
File views.py
has 261 lines of code (exceeds 250 allowed). Consider refactoring. Open
import datetime
import logging
from django.conf import settings
from django.contrib.auth import authenticate, login, logout
from django.contrib.auth.models import User
Function add
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
add: function(element, interval, label, fn, times, belay) {
var counter = 0;
if (jQuery.isFunction(label)) {
if (!times)
- 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 karma_group_view
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def karma_group_view(request, id):
group = get_object_or_404(PlayerGroup, pk=id)
players = group.players.all()
if request.method == 'POST':
- 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 grandchalls_round
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def grandchalls_round(request):
""" Play a round """
# TODO: move logic to models.
""" regular round """
over = 0
- 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 artifact
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def artifact(artifact):
if not artifact:
return '(no artifact)'
if isinstance(artifact, PlayerArtifactAmount):
- 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 ajaxConvert
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
function ajaxConvert( s, response, jqXHR, isSuccess ) {
var conv2, current, conv, tmp, prev,
converters = {},
// Work with a copy of dataTypes in case we need to modify it for conversion
dataTypes = s.dataTypes.slice();
Function ajaxConvert
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
function ajaxConvert( s, response, jqXHR, isSuccess ) {
var conv2, current, conv, tmp, prev,
converters = {},
// Work with a copy of dataTypes in case we need to modify it for conversion
dataTypes = s.dataTypes.slice();
Function qpool_home
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def qpool_home(request, cat='qotd', page=u'1', tag=None):
categories = Category.objects.all()
qs = get_questions_with_category(str(cat), active_only=False,
endorsed_only=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 artifact_edit
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def artifact_edit(request, id=None):
if id is not None:
instance = get_object_or_404(Artifact, pk=id)
else:
instance = None
- 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 show
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
Tooltip.prototype.show = function () {
var e = $.Event('show.bs.' + this.type)
if (this.hasContent() && this.enabled) {
this.$element.trigger(e)
Function remove
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
remove: function( elem, types, handler, selector, mappedTypes ) {
var j, handleObj, tmp,
origCount, t, events,
special, handlers, type,
namespaces, origType,
Function remove
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
remove: function( elem, types, handler, selector, mappedTypes ) {
var j, handleObj, tmp,
origCount, t, events,
special, handlers, type,
namespaces, origType,
Consider simplifying this complex logical expression. Open
if ( ( mappedTypes || origType === handleObj.origType ) &&
( !handler || handler.guid === handleObj.guid ) &&
( !tmp || tmp.test( handleObj.namespace ) ) &&
( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) {
handlers.splice( j, 1 );
Consider simplifying this complex logical expression. Open
if ( ( mappedTypes || origType === handleObj.origType ) &&
( !handler || handler.guid === handleObj.guid ) &&
( !tmp || tmp.test( handleObj.namespace ) ) &&
( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) {
handlers.splice( j, 1 );
Function test_grading
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
def test_grading(self):
p1 = self._get_player(1)
p2 = self._get_player(2)
semig = Semigroup.objects.create(day=datetime.today().day, hour=datetime.today().hour - datetime.today().hour % 2)
semig.players.add(p1, p2)
Function slide
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
Carousel.prototype.slide = function (type, next) {
var $active = this.$element.find('.item.active')
var $next = next || $active[type]()
var isCycling = this.interval
var direction = type == 'next' ? 'left' : 'right'
Function internalRemoveData
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
function internalRemoveData( elem, name, pvt ) {
if ( !jQuery.acceptData( elem ) ) {
return;
}
Function internalRemoveData
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
function internalRemoveData( elem, name, pvt ) {
if ( !jQuery.acceptData( elem ) ) {
return;
}
Function add
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def add(question, answers, category=None, tags=None, file_tags=None):
''' question is a dict with the following keys: text, endorsed_by, answer_type
[, proposed_by, active, type, code]
answers is a list of dicts with the following keys: text, correct [, explanation]
'''
- 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"