Idrinth/IDotD

View on GitHub
src/mods/core.js

Summary

Maintainability
D
2 days
Test Coverage

Function run has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
Open

    run: function(url, success, failure, timeout, additionalHeader) {
      if(!idrinth.start && idrinth.settings.get("server")) {
          return;
      }
      let requestHandler = new XMLHttpRequest();
Severity: Minor
Found in src/mods/core.js - About 4 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

File core.js has 295 lines of code (exceeds 250 allowed). Consider refactoring.
Open

idrinth.core = {
  /**
     *
     * @param {string} str
     * @returns {string}
Severity: Minor
Found in src/mods/core.js - About 3 hrs to fix

Function process has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

    process: function() {
      let date = new Date().getTime() + new Date().getMilliseconds() / 1000;
      let min = 10;
      /**
             *
Severity: Minor
Found in src/mods/core.js - About 2 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 run has 59 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    run: function(url, success, failure, timeout, additionalHeader) {
      if(!idrinth.start && idrinth.settings.get("server")) {
          return;
      }
      let requestHandler = new XMLHttpRequest();
Severity: Major
Found in src/mods/core.js - About 2 hrs to fix

Function triggered has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    triggered: function(event) {
      /**
             *
             * @param {HTMLElement} el
             * @param {string} event
Severity: Minor
Found in src/mods/core.js - About 2 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 process has 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    process: function() {
      let date = new Date().getTime() + new Date().getMilliseconds() / 1000;
      let min = 10;
      /**
             *
Severity: Minor
Found in src/mods/core.js - About 1 hr to fix

Function triggered has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    triggered: function(event) {
      /**
             *
             * @param {HTMLElement} el
             * @param {string} event
Severity: Minor
Found in src/mods/core.js - About 1 hr to fix

Function check has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      let check = function(min, property, date) {
        /**
                 *
                 * @param {Number} durationLeft
                 * @param {string} minDuration
Severity: Minor
Found in src/mods/core.js - About 1 hr to fix

Function onreadystatechange has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      requestHandler.onreadystatechange = function(event) {
        let request = (event || window.event).target;
        let call = function(func, value) {
          if (typeof func !== "function") {
            return;
Severity: Minor
Found in src/mods/core.js - About 1 hr to fix

Function runHome has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

      url,
      success,
      failure,
      timeout,
      additionalHeader,
Severity: Minor
Found in src/mods/core.js - About 45 mins to fix

Function run has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    run: function(url, success, failure, timeout, additionalHeader) {
Severity: Minor
Found in src/mods/core.js - About 35 mins to fix

There are no issues that match your filters.

Category
Status