shawkinsl/mtga-tracker

View on GitHub

Showing 468 of 468 total issues

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

         deck.forEach(cardObj => {
           if (typeof cardObj == "number" || typeof cardObj == "string") {
             let card = cardUtils.allCards.findCard(cardID)
             result += `1 ${card.get("prettyName")} (${card.get("set")}) ${card.get("setNumber")}` + "\n"
           } else if (cardObj.count) {
Severity: Major
Found in electron/inspector/js/main.js and 1 other location - About 6 hrs to fix
electron/inspector/js/main.js on lines 216..223

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

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

         sideboard.forEach(cardObj => {
           if (typeof cardObj == "number" || typeof cardObj == "string") {
             let card = cardUtils.allCards.findCard(cardID)
             result += `1 ${card.get("prettyName")} (${card.get("set")}) ${card.get("setNumber")}` + "\n"
           } else if (cardObj.count) {
Severity: Major
Found in electron/inspector/js/main.js and 1 other location - About 6 hrs to fix
electron/inspector/js/main.js on lines 205..212

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

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

File collectionRenderer.js has 446 lines of code (exceeds 250 allowed). Consider refactoring.
Open


const { remote, ipcRenderer, shell } = require('electron')
const {dialog, Menu, MenuItem,} = remote
const fs = require('fs')

Severity: Minor
Found in electron/collectionRenderer.js - About 6 hrs to fix

    File main.js has 433 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    const { API_URL } = require("./js/api")
    const { pagePrefix } = require("./js/conf")
    const toastr = require("toastr")
    window.toastr = toastr
    
    
    Severity: Minor
    Found in electron/inspector/js/main.js - About 6 hrs to fix

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

      api.get("deck/:deckID/unhide", (req, res) => {
        const { deckID } = req.params;
        console.log("searching for deckid " + deckID)
        db.deck.findOne({ deckID: deckID}, (err, result) => {
          if (err) throw new Error(err);
      Severity: Major
      Found in electron/inspectorApi.js and 1 other location - About 6 hrs to fix
      electron/inspectorApi.js on lines 377..391

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

      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

      api.get("deck/:deckID/hide", (req, res) => {
        const { deckID } = req.params;
        console.log("searching for deckid " + deckID)
        db.deck.findOne({ deckID: deckID}, (err, result) => {
          if (err) throw new Error(err);
      Severity: Major
      Found in electron/inspectorApi.js and 1 other location - About 6 hrs to fix
      electron/inspectorApi.js on lines 393..406

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

      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

                  if card.mtga_id not in odds.keys():
                      odds[card.mtga_id] = {
                          "card": card.pretty_name,
                          "iid": None,
                          "colors": card.colors,
      Severity: Major
      Found in app/models/game.py and 1 other location - About 5 hrs to fix
      app/models/game.py on lines 111..124

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

      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

                  if card.mtga_id not in original_deck_odds.keys():
                      original_deck_odds[card.mtga_id] = {
                          "card": card.pretty_name,
                          "iid": None,
                          "colors": card.colors,
      Severity: Major
      Found in app/models/game.py and 1 other location - About 5 hrs to fix
      app/models/game.py on lines 131..144

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

      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

      Function gameRoute has 128 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      let gameRoute = (c, n) => {
        console.log("CALLED FROM /game/")
        appData.currentGameWinner = "loading ..."
        appData.currentGameName = ""
        appData.currentGameHero = ""
      Severity: Major
      Found in electron/inspector/js/game.js - About 5 hrs to fix

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

        rivets.binders.showcollectionpane = (el, val) => {
          el.style.display = "none"
          if (el.attributes.value.value == val) {
            el.style.display = "block"
            $(el).find(".toggle").each(function(idx, e) {e.style.width="65px"; e.style.height="40px";})  // bad dumb hack for buttons
        Severity: Major
        Found in electron/collectionRenderer.js and 1 other location - About 5 hrs to fix
        electron/settingsRenderer.js on lines 206..212

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

        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

        rivets.binders.showsettingspane = (el, val) => {
          el.style.display = "none"
          if (el.attributes.value.value == val) {
            el.style.display = "block"
            $(el).find(".toggle").each(function(idx, e) {e.style.width="65px"; e.style.height="40px";})  // bad dumb hack for buttons
        Severity: Major
        Found in electron/settingsRenderer.js and 1 other location - About 5 hrs to fix
        electron/collectionRenderer.js on lines 152..158

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

        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 enableDarkModeBarChart = (chart) => {
            if (chart) {
                chart.options.title.fontColor = "#dedede"
                chart.options.legend.labels.fontColor = "#dedede"
                chart.data.datasets.forEach(dataset => dataset.borderColor = "#333")
        Severity: Major
        Found in electron/inspector/js/main.js and 1 other location - About 4 hrs to fix
        electron/inspector/js/main.js on lines 138..146

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

        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 disableDarkModeBarChart = (chart) => {
            if (chart) {
                chart.options.title.fontColor = "#474747"
                chart.options.legend.labels.fontColor = "#474747"
                chart.data.datasets.forEach(dataset => dataset.borderColor = "#eee")
        Severity: Major
        Found in electron/inspector/js/main.js and 1 other location - About 4 hrs to fix
        electron/inspector/js/main.js on lines 148..156

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

        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

        File lightbox.js has 372 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        /*!
         * Lightbox v2.10.0
         * by Lokesh Dhakar
         *
         * More info:
        Severity: Minor
        Found in docs/lib/lightbox/src/js/lightbox.js - About 4 hrs to fix

          File lightbox.js has 372 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          /*!
           * Lightbox v2.10.0
           * by Lokesh Dhakar
           *
           * More info:
          Severity: Minor
          Found in docs/lib/lightbox/dist/js/lightbox.js - About 4 hrs to fix

            Function defaultPrefilter has 122 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function defaultPrefilter( elem, props, opts ) {
                var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
                    isBox = "width" in props || "height" in props,
                    anim = this,
                    orig = {},
            Severity: Major
            Found in docs/lib/lightbox/dist/js/lightbox-plus-jquery.js - About 4 hrs to fix

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

              jQuery.Callbacks = function( options ) {
              
                  // Convert options from String-formatted to Object-formatted if needed
                  // (we check in cache first)
                  options = typeof options === "string" ?
              Severity: Major
              Found in docs/lib/lightbox/dist/js/lightbox-plus-jquery.js - About 4 hrs to fix

                Function json_blob_reader_task has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
                Open

                def json_blob_reader_task(in_queue, out_queue):
                
                    def check_for_client_id(blob):
                        if "authenticateResponse" in blob:
                            if "clientId" in blob["authenticateResponse"]:
                Severity: Minor
                Found in app/tasks.py - 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

                Severity
                Category
                Status
                Source
                Language