Showing 41 of 130 total issues
Function randomizeGraphics
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
function randomizeGraphics() {
// for(data.temp.iOfRandom1 = 0; document.getElementsByClassName("path1").length > data.temp.iOfRandom1; data.temp.iOfRandom1++) {
// randomizeGraphicsSub1(document.getElementsByClassName("path1"));
// }
- 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 randomizeGraphics
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
function randomizeGraphics() {
// for(data.temp.iOfRandom1 = 0; document.getElementsByClassName("path1").length > data.temp.iOfRandom1; data.temp.iOfRandom1++) {
// randomizeGraphicsSub1(document.getElementsByClassName("path1"));
// }
Function doMove
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function doMove() {
if (data.runner.position.top <= 0) {
data.runner.cango.up = !1;
} else if (data.runner.position.top >= data.field.height - 1) {
- 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 saveState
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function saveState(name, content) {
if (content == "t") {
if (loadState(name) == 1) {
content = 0;
} else {
- 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 createRoom
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
function createRoom(x,y, type, buildTop = 1, buildRight = 1, buildBottom = 1, buildLeft = 1) {
Avoid deeply nested control flow statements. Open
} else if (level.indexOf("006") >= 0) { //Level 6 - Dungeon 1
summonElement("runner", objects.field, 100, 198);
data.runner.position.top = 198;
data.runner.position.left = 100;
Avoid deeply nested control flow statements. Open
if (pData.leveldata[data.temp.triggerKeycollect[0]].keys[data.temp.triggerKeycollect[1]] == 0) {
pData.leveldata[data.temp.triggerKeycollect[0]].keys[0]++;
}
Avoid deeply nested control flow statements. Open
if(loadState("colormode") != "1") {
summonElement("button1-1", objects.field, 4, 1);
} else {
summonElement("button1-2", objects.field, 4, 1);
}
Avoid deeply nested control flow statements. Open
} else if (level == "004-3") { // Pause menu
loadLevel("004");
} else if (level == "004-4") { // Level Selection
summonElement("textbox", objects.field, 0, 0, lang.back);
Avoid deeply nested control flow statements. Open
if (data.runner.position.top == data.enemys[data.temp.iOfEnemyTick][2] && data.runner.position.left == data.enemys[data.temp.iOfEnemyTick][1]) {
doHurt(1);
data.runner.position.top = +data.runner.oldotherposition.top;
data.runner.position.left = +data.runner.oldotherposition.left;
} else if (data.runner.position.left == data.enemys[data.temp.iOfEnemyTick][1]) { //If above or below slicer
Avoid deeply nested control flow statements. Open
if(loadState("music") != "false") {
summonElement("button1-2", objects.field, 4, 2);
} else {
summonElement("button1-1", objects.field, 4, 2);
}
Avoid deeply nested control flow statements. Open
} else if (data.enemys[data.forenemys[data.temp.iOfEnemyTick]][9] == "right") {
if (data.enemys[data.forenemys[data.temp.iOfEnemyTick]][1] < +data.enemys[data.forenemys[data.temp.iOfEnemyTick]][5] - 1) {
data.enemys[data.forenemys[data.temp.iOfEnemyTick]][1]++;
} else {
data.enemys[data.forenemys[data.temp.iOfEnemyTick]][9] = "cooldown12";
Avoid deeply nested control flow statements. Open
for (var i=0; i <= 4; i++) { // Stop player from moving
setTimeout(function () {
data.runner.cango = {};
}, data.ticktime * i);
}
Avoid deeply nested control flow statements. Open
for (data.temp.iOfLG = 1; data.temp.iOfLG < 11; data.temp.iOfLG++) {
data.walls.push("type1-8,0," + data.temp.iOfLG);
data.walls.push("type1-4,29," + data.temp.iOfLG);
}
Avoid deeply nested control flow statements. Open
for (data.temp.iOfLG = 1; data.temp.iOfLG < 29; data.temp.iOfLG++) {
data.walls.push("type1-2," + data.temp.iOfLG + ",0");
if (data.temp.iOfLG != 15) {
data.walls.push("type1-6," + data.temp.iOfLG + ",11");
}
Avoid deeply nested control flow statements. Open
if (data.walls[data.temp.iOfInit2_2][2] == data.temp.setEnemys[data.iOfInit2][2]) {
if (data.walls[data.temp.iOfInit2_2][1] > data.temp.setEnemys[data.iOfInit2][1] && data.walls[data.temp.iOfInit2_2][1] < data.temp.setEnemys[data.iOfInit2][5]) {
data.temp.setEnemys[data.iOfInit2][5] = data.walls[data.temp.iOfInit2_2][1];
}
Avoid deeply nested control flow statements. Open
if (data.enemys[data.forenemys[data.temp.iOfEnemyTick]][2] > +data.enemys[data.forenemys[data.temp.iOfEnemyTick]][4] + 1) {
data.enemys[data.forenemys[data.temp.iOfEnemyTick]][2]--;
} else {
data.enemys[data.forenemys[data.temp.iOfEnemyTick]][9] = "cooldown12";
}
Function summonElement
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function summonElement(classname, childof, x = 0, y = 0, triggerdo) {
Function summonElementKey
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function summonElementKey(classname, levelnr, keynr, x, y) { // Spawn a key
Function doTick2
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function doTick2() {
data.visibleTilesY = window.innerHeight / (10 * 9) / 2 + 3; // CSS Tile height x Zoom level + Preprocessing
data.visibleTilesX = window.innerWidth / (10 * 9) / 2 + 3; // CSS Tile height x Zoom level + Preprocessing
for (var i = 0; data.allthings.length > i; 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"