Showing 33 of 33 total issues
Function locateStores
has a Cognitive Complexity of 11 (exceeds 5 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(
- 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 generateEmbed
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
generateEmbed(setList: WhatsInStandard): EmbedBuilder {
const currentDate = new Date();
const removedFutureAndPastSetList = setList.sets.filter((set) => {
// A set is in standard if:
// It has been released, and
- Create a ticketCreate a ticket
Function find
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
find(lookup: string, subsection?: string) {
const entry = this.ipgData[lookup];
if (!entry) {
let availableEntries = _.keys(this.ipgData);
availableEntries.sort();
- Create a ticketCreate a ticket
Function updateServerCount
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function updateServerCount(bot: Client) {
bot.user?.setPresence({
activities: [
{
name:
- Create a ticketCreate a ticket
Function parseRules
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
parseRules(
crText: string,
glossaryEntries: Record<string, GlossaryEntry>
): Record<string, string> {
const ruleNumberPrefixRe = /^(\d{3}\.\w*)\.?/;
- Create a ticketCreate a ticket
Function generateStoreRequestBody
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
generateStoreRequestBody(geometry: any, count = 10) {
let requestBody = {
count,
filter_mass_markets: true,
language: "en-us",
- Create a ticketCreate a ticket
Function find
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
find(parameter: string): EmbedBuilder {
if (parameter.indexOf("-") !== -1 || parameter.indexOf(".") !== -1) {
// looks like a section query
const section = this.mtrData.sections[parameter];
if (section) {
- Create a ticketCreate a ticket
Function getBorderColor
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
getBorderColor(card: Scry.Card | Scry.CardFace) {
let color;
if (!card.colors || card.colors.length === 0) {
color = MtgCardLoader.colors.NONE;
if (card.type_line && card.type_line.match(/artifact/i))
- 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 parseRules
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
parseRules(
crText: string,
glossaryEntries: Record<string, GlossaryEntry>
): Record<string, string> {
const ruleNumberPrefixRe = /^(\d{3}\.\w*)\.?/;
- 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 parseGlossary
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
parseGlossary(glossaryText: string) {
const glossaryEntries: Record<string, GlossaryEntry> = {};
for (const entry of glossaryText.split("\n\n")) {
if (!entry.trim()) {
- 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 find
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
find(lookup: string, subsection?: string) {
const entry = this.ipgData[lookup];
if (!entry) {
let availableEntries = _.keys(this.ipgData);
availableEntries.sort();
- 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 a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
generateEventsEmbed(
{ Address, Organization }: any,
response: any,
filters: any
): EmbedBuilder {
- 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
Avoid too many return
statements within this function. Open
return {
embeds: [
await this.generateErrorEmbed(
null,
`Location \`${location}\` not found.`
- Create a ticketCreate a ticket