NatoBoram/eldarya-enhancements

View on GitHub

Showing 55 of 2,340 total issues

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

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

          export async function loadDressingExperience(): Promise<void> {
              if (!location.pathname.startsWith("/player/appearance")) return
          
              handledCategories.clear()
              loading = false
          Severity: Minor
          Found in src/appearance/dressing_experience.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

              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 wearOutfit has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                export async function wearOutfit(
                    avatar: Avatar,
                    outfit: ParsableItem[],
                ): Promise<void> {
                    $.flavrNotif(translate.appearance.favourites.importing)
                Severity: Minor
                Found in src/appearance/favourites_actions.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

                Function loadCarousel has a Cognitive Complexity of 11 (exceeds 5 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

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

                export async function wearOutfit(
                    avatar: Avatar,
                    outfit: ParsableItem[],
                ): Promise<void> {
                    $.flavrNotif(translate.appearance.favourites.importing)
                Severity: Minor
                Found in src/appearance/favourites_actions.ts - About 1 hr to fix

                  Function getPrizes has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  async function getPrizes(
                      minigame: Minigame,
                      gameToken: string,
                      score: number,
                  ): Promise<Packet<GetPrizesData>> {
                  Severity: Minor
                  Found in src/minigames/emile.ts - About 1 hr to fix

                    Function loadFavouritesActions has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function loadFavouritesActions(): void {
                        const actions = document.getElementById("favorites-actions")
                        if (!actions || document.querySelector(".favorites-action-ee")) return
                    
                        const actionTemplate: Template = require("../templates/html/favourites_action.html")
                    Severity: Minor
                    Found in src/ui/favourites.ts - About 1 hr to fix

                      Function addWishlistButton has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function addWishlistButton(li: HTMLLIElement): void {
                          document.querySelector("#add-to-wishlist")?.remove()
                      
                          document
                              .querySelector("#mall-productDetail-info")
                      Severity: Minor
                      Found in src/ui/mall.ts - About 1 hr to fix

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

                        function save(icon: string, resolve: () => void): boolean {
                            const wishlist = LocalStorage.wishlist
                            const index = wishlist.findIndex(item => item.icon === icon)
                            const entry = wishlist[index]
                            if (!entry) return false
                        Severity: Minor
                        Found in src/ui/wishlist.ts - About 1 hr to fix

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

                          async function saveScore(
                              enc_token: string,
                              score: number,
                              game: string,
                              recaptchaToken?: string,
                          Severity: Minor
                          Found in src/minigames/emile.ts - About 1 hr to fix

                            Function clickRegion has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                private async clickRegion(
                                    selected: AutoExploreLocation,
                                ): Promise<HTMLDivElement | null> {
                                    const container = document.querySelector("#minimaps-container")
                                    if (!container) {
                            Severity: Minor
                            Found in src/takeover/classes/exploration_action.ts - About 1 hr to fix

                              Function addAutoExploreButton has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              function addAutoExploreButton(
                                  locationId: number,
                                  observer?: MutationObserver,
                              ): void {
                                  const buttonsContainer =
                              Severity: Minor
                              Found in src/pet/exploration.ts - About 1 hr to fix

                                Function handleCategory has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                async function handleCategory(
                                    category: AppearanceCategoryCode,
                                ): Promise<HTMLDivElement | null> {
                                    const appearanceItems =
                                        document.querySelector<HTMLDivElement>("#appearance-items")
                                Severity: Minor
                                Found in src/appearance/dressing_experience.ts - About 1 hr to fix

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

                                  export function migrate(): void {
                                      switch (LocalStorage.version) {
                                          case GM.info.script.version:
                                              return
                                  
                                  
                                  Severity: Minor
                                  Found in src/migrate.ts - About 1 hr to fix

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

                                    export async function openGroup(group: number): Promise<HTMLDivElement | null> {
                                        return new Promise<HTMLDivElement | null>((resolve): void => {
                                            const groupContainer = document.querySelector<HTMLDivElement>(
                                                `#appearance-items-group-${group}`,
                                            )
                                    Severity: Minor
                                    Found in src/appearance/favourites_actions.ts - About 1 hr to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language