NatoBoram/eldarya-enhancements

View on GitHub

Showing 2,279 of 2,279 total issues

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

export function loadCarousel(): void {
  const carouselInner = document.querySelector("#carousel-inner")
  if (!carouselInner || document.querySelector(".carousel-ee")) {
    return
  }
Severity: Minor
Found in src/ui/carousel.ts - About 1 hr to fix

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

    function save(mallEntry: MallEntry): boolean {
      const price = Number(
        document.querySelector<HTMLInputElement>(".flavr-prompt")?.value.trim()
      )
      if (!price || price <= 0) {
    Severity: Minor
    Found in src/ui/mall.ts - About 1 hr to fix

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

          purchase.querySelector(".delete-button")?.addEventListener("click", () => {
            LocalStorage.purchases = LocalStorage.purchases.filter(
              purchase => purchase.itemid !== itemid
            )
      
      
      Severity: Major
      Found in src/ui/auctions.ts and 1 other location - About 1 hr to fix
      src/ui/auctions.ts on lines 65..69

      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

          sale.querySelector(".delete-button")?.addEventListener("click", () => {
            LocalStorage.sales = LocalStorage.sales.filter(sale => sale.icon !== icon)
      
            loadHistory(marketplaceActiveAuctions)
          })
      Severity: Major
      Found in src/ui/auctions.ts and 1 other location - About 1 hr to fix
      src/ui/auctions.ts on lines 52..58

      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

          void $.post(`/player/openCategory/${category}`, (view: string): void => {
            $(view).hide().appendTo("#appearance-items")
            resolve(
              document.querySelector<HTMLDivElement>(
                `#appearance-items-category-${category}`
      Severity: Major
      Found in src/appearance/favourites_actions.ts and 1 other location - About 1 hr to fix
      src/appearance/favourites_actions.ts on lines 63..70

      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

            (view: string): void => {
              $(view).hide().appendTo("#appearance-items")
              resolve(
                document.querySelector<HTMLDivElement>(
                  `#appearance-items-group-${group}`
      Severity: Major
      Found in src/appearance/favourites_actions.ts and 1 other location - About 1 hr to fix
      src/appearance/favourites_actions.ts on lines 84..91

      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

      Function waitExploration has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

        private async waitExploration(
          selected?: AutoExploreLocation
        ): Promise<boolean> {
          document
            .querySelector<HTMLDivElement>(
      Severity: Minor
      Found in src/takeover/classes/exploration_action.ts - 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

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

        static debug(message: string, ...optionalParams: unknown[]): void {
          if (!this.debugging) return
          this.console.debug(...this.format(message), ...optionalParams)
        }
      Severity: Major
      Found in src/console.ts and 2 other locations - About 1 hr to fix
      src/console.ts on lines 34..37
      src/console.ts on lines 39..42

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

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

        static info(message: string, ...optionalParams: unknown[]): void {
          if (!this.debugging) return
          this.console.info(...this.format(message), ...optionalParams)
        }
      Severity: Major
      Found in src/console.ts and 2 other locations - About 1 hr to fix
      src/console.ts on lines 25..28
      src/console.ts on lines 39..42

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

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

        static log(message: string, ...optionalParams: unknown[]): void {
          if (!this.debugging) return
          this.console.log(...this.format(message), ...optionalParams)
        }
      Severity: Major
      Found in src/console.ts and 2 other locations - About 1 hr to fix
      src/console.ts on lines 25..28
      src/console.ts on lines 34..37

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

      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 save has 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function save(marketEntry: MarketEntry): boolean {
        const price = Number(
          document.querySelector<HTMLInputElement>(".flavr-prompt")?.value.trim()
        )
        if (!price || price <= 0) {
      Severity: Minor
      Found in src/ui/market.ts - About 1 hr to fix

        Function changePrice has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        async function changePrice(icon: string): Promise<void> {
          const template: Template = require("../templates/html/change_price_flavr.html")
        
          const wishlist = LocalStorage.wishlist
          const index = wishlist.findIndex(item => item.icon === icon)
        Severity: Minor
        Found in src/ui/wishlist.ts - About 1 hr to fix

          Function loadFakeFavourites has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export async function loadFakeFavourites(): Promise<void> {
            const appearanceItems = document.querySelector("#appearance-items")
            if (!appearanceItems) {
              Console.error("Couldn't access #appearance-items", appearanceItems)
              return
          Severity: Minor
          Found in src/ui/favourites.ts - About 1 hr to fix

            Function getItemDetails has 33 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export function getItemDetails(li: HTMLLIElement): MarketEntry | null {
              const dataset = li.dataset as unknown as MarketEntryDataSet
              const name = li.querySelector<HTMLDivElement>(".abstract-name")?.innerText
              const abstractType =
                li.querySelector<HTMLDivElement>(".abstract-type")?.innerText
            Severity: Minor
            Found in src/marketplace/marketplace_handlers.ts - About 1 hr to fix

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

              export const carouselDownloadFace: CarouselNews = {
                backgroundImage:
                  "https://gitlab.com/NatoBoram/eldarya-enhancements/-/raw/master/images/carousel_download_face.png",
                id: "carousel-download-face",
                h4: translate.carousel.download_face.title,
              Severity: Major
              Found in src/carousel/carousel_download_face.ts and 2 other locations - About 1 hr to fix
              src/carousel/carousel_download_guardian.ts on lines 4..10
              src/carousel/carousel_takeover.ts on lines 4..10

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

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

              export const carouselDownloadGuardian: CarouselNews = {
                backgroundImage:
                  "https://gitlab.com/NatoBoram/eldarya-enhancements/-/raw/master/images/carousel_download_guardian.png",
                id: "carousel-download-guardian",
                h4: translate.carousel.download_guardian.title,
              Severity: Major
              Found in src/carousel/carousel_download_guardian.ts and 2 other locations - About 1 hr to fix
              src/carousel/carousel_download_face.ts on lines 4..10
              src/carousel/carousel_takeover.ts on lines 4..10

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

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

              export const carouselTakeover: CarouselNews = {
                backgroundImage:
                  "https://gitlab.com/NatoBoram/eldarya-enhancements/-/raw/master/images/carousel_takeover.png",
                id: "carousel-takeover",
                h4: translate.carousel.takeover.title,
              Severity: Major
              Found in src/carousel/carousel_takeover.ts and 2 other locations - About 1 hr to fix
              src/carousel/carousel_download_face.ts on lines 4..10
              src/carousel/carousel_download_guardian.ts on lines 4..10

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

              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 play has 32 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              async function play(minigame: Minigame): Promise<void> {
                // Disable buttons
                await new Promise<boolean>(resolve => {
                  const interval = setInterval(() => {
                    const buttons = document.querySelectorAll<HTMLButtonElement>(
              Severity: Minor
              Found in src/minigames/emile.ts - About 1 hr to fix

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

                  async perform(): Promise<boolean> {
                    switch (location.pathname) {
                      case "/minigames": {
                        await new Promise(resolve => setTimeout(resolve, 750))
                        const playing =
                Severity: Minor
                Found in src/takeover/classes/minigame_action.ts - About 1 hr to fix

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

                  export function loadProfile(): void {
                    const profileContactActions = document.getElementById(
                      "profile-contact-actions"
                    )
                    if (
                  Severity: Minor
                  Found in src/ui/profile.ts - About 1 hr to fix
                    Severity
                    Category
                    Status
                    Source
                    Language