Showing 258 of 421 total issues
Avoid deeply nested control flow statements. Open
if (err) {
callback('could not find old tile')
} else if (oldTiles) {
oldTiles[0].tileState = 0
oldTiles[0].save(function (err, saved) {
Avoid deeply nested control flow statements. Open
if (neighbor.h < closestNode.h || (neighbor.h === closestNode.h && neighbor.g < closestNode.g)) {
closestNode = neighbor;
}
Function saveResource
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
saveResource: function (resource) {
var playerResource = _resources[resource.id]
var npc = $game.$npc.findNpcByResourceId(resource.id)
var npcLevel = npc.getLevel()
var playerLevel = $player.getLevel()
- 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
if (err) {
callback(err)
} else {
callback()
}
Avoid deeply nested control flow statements. Open
if ((callback && callback !== ev.callback && callback !== ev.callback._callback) ||
(context && context !== ev.context)) {
retain.push(ev);
}
Function getNetworkIPs
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
getNetworkIPs: function(callback, bypassCache) {
if (cached && !bypassCache) {
callback(null, cached)
return
}
- 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
if (info.resource.questionType === 'multiple') {
npc.resource.possibleAnswers = info.resource.possibleAnswers
}
Function init
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
init: function () {
$(document).keydown(function (e) {
if ($('.appriseOverlay').is(':visible')) {
if (e.keyCode === 13) {
e.preventDefault() // This line got added
- 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 renderSkinventoryUI
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function renderSkinventoryUI () {
var playerSkin = $game.$player.getSkinSuit()
var unlocked = $game.$player.getSkinventory()
var skins = getSets()
- 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
if (_boss.items[itemId].immediate === true) _boss.activateItem(tile)
Avoid deeply nested control flow statements. Open
if (key === 'resume-experience') {
processedOrg.push(value)
} else if (key === 'resume-experience-content') {
processedSummary.push(value)
}
Consider simplifying this complex logical expression. Open
if (options.data == null && model && (method === 'create' || method === 'update' || method === 'patch')) {
params.contentType = 'application/json';
params.data = JSON.stringify(options.attrs || model.toJSON(options));
}
Function createCanvas
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
createCanvas: function (elementId, width, height, onDOM, styles) {
Function doTutorial
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
doTutorial: function () {
var tutorialState = _botanist.tutorialState
var dialogue = ''
switch (tutorialState) {
- 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 idle
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
idle: function () {
_counter += 1
if (_botanist.renderInfo.srcY === 0) {
if (_counter >= 24) {
- 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 init
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
init: function (callback) {
// Get all resources
var npcs = $game.$npc.getNpcData()
$.each(npcs, function (key, npc) {
- 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 loadTilesheets
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
loadTilesheets: function (num) {
var path = CivicSeed.CLOUD_PATH + '/img/game/'
var ext = '.png'
// load the images recursively until done
- 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 too many return
statements within this function. Open
if (aStack[length] == a) return bStack[length] == b;
Avoid too many return
statements within this function. Open
return false;
Avoid too many return
statements within this function. Open
return result;