Showing 61 of 2,723 total issues
File functions-programs.js
has 477 lines of code (exceeds 250 allowed). Consider refactoring. Open
function getProcessList() {
return(processList);
}
function newProcessListEntry(programIdentifier) {
Function listdir
has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring. Open
function listdir(path, listChildren = false) { // List directory // Todo!: add depth parameter
console.warn("IOFS1: listdir(", path , ")");
if(path.slice(-1) != "/") { // Check for trailing slash and add one if not found
path += "/";
- 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 runcmd
has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring. Open
function runcmd(which) {
if (which.indexOf("md:") != 1) {
return "error";
}
- 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 run
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
function run(which, iattr, how) { // Run a program
let myPid = newProcessListEntry(which);
let myProgram = system.user.programs[which];
if(!checkMayStillOpen(which)) {
processList[myPid] = null;
- 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 loadProgramMetadata
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
function loadProgramMetadata(which) { // Load program metadata from program file and handle some other stuff
if(typeof(which) == "string") {
which = system.user.programs[which];
}
- 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 applyFileAttributesToAll
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
function applyFileAttributesToAll() {
for(fileElement of document.getElementById("content_files").children) {
// if file name starts with ., add class hidden
if(fileElement.innerText.startsWith(".")) {
fileElement.classList.add("fattr-hidden");
- 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
File iofs.js
has 315 lines of code (exceeds 250 allowed). Consider refactoring. Open
var mainos = {
versionnr: 190,
versionlt: "0CC",
serverpath: "https://maingron.com",
serverroot: "https://maingron.com/projects/MainOS/server",
Function applySettingsToCategory
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
function applySettingsToCategory(categoryName) {
var category = settings.find(category => category.id == categoryName);
for(setting of category.settings) {
var settingElement = document.createElement("div");
settingElement.className = "setting";
- 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 random
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
function random(min, max, decimals, runs) { // Deprecated
// Todo: Fix following limits:
// min has to be at least 0 (no negative possible)
// limited to digits of Math.random(), other digits will be 0
// runs only runs Math.random() a defined amount of times before the final result is generated and returned. Instead previous values should be used as some sort of seed to improve randomisation
- 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
File scripts.js
has 276 lines of code (exceeds 250 allowed). Consider refactoring. Open
var objects = {};
var register = [];
var program = {};
var processList = pid = [];
Function onload
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
window.onload = function(){
// Check Disk size
if (localStorage && !localStorage.getItem('size')) {
let i = 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 render
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
async function render() {
if(canvas.mousedown == 1) {
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
Function listdir
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
listdir: function(path, recurseDepth = 0) {
path = this.sanitizePath(path);
if(path == "/") {
path = "";
}
- 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 Taskbar
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
function Taskbar() {
this.htmlElement = document.getElementById("taskbar");
this.tasklist = document.getElementById("tasklist");
- 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 delete
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
delete: function(path, recursive = false) {
path = this.sanitizePath(path);
if(!this.exists(path)) {
return 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 explorerdo
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
function explorerdo(path, action = "default") { // Shows directory or does stuff asigned to files / file types
if(path == "..") { // If want to go up a directory
path = iofs.getPath(currentPath);
if(currentPath.slice(-2) == ":/") { // Make sure to be able to display rootdir again
- 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 savefilefromurl
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
function savefilefromurl(path, url, override, fileAttributes) {
openAsyncFiles.push(path);
reportOpenAsyncFiles();
var xhr = new XMLHttpRequest();
xhr.open("GET", url, true);
- 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 doThisOnMouseMove
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
async function doThisOnMouseMove(e) {
let boundingClientRect = canvas.getBoundingClientRect()
let color = document.getElementById("color").value;
ctx.mouseX = +((e.clientX - boundingClientRect.left) * (canvas.width / boundingClientRect.width)).toFixed(0);
ctx.mouseY = +((e.clientY - boundingClientRect.top) * (canvas.height / boundingClientRect.height)).toFixed(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 savedir
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function savedir(path, createParentStructure = true, attributes = "t=d") {
console.warn("IOFS1: savedir(", path, createParentStructure, attributes , ")");
if(path.charAt(path.length - 1) != "/") {
path += "/"; // Append trailing slash, if there is 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 savefile
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function savefile(path, content, override, attr) {
console.warn("IOFS1: savefile(", path, content, override, attr , ")");
if (!attr || attr.includes("d=") == false) {
var mySaveDate = new Date();
- 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"