ClarityMoe/hibiki

View on GitHub

Showing 155 of 155 total issues

Function checkPermissions has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
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) {
Severity: Minor
Found in src/ext/CommandHandler.ts - About 35 mins to fix

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

    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;
Severity: Minor
Found in src/ext/Ratelimiter.ts - About 35 mins to fix

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 Promise.reject(this.shard.lm.t("search.channel_not_found", { username: msg.author.username }));
Severity: Major
Found in src/ext/CommandHandler.ts - About 30 mins to fix

Avoid too many return statements within this function.
Open

                    return Promise.resolve(newArgs);
Severity: Major
Found in src/ext/CommandHandler.ts - About 30 mins to fix

Avoid too many return statements within this function.
Open

        return Promise.resolve(this.queue.next());
Severity: Major
Found in src/music/Player.ts - About 30 mins to fix

Avoid too many return statements within this function.
Open

            return msg.channel.createMessage(e);
Severity: Major
Found in src/ext/CommandHandler.ts - About 30 mins to fix

Avoid too many return statements within this function.
Open

            return Promise.resolve();
Severity: Major
Found in src/ext/CommandHandler.ts - About 30 mins to fix

Avoid too many return statements within this function.
Open

                            return Promise.reject(this.shard.lm.t("search.guild_not_found", { username: msg.author.username }));
Severity: Major
Found in src/ext/CommandHandler.ts - About 30 mins to fix

Avoid too many return statements within this function.
Open

                        return Promise.reject(this.shard.lm.t("commands.invalid_argument_type", {
                            argument: arg.name,
                            type: arg.type,
                            username: msg.author.username,
                        }));
Severity: Major
Found in src/ext/CommandHandler.ts - About 30 mins to fix

Avoid too many return statements within this function.
Open

                        return Promise.reject(this.shard.lm.t("commands.invalid_argument_type", {
                            argument: arg.name,
                            type: arg.type,
                            username: msg.author.username,
                        }));
Severity: Major
Found in src/ext/CommandHandler.ts - About 30 mins to fix

Avoid too many return statements within this function.
Open

                            return Promise.reject(this.shard.lm.t("search.channel_not_found", { username: msg.author.username }));
Severity: Major
Found in src/ext/CommandHandler.ts - About 30 mins to fix

Avoid too many return statements within this function.
Open

                        return Promise.reject(this.shard.lm.t("commands.invalid_argument_type", {
                            argument: arg.name,
                            type: arg.type,
                            username: msg.author.username,
                        }));
Severity: Major
Found in src/ext/CommandHandler.ts - About 30 mins to fix

Avoid too many return statements within this function.
Open

                            return Promise.reject(this.shard.lm.t("commands.guild_only", { username: msg.author.username }));
Severity: Major
Found in src/ext/CommandHandler.ts - About 30 mins to fix

Avoid too many return statements within this function.
Open

                            return Promise.reject(this.shard.lm.t("search.user_not_found", { username: msg.author.username }));
Severity: Major
Found in src/ext/CommandHandler.ts - About 30 mins to fix

Avoid too many return statements within this function.
Open

                            return Promise.reject(this.shard.lm.t("search.role_not_found", { username: msg.author.username }));
Severity: Major
Found in src/ext/CommandHandler.ts - About 30 mins to fix

Avoid too many return statements within this function.
Open

                            return Promise.reject(this.shard.lm.t("search.user_not_found", { username: msg.author.username }));
Severity: Major
Found in src/ext/CommandHandler.ts - About 30 mins to fix

Avoid too many return statements within this function.
Open

                            return Promise.reject(this.shard.lm.t("search.channel_not_found", { username: msg.author.username }));
Severity: Major
Found in src/ext/CommandHandler.ts - About 30 mins to fix

Avoid too many return statements within this function.
Open

        return Promise.resolve(newArgs);
Severity: Major
Found in src/ext/CommandHandler.ts - About 30 mins to fix

Avoid too many return statements within this function.
Open

                        return Promise.reject(this.shard.lm.t("commands.guild_only", { username: msg.author.username }));
Severity: Major
Found in src/ext/CommandHandler.ts - About 30 mins to fix

Avoid too many return statements within this function.
Open

                            return Promise.reject(this.shard.lm.t("search.guild_not_found", { username: msg.author.username }));
Severity: Major
Found in src/ext/CommandHandler.ts - About 30 mins to fix
Severity
Category
Status
Source
Language