Maingron/MainOS

View on GitHub
helper.js

Summary

Maintainability
B
5 hrs
Test Coverage

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
Severity: Minor
Found in helper.js - About 3 hrs to fix

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 spawnContextMenu has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

function spawnContextMenu(content) { // TODO: Make async
    if (document.getElementsByClassName("contextMenu")[0]) {
        document.getElementsByClassName("contextMenu")[0].outerHTML = "";
    }
    var newelement = document.createElement("div");
Severity: Minor
Found in helper.js - About 55 mins to fix

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 loadIOfsLink has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

async function loadIOfsLink(element) {
    const validPrefixes = ["iofs:", "#:", "#iofs:"];
    let usedSrcAttribute;
    let link;

Severity: Minor
Found in helper.js - About 55 mins to fix

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

TODO found
Open

    /* TODO:
Severity: Minor
Found in helper.js by fixme

TODO found
Open

// TODO: Find a better way maybe?
Severity: Minor
Found in helper.js by fixme

TODO found
Open

            // TODO: Add System setting for default runs and max runs
Severity: Minor
Found in helper.js by fixme

TODO found
Open

function spawnContextMenu(content) { // TODO: Make async
Severity: Minor
Found in helper.js by fixme

TODO found
Open

    // TODO: Deprecate setting. Use system.user.settings instead.
Severity: Minor
Found in helper.js by fixme

There are no issues that match your filters.

Category
Status