shawkinsl/mtga-tracker

View on GitHub
electron/inspector/js/api.js

Summary

Maintainability
F
5 days
Test Coverage

File api.js has 338 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* FETCH EXAMPLE
    let fetchURL = `insp://my-cool/endpoint`
    fetch(fetchURL)
      .then(resp => resp.json())
      .then(data => {
Severity: Minor
Found in electron/inspector/js/api.js - About 4 hrs to fix

    Function getGames has 47 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    var getGames = function(page, opts) {
      console.log("getting games... " + JSON.stringify(opts))
      $("#more-games-button").removeClass("btn-info").addClass("btn-primary").val("Loading games...").prop('disabled', true)
      appData.homeGameListPage += 1;
      if (page === undefined) page = 1;
    Severity: Minor
    Found in electron/inspector/js/api.js - About 1 hr to fix

      Function getDeckWinLossByColor has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      var getDeckWinLossByColor = function(deckID) {
        return new Promise((resolve, reject) => {
          if (appData.winLossColorChart) {
            for (idx = 0; idx < 5; idx++) {
              appData.winLossColorChart.data.datasets[0].data[idx] = 0
      Severity: Minor
      Found in electron/inspector/js/api.js - About 1 hr to fix

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

        var hideDeck = function(deckID, button) {
          if (button) {
            $(button).prop('disabled', true);
          }
          console.log("hideDeck called")
        Severity: Minor
        Found in electron/inspector/js/api.js - About 1 hr to fix

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

          var unHideDeck = function(deckID, button) {
            if (button) {
              $(button).prop('disabled', true);
            }
            console.log("unhideDeck called")
          Severity: Minor
          Found in electron/inspector/js/api.js - About 1 hr to fix

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

            var unHideDeck = function(deckID, button) {
              if (button) {
                $(button).prop('disabled', true);
              }
              console.log("unhideDeck called")
            Severity: Major
            Found in electron/inspector/js/api.js and 1 other location - About 1 day to fix
            electron/inspector/js/api.js on lines 270..297

            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 251.

            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

            var hideDeck = function(deckID, button) {
              if (button) {
                $(button).prop('disabled', true);
              }
              console.log("hideDeck called")
            Severity: Major
            Found in electron/inspector/js/api.js and 1 other location - About 1 day to fix
            electron/inspector/js/api.js on lines 299..326

            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 251.

            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

                fetch(`insp://draft/${draftID}`)
                  .then(resp => resp.json())
                  .then(data => {
                    $(".draft-loading").css("display", "none")
                    $(".export-button").prop('disabled', false);
            Severity: Major
            Found in electron/inspector/js/api.js and 1 other location - About 5 hrs to fix
            electron/inspector/js/api.js on lines 24..36

            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 143.

            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

                fetch(`insp://game/${gameID}`)
                  .then(resp => resp.json())
                  .then(data => {
                    $(".game-loading").css("display", "none")
                    $(".export-button").prop('disabled', false);
            Severity: Major
            Found in electron/inspector/js/api.js and 1 other location - About 5 hrs to fix
            electron/inspector/js/api.js on lines 43..55

            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 143.

            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 heroColors = cardUtils.cardsColors(Object.keys(val.players[0].deck.cards).map(x => parseInt(x, 10)))
            Severity: Major
            Found in electron/inspector/js/api.js and 1 other location - About 1 hr to fix
            electron/inspector/js/api.js on lines 359..359

            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 56.

            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 opponentColors = cardUtils.cardsColors(Object.keys(val.players[1].deck.cards).map(x => parseInt(x, 10)))
            Severity: Major
            Found in electron/inspector/js/api.js and 1 other location - About 1 hr to fix
            electron/inspector/js/api.js on lines 358..358

            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 56.

            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 4 locations. Consider refactoring.
            Open

                fetch(fetchURL)
                  .then(resp => resp.json())
                  .then(data => {
                    $("#overall-wl-loading").css("display", "none")
                    appData.overallWinLoss = [
            Severity: Major
            Found in electron/inspector/js/api.js and 3 other locations - About 40 mins to fix
            electron/inspector/js/api.js on lines 71..89
            electron/inspector/js/api.js on lines 99..111
            electron/inspector/js/api.js on lines 182..194

            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 49.

            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 4 locations. Consider refactoring.
            Open

                fetch(fetchURL)
                  .then(resp => resp.json())
                  .then(data => {
                    $("#overall-wl-by-event-loading").css("display", "none")
                    appData.overallWinLossByEvent = data.eventCounts
            Severity: Major
            Found in electron/inspector/js/api.js and 3 other locations - About 40 mins to fix
            electron/inspector/js/api.js on lines 71..89
            electron/inspector/js/api.js on lines 99..111
            electron/inspector/js/api.js on lines 150..166

            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 49.

            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 4 locations. Consider refactoring.
            Open

                fetch(fetchURL)
                  .then(resp => resp.json())
                  .then(data => {
                    $("#matchup-loading").css("display", "none")
                    appData.winLossColors = [
            Severity: Major
            Found in electron/inspector/js/api.js and 3 other locations - About 40 mins to fix
            electron/inspector/js/api.js on lines 99..111
            electron/inspector/js/api.js on lines 150..166
            electron/inspector/js/api.js on lines 182..194

            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 49.

            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 4 locations. Consider refactoring.
            Open

                fetch(fetchURL)
                  .then(resp => resp.json())
                  .then(data => {
                    $("#event-usage-loading").css("display", "none")
                    appData.playerEventHistoryData = data
            Severity: Major
            Found in electron/inspector/js/api.js and 3 other locations - About 40 mins to fix
            electron/inspector/js/api.js on lines 71..89
            electron/inspector/js/api.js on lines 150..166
            electron/inspector/js/api.js on lines 182..194

            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 49.

            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