Showing 155 of 155 total issues
Function checkPermissions
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
public checkPermissions (msg: Eris.Message, perms: ICommandPermission[]): Promise<{ [key: string]: boolean }> {
const newPerms: { [key: string]: boolean } = {};
if (!(msg.channel instanceof Eris.GuildChannel)) {
for (const perm of perms) {
- 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 use
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
public use (): string {
if (this.uses < this.max) {
this.uses++;
if (this.lastUse !== 0 ? (this.lastUse + this.time / 2) - Date.now() <= 0 : true) {
this.soft = false;
- 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
Open
return Promise.reject(this.shard.lm.t("search.channel_not_found", { username: msg.author.username }));
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. Open
Open
return Promise.resolve(newArgs);
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. Open
Open
return Promise.resolve(this.queue.next());
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. Open
Open
return msg.channel.createMessage(e);
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. Open
Open
return Promise.resolve();
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. Open
Open
return Promise.reject(this.shard.lm.t("search.guild_not_found", { username: msg.author.username }));
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. Open
Open
return Promise.reject(this.shard.lm.t("commands.invalid_argument_type", {
argument: arg.name,
type: arg.type,
username: msg.author.username,
}));
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. Open
Open
return Promise.reject(this.shard.lm.t("commands.invalid_argument_type", {
argument: arg.name,
type: arg.type,
username: msg.author.username,
}));
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. Open
Open
return Promise.reject(this.shard.lm.t("search.channel_not_found", { username: msg.author.username }));
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. Open
Open
return Promise.reject(this.shard.lm.t("commands.invalid_argument_type", {
argument: arg.name,
type: arg.type,
username: msg.author.username,
}));
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. Open
Open
return Promise.reject(this.shard.lm.t("commands.guild_only", { username: msg.author.username }));
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. Open
Open
return Promise.reject(this.shard.lm.t("search.user_not_found", { username: msg.author.username }));
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. Open
Open
return Promise.reject(this.shard.lm.t("search.role_not_found", { username: msg.author.username }));
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. Open
Open
return Promise.reject(this.shard.lm.t("search.user_not_found", { username: msg.author.username }));
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. Open
Open
return Promise.reject(this.shard.lm.t("search.channel_not_found", { username: msg.author.username }));
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. Open
Open
return Promise.resolve(newArgs);
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. Open
Open
return Promise.reject(this.shard.lm.t("commands.guild_only", { username: msg.author.username }));
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. Open
Open
return Promise.reject(this.shard.lm.t("search.guild_not_found", { username: msg.author.username }));
- Create a ticketCreate a ticket