Showing 55 of 2,340 total issues
Function loadFakeFavourites
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
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 changePrice
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
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 getItemDetails
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
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 perform
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async perform(): Promise<boolean> {
switch (location.pathname) {
case "/minigames": {
await new Promise(resolve => setTimeout(resolve, 750))
const playing =
Function loadDressingExperience
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export async function loadDressingExperience(): Promise<void> {
if (!location.pathname.startsWith("/player/appearance")) return
handledCategories.clear()
loading = false
Function loadProfile
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function loadProfile(): void {
const profileContactActions = document.getElementById(
"profile-contact-actions",
)
if (
Function play
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async function play(minigame: Minigame): Promise<void> {
// Disable buttons
await new Promise<boolean>(resolve => {
const interval = setInterval(() => {
const buttons = document.querySelectorAll<HTMLButtonElement>(
Function wearOutfit
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
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 loadCarousel
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
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 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export async function wearOutfit(
avatar: Avatar,
outfit: ParsableItem[],
): Promise<void> {
$.flavrNotif(translate.appearance.favourites.importing)
Function getPrizes
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async function getPrizes(
minigame: Minigame,
gameToken: string,
score: number,
): Promise<Packet<GetPrizesData>> {
Function loadFavouritesActions
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
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
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
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 saveScore
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async function saveScore(
enc_token: string,
score: number,
game: string,
recaptchaToken?: string,
Function clickRegion
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private async clickRegion(
selected: AutoExploreLocation,
): Promise<HTMLDivElement | null> {
const container = document.querySelector("#minimaps-container")
if (!container) {
Function addAutoExploreButton
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function addAutoExploreButton(
locationId: number,
observer?: MutationObserver,
): void {
const buttonsContainer =
Function handleCategory
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async function handleCategory(
category: AppearanceCategoryCode,
): Promise<HTMLDivElement | null> {
const appearanceItems =
document.querySelector<HTMLDivElement>("#appearance-items")
Function migrate
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function migrate(): void {
switch (LocalStorage.version) {
case GM.info.script.version:
return
Function openGroup
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
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}`,
)