NatoBoram/eldarya-enhancements

View on GitHub

Showing 54 of 2,279 total issues

Function loadBackground has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

export async function loadBackground(): Promise<void> {
  if (loading) return
  loading = true
  let success = true

Severity: Minor
Found in src/appearance/dressing_experience.ts - About 55 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 perform has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  async perform(): Promise<boolean> {
    if (location.pathname !== "/pet") {
      pageLoad("/pet")
      return true
    }
Severity: Minor
Found in src/takeover/classes/exploration_action.ts - 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

Avoid too many return statements within this function.
Open

  if (location.hostname.endsWith(".pl")) return en
Severity: Major
Found in src/i18n/translate.ts - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

        return true
    Severity: Major
    Found in src/takeover/classes/summer_game_action.ts - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

        if (location.hostname.endsWith(".fr")) return fr
      Severity: Major
      Found in src/i18n/translate.ts - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

          if (location.hostname.endsWith(".com")) return en
        Severity: Major
        Found in src/i18n/translate.ts - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

            else return en
          Severity: Major
          Found in src/i18n/translate.ts - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                return true
            Severity: Major
            Found in src/takeover/classes/exploration_action.ts - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                if (location.hostname.endsWith(".it")) return en
              Severity: Major
              Found in src/i18n/translate.ts - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                  if (location.hostname.endsWith(".ru")) return en
                Severity: Major
                Found in src/i18n/translate.ts - About 30 mins to fix

                  Function showFavourite has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                  export function showFavourite(favourite: FavouriteOutfit): void {
                    const template: Template = require("../templates/html/favourite_outfit_flavr.html")
                  
                    $.flavr({
                      content: template.render({ ...favourite, translate }),
                  Severity: Minor
                  Found in src/appearance/fake_favourites.ts - 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

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

                  Function takeover has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                  async function takeover(): Promise<void> {
                    if (!SessionStorage.takeover) return
                    if (dailyAction.condition()) await dailyAction.perform()
                  
                    const action = actions.find(action => action.key === SessionStorage.action)
                  Severity: Minor
                  Found in src/takeover/brain.ts - 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

                  Function removeClothes has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function removeClothes(): void {
                    const avatar = Sacha.Avatar.avatars["#appearance-preview"]
                    if (!avatar) return
                  
                    for (let i = avatar.children.length - 1; i >= 0; i--) {
                  Severity: Minor
                  Found in src/appearance/favourites_actions.ts - 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

                  Severity
                  Category
                  Status
                  Source
                  Language