Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: clean up codebase to make it at least a little readable #87

Merged
merged 27 commits into from
Aug 20, 2024
Merged

Conversation

dev-737
Copy link
Member

@dev-737 dev-737 commented Jul 26, 2024

WIP

* feat(locale): use redis to fetch locale when needed

get locale from redis or mongo when needed, instead of always setting <User>.locale. Avoids bugs

* refactor(util): minor userLocale refactor
Copy link

deepsource-io bot commented Jul 26, 2024

Here's the code health analysis summary for commits 4ba4c6c..9d29cb7. View details on DeepSource ↗.

Analysis Summary

AnalyzerStatusSummaryLink
DeepSource JavaScript LogoJavaScript✅ Success
🎯 7 occurences resolved
View Check ↗

💡 If you’re a repository administrator, you can configure the quality gates from the settings.

@@ -1,7 +1,24 @@
import { RegisterInteractionHandler } from '#main/decorators/Interaction.js';
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

File customize.ts has 274 lines of code (exceeds 250 allowed). Consider refactoring.

],
ephemeral: true,
});
await this.replyEmbed(
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar blocks of code found in 2 locations. Consider refactoring.

],
ephemeral: true,
});
await this.replyEmbed(
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar blocks of code found in 2 locations. Consider refactoring.

),
),
],
await this.replyEmbed(
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar blocks of code found in 2 locations. Consider refactoring.

],
ephemeral: true,
});
await this.replyEmbed(
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar blocks of code found in 2 locations. Consider refactoring.

@@ -1,7 +1,23 @@
import { RegisterInteractionHandler } from '#main/decorators/Interaction.js';
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

File customize.ts has 277 lines of code (exceeds 250 allowed). Consider refactoring.

@dev-737 dev-737 linked an issue Aug 10, 2024 that may be closed by this pull request
await storeMessageData(message, sendResult, connection.hubId, dbReferrence);
}

private async sendBroadcast(
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function sendBroadcast has 72 lines of code (exceeds 25 allowed). Consider refactoring.

.setURL(`${LINKS.DOCS}/legal/terms`)
.setEmoji(emojis.docs_icon)
.setStyle(ButtonStyle.Link),
new ButtonBuilder()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar blocks of code found in 3 locations. Consider refactoring.

.setURL(`${LINKS.DOCS}/setup`)
.setEmoji(emojis.guide_icon)
.setStyle(ButtonStyle.Link),
new ButtonBuilder()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar blocks of code found in 3 locations. Consider refactoring.

.setFooter({ text: `Sent for: ${guild.name}`, iconURL: guild.iconURL() ?? undefined });

const buttons = new ActionRowBuilder<ButtonBuilder>().addComponents(
new ButtonBuilder()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar blocks of code found in 3 locations. Consider refactoring.

const emojiAlreadyReacted = dbReactions[reactedEmoji] ?? [user.id];

// max 10 reactions
if (Object.keys(dbReactions).length >= 10) return;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid too many return statements within this function.

The cache is used/called in the code instead of being used in a middleware on all queries.
Copy link

@codeclimate codeclimate bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR diff size of 5553 lines exceeds the maximum allowed for the inline comments feature.

Copy link

@codeclimate codeclimate bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR diff size of 5992 lines exceeds the maximum allowed for the inline comments feature.

Copy link

@codeclimate codeclimate bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR diff size of 6129 lines exceeds the maximum allowed for the inline comments feature.

Copy link

@codeclimate codeclimate bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR diff size of 6129 lines exceeds the maximum allowed for the inline comments feature.

Copy link

@codeclimate codeclimate bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR diff size of 6394 lines exceeds the maximum allowed for the inline comments feature.

Copy link

codeclimate bot commented Aug 19, 2024

Code Climate has analyzed commit f37ccb8 and detected 102 issues on this pull request.

Here's the issue category breakdown:

Category Count
Complexity 39
Duplication 63

View more on Code Climate.

@dev-737 dev-737 changed the title Version 4 refactor: clean up codebase to make it at least a little readable Aug 20, 2024
@dev-737 dev-737 merged commit b61338e into main Aug 20, 2024
3 of 4 checks passed
@dev-737 dev-737 removed a link to an issue Aug 20, 2024
@dev-737 dev-737 deleted the v4 branch August 20, 2024 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant