Idrinth/IDotD

View on GitHub
src/mods/ui.js

Summary

Maintainability
F
3 wks
Test Coverage

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

  start: function() {
    /**
         * builds most of the gui
         * @returns {undefined}
         */
Severity: Major
Found in src/mods/ui.js - About 3 days to fix

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

    let build = function() {
      /**
             *
             * @returns {Array}
             */
Severity: Major
Found in src/mods/ui.js - About 3 days to fix

Function wrapper has 704 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      let wrapper = function() {
        /**
                 * creates the action tab
                 * @returns {Array}
                 */
Severity: Major
Found in src/mods/ui.js - About 3 days to fix

File ui.js has 1169 lines of code (exceeds 250 allowed). Consider refactoring.
Open

idrinth.ui = {
  /**
     *
     * @type HTMLElement
     */
Severity: Major
Found in src/mods/ui.js - About 3 days to fix

Function start has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring.
Open

  start: function() {
    /**
         * builds most of the gui
         * @returns {undefined}
         */
Severity: Minor
Found in src/mods/ui.js - About 1 day 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 buildControls has 222 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        let buildControls = function() {
          /**
                     *
                     * @param {Array} list
                     * @param {String} header
Severity: Major
Found in src/mods/ui.js - About 1 day to fix

Function buildElement has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring.
Open

  buildElement: function(config) {
    /**
         *
         * @param {HTMLElement} el
         * @param {object} config
Severity: Minor
Found in src/mods/ui.js - About 7 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 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 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 buildActions has 76 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

Function buildChat has 74 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  buildChat: function(id, name, rank, pass) {
    if (!idrinth.chat.elements.chats) {
      idrinth.core.timeouts.add(
        "chat-" + id,
        function() {
Severity: Major
Found in src/mods/ui.js - About 2 hrs to fix

Function makeInputLabel has 64 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    let makeInputLabel = function(config) {
      /**
             *
             * @param {String|Number} value
             * @param {Array} list
Severity: Major
Found in src/mods/ui.js - About 2 hrs to fix

Function buildRaidJoinList has 60 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        let buildRaidJoinList = function() {
          /**
                     *
                     * @param {Array} list
                     * @param {String} header
Severity: Major
Found in src/mods/ui.js - About 2 hrs to fix

Function buildModal has 57 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  buildModal: function(title, content, altFunc) {
    let mod = {
      children: [],
      css: "idrinth-hovering-box idrinth-popup idrinth-" +
        (typeof altFunc === "string" ? "confim" : "alert")
Severity: Major
Found in src/mods/ui.js - About 2 hrs to fix

Function makeTabs has 55 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        let makeTabs = function(config) {
          let head = [];
          let first = true;
          let body = [];
          /**
Severity: Major
Found in src/mods/ui.js - About 2 hrs to fix

Function buildItem has 44 lines of code (exceeds 25 allowed). Consider refactoring.
Open

          let buildItem = function(label) {
            let isCheck =
              label === "mirele" || label === "kraken" || label === "utym";
            return {
              type: "tr",
Severity: Minor
Found in src/mods/ui.js - About 1 hr to fix

Function buildItem has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

          let buildItem = function(label) {
            return {
              type: "tr",
              children: [
                {
Severity: Minor
Found in src/mods/ui.js - About 1 hr to fix

Function buildTiers has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        let buildTiers = function() {
          /**
                     *
                     * @param {string} label
                     * @returns {object}
Severity: Minor
Found in src/mods/ui.js - About 1 hr to fix

Function updateClassesList has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  updateClassesList: function(element, add, remove) {
    /**
         *
         * @param {String} classString
         * @param {Array|String} add
Severity: Minor
Found in src/mods/ui.js - About 1 hr 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 updateClassesList has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  updateClassesList: function(element, add, remove) {
    /**
         *
         * @param {String} classString
         * @param {Array|String} add
Severity: Minor
Found in src/mods/ui.js - About 1 hr to fix

Function buildModal has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  buildModal: function(title, content, altFunc) {
    let mod = {
      children: [],
      css: "idrinth-hovering-box idrinth-popup idrinth-" +
        (typeof altFunc === "string" ? "confim" : "alert")
Severity: Minor
Found in src/mods/ui.js - About 45 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 childOf has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  childOf: function(element, cssClass) {
    do {
      if (
        element.className &&
        element.className.match(new RegExp("(^|\s)" + cssClass + "(\s|$)"))
Severity: Minor
Found in src/mods/ui.js - About 25 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

Similar blocks of code found in 2 locations. Consider refactoring.
Open

                    {
                      type: "td",
                      children: [
                        {
                          type: "button",
Severity: Major
Found in src/mods/ui.js and 1 other location - About 1 hr to fix
src/mods/ui.js on lines 1040..1058

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 67.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

                    {
                      type: "td",
                      children: [
                        {
                          type: "button",
Severity: Major
Found in src/mods/ui.js and 1 other location - About 1 hr to fix
src/mods/ui.js on lines 1159..1177

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 67.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

          let wrap = function(list, header) {
            return {
              children: [
                {
                  type: "strong",
Severity: Major
Found in src/mods/ui.js and 1 other location - About 1 hr to fix
src/mods/ui.js on lines 705..718

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 63.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

          let wrap = function(list, header) {
            return {
              children: [
                {
                  type: "strong",
Severity: Major
Found in src/mods/ui.js and 1 other location - About 1 hr to fix
src/mods/ui.js on lines 1271..1284

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 63.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

                {
                  content: idrinth.text.get("raids.disable.all"),
                  type: "button",
                  attributes: [
                    {
Severity: Minor
Found in src/mods/ui.js and 1 other location - About 55 mins to fix
src/mods/ui.js on lines 1296..1309

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 54.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

                {
                  content: idrinth.text.get("raids.disable.none"),
                  type: "button",
                  attributes: [
                    {
Severity: Minor
Found in src/mods/ui.js and 1 other location - About 55 mins to fix
src/mods/ui.js on lines 1310..1323

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 54.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

There are no issues that match your filters.

Category
Status