Showing 54 of 2,279 total issues
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)
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
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
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>(
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 =
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 (
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
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
}
- Read upRead up
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 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)
- Read upRead up
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)
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")
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")
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
Function addAutoExploreButton
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
function addAutoExploreButton(
locationId: number,
observer?: MutationObserver
): void {
const buttonsContainer =
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) {
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")
Function getPrizes
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function getPrizes(
minigame: Minigame,
gameToken: string,
score: number
): Promise<Packet<GetPrizesData>> {
Function saveScore
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function saveScore(
enc_token: string,
score: number,
game: string,
recaptchaToken?: string
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
Function translation
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function translation(): Translation {
if (location.hostname.endsWith(".com.br")) return en
if (location.hostname.endsWith(".de")) return en
if (location.hostname.endsWith(".es")) return en
if (location.hostname.endsWith(".hu")) return en
- Read upRead up
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"