Showing 171 of 193 total issues
Function splitQuery
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
function splitQuery(query) {
var result = [];
var start = -1;
for (var i = 0; i < query.length; i++) {
if (splitChars[query.charCodeAt(i)]) {
- 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 setMatcher
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
Avoid deeply nested control flow statements. Open
Open
} else if ( match[ 2 ] ) {
push.apply( results, context.getElementsByTagName( selector ) );
return results;
// Class selector
Avoid deeply nested control flow statements. Open
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
Open
if ( ( elem = matcherOut[ i ] ) ) {
// Restore matcherIn since elem is not yet a final match
temp.push( ( matcherIn[ i ] = elem ) );
}
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def __init__(self, service_urls=None, user_agent=DEFAULT_USER_AGENT,
Function legacy_format_json
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def legacy_format_json(original):
# save state
states = []
text = original
- 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
Avoid deeply nested control flow statements. Open
Open
if isinstance(node.value, ast.Num):
keys[name] = node.value.n
# the value can sometimes be negative
elif isinstance(node.value, ast.UnaryOp) and \
isinstance(node.value.op, ast.USub): # pragma: nocover
Consider simplifying this complex logical expression. Open
Open
if (terms[excluded[i]] == file ||
titleterms[excluded[i]] == file ||
$u.contains(terms[excluded[i]] || [], file) ||
$u.contains(titleterms[excluded[i]] || [], file)) {
valid = false;
Consider simplifying this complex logical expression. Open
Open
if ( tokens.length > 2 && ( token = tokens[ 0 ] ).type === "ID" &&
context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[ 1 ].type ] ) {
context = ( Expr.find[ "ID" ]( token.matches[ 0 ]
.replace( runescape, funescape ), context ) || [] )[ 0 ];
Consider simplifying this complex logical expression. Open
Open
if ( matcher[ expando ] ) {
// Find the next relative operator (if any) for proper handling
j = ++i;
for ( ; j < len; j++ ) {
Consider simplifying this complex logical expression. Open
Open
if ( support.qsa &&
!nonnativeSelectorCache[ selector + " " ] &&
( !rbuggyQSA || !rbuggyQSA.test( selector ) ) &&
// Support: IE 8 only
Consider simplifying this complex logical expression. Open
Open
if ( !support.focusin ) {
jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
// Attach a single capturing handler on the document while someone wants focusin/focusout
var handler = function( event ) {
Function add
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
add: function( elem, types, handler, data, selector ) {
Function remove
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
remove: function( elem, types, handler, selector, mappedTypes ) {
Function CHILD
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
"CHILD": function( type, what, _argument, first, last ) {
Function superMatcher
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
superMatcher = function( seed, context, xml, results, outermost ) {
Function buildFragment
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function buildFragment( elems, context, scripts, selection, ignored ) {
Function condense
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function condense( unmatched, map, filter, context, xml ) {
Function Tween
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function Tween( elem, options, prop, end, easing ) {