Showing 33 of 33 total issues
File store.ts
has 561 lines of code (exceeds 250 allowed). Consider refactoring. Open
import Fuse from "fuse.js";
const log = utils.getLogger("locator");
import fetch from "node-fetch";
import * as utils from "../utils.js";
- Create a ticketCreate a ticket
File card.ts
has 432 lines of code (exceeds 250 allowed). Consider refactoring. Open
import {
ButtonInteraction,
CommandInteraction,
Message,
MessageActionRowComponentResolvable,
- Create a ticketCreate a ticket
Function generateResponse
has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring. Open
async generateResponse(
cards: JudgebotCard[],
command: string,
hasEmojiPermission: boolean
) {
- Read upRead up
- Create a ticketCreate a ticket
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 generateResponse
has 114 lines of code (exceeds 25 allowed). Consider refactoring. Open
async generateResponse(
cards: JudgebotCard[],
command: string,
hasEmojiPermission: boolean
) {
- Create a ticketCreate a ticket
File hangman.ts
has 342 lines of code (exceeds 250 allowed). Consider refactoring. Open
import _ from "lodash";
import * as utils from "../utils.js";
import MtgCardLoader from "./card.js";
import {
ActionRowBuilder,
- Create a ticketCreate a ticket
Function locateStores
has 81 lines of code (exceeds 25 allowed). Consider refactoring. Open
async locateStores(location: any): Promise<InteractionReplyOptions> {
const count = 10; // number of "stores" to retrieve (error margin included for non-store results)
let googleBody: any;
try {
const res = await fetch(
- Create a ticketCreate a ticket
Function generateMessage
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
generateMessage() {
const missing = this.missing;
const wrong = this.wrong;
let totalGuesses = this.letters.size + this.wrongGuesses;
- Read upRead up
- Create a ticketCreate a ticket
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 generateEventsEmbed
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
generateEventsEmbed(
{ Address, Organization }: any,
response: any,
filters: any
): EmbedBuilder {
- Create a ticketCreate a ticket
File ipg.ts
has 277 lines of code (exceeds 250 allowed). Consider refactoring. Open
import {
ApplicationCommandOptionChoiceData,
ApplicationCommandOptionType,
AutocompleteInteraction,
CommandInteraction,
- Create a ticketCreate a ticket
Function fetchStores
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
async fetchStores(longitude = -180, distance = 10) {
try {
if (longitude > 180 - distance) {
// fetchStores(longitude = 0, distance = 10) { // easier testing
// if (longitude > 20 - distance) {
- Create a ticketCreate a ticket
Function generateMessage
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
generateMessage() {
const missing = this.missing;
const wrong = this.wrong;
let totalGuesses = this.letters.size + this.wrongGuesses;
- Create a ticketCreate a ticket
Function getEvents
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
async getEvents(query: string): Promise<EmbedBuilder> {
// check if there are filters present
const filters: any = {};
let parameters = query.toLowerCase().split(" ");
if (parameters.length == 0) {
- Create a ticketCreate a ticket
Function hangman
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Slash({
name: "hangman",
description:
"Start a game of hangman, where you have to guess the card name with reaction letters",
})
- Create a ticketCreate a ticket
Function generateStoreEmbed
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
async generateStoreEmbed(
stores: any,
googleResult: any
): Promise<InteractionReplyOptions> {
const fields: any = [];
- Create a ticketCreate a ticket
Function cr
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
@Slash({
name: "cr",
description: "Show a rule or definition from the Comprehensive Rulebook",
})
async cr(
- Read upRead up
- Create a ticketCreate a ticket
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 handleInteraction
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
async handleInteraction(
command: string,
parameter: string,
interaction: CommandInteraction
) {
- Create a ticketCreate a ticket
Function handleInteraction
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
async handleInteraction(
command: string,
parameter: string,
interaction: CommandInteraction
) {
- Read upRead up
- Create a ticketCreate a ticket
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 cr
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Slash({
name: "cr",
description: "Show a rule or definition from the Comprehensive Rulebook",
})
async cr(
- Create a ticketCreate a ticket
Function getEvents
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
async getEvents(query: string): Promise<EmbedBuilder> {
// check if there are filters present
const filters: any = {};
let parameters = query.toLowerCase().split(" ");
if (parameters.length == 0) {
- Read upRead up
- Create a ticketCreate a ticket
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 generateDescriptionText
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
generateDescriptionText(card: Scry.Card) {
const ptToString = (card: Scry.CardFace | Scry.Card) =>
`**${card.power?.replace(/\*/g, "\\*")}/${card.toughness?.replace(
/\*/g,
"\\*"
- Create a ticketCreate a ticket