Idrinth/IDotD

View on GitHub

Showing 162 of 178 total issues

Function updateData has 189 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    let updateData = function(data) {
      /**
             *
             * @param {object} data
             * @returns {undefined}
Severity: Major
Found in src/mods/war.js - About 7 hrs to fix

Function process has 185 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      let process = function(data) {
        /**
                 *
                 * @param {Boolean} onOff
                 * @returns {undefined}
Severity: Major
Found in src/mods/war.js - About 7 hrs to fix

Function start has 185 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  start: function() {
    /**
         * creates the tooltip-element
         * @returns {undefined}
         */
Severity: Major
Found in src/mods/names.js - About 7 hrs to fix

Function handle has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
Open

  handle: function(mutations, isPrivate) {
    /**
         *
         * @param {HTMLElement} element
         * @returns {undefined}
Severity: Minor
Found in src/mods/observer.js - About 6 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 addMessages has 159 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        let addMessages = function(chatMessages, chatId, chatElement) {
          /**
                     * 
                     * @param {String} message
                     * @param {HTMLElement} chat
Severity: Major
Found in src/mods/chat.js - About 6 hrs to fix

Function calculate has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
Open

  calculate: function() {
    /**
         *
         * @param {function[]} checkElementFunc
         * @returns {object}
Severity: Minor
Found in src/mods/land.js - About 5 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 processJson has 146 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        let processJson = function(data) {
          let magicIgmSrv =
            "https://dotd.idrinth.de/static/magic-image-service/";
          /**
                     *
Severity: Major
Found in src/mods/war.js - About 5 hrs to fix

Function buildMessage has 136 lines of code (exceeds 25 allowed). Consider refactoring.
Open

          let buildMessage = function(message, chat, chatId, messageId) {
            /**
                         * 
                         * @returns {String}
                         */
Severity: Major
Found in src/mods/chat.js - About 5 hrs to fix

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

Function buildLand has 121 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        let buildLand = function() {
          /**
                     *
                     * @param {string} label
                     * @returns {object}
Severity: Major
Found in src/mods/ui.js - About 4 hrs to fix

Function userclick has 121 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  userclick: function(element, user, chat) {
    if (
      !idrinth.chat.chatRank[chat][idrinth.chat.self] ||
      parseInt(user, 10) === parseInt(idrinth.chat.self, 10)
    ) {
Severity: Major
Found in src/mods/chat.js - About 4 hrs to fix

Function process has 120 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    process: function() {
      /**
             * 
             * @returns {Boolean}
             */
Severity: Major
Found in src/mods/raids.js - About 4 hrs to fix

Function buildElement has 117 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  buildElement: function(config) {
    /**
         *
         * @param {HTMLElement} el
         * @param {object} config
Severity: Major
Found in src/mods/ui.js - About 4 hrs to fix

Function build has 116 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    let build = function() {
      /**
             *
             * @param {string} name
             * @returns {Array}
Severity: Major
Found in src/mods/names.js - About 4 hrs to fix

Function tiers has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

     tiers: function(list) {
      /**
             *
             * @param {HTMLElement} elem
             * @returns {undefined}
Severity: Minor
Found in src/mods/workers.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

Function calculate has 112 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  calculate: function() {
    /**
         *
         * @param {function[]} checkElementFunc
         * @returns {object}
Severity: Major
Found in src/mods/land.js - About 4 hrs to fix

Function buildStats has 108 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        let buildStats = function() {
          /**
                     *
                     * @param {string} label
                     * @returns {object}
Severity: Major
Found in src/mods/ui.js - About 4 hrs to fix

Function userclick has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

  userclick: function(element, user, chat) {
    if (
      !idrinth.chat.chatRank[chat][idrinth.chat.self] ||
      parseInt(user, 10) === parseInt(idrinth.chat.self, 10)
    ) {
Severity: Minor
Found in src/mods/chat.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

File raids.js has 326 lines of code (exceeds 250 allowed). Consider refactoring.
Open

idrinth.raids = {
  /**
     * @type Object
     */
  list: {},
Severity: Minor
Found in src/mods/raids.js - About 3 hrs to fix

Function replaceInText has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

  replaceInText: function(message, regex, callbacks, lastField) {
    /**
         * 
         * @param {String} message
         * @param {RegExp} regex
Severity: Minor
Found in src/mods/chat.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

Severity
Category
Status
Source
Language