Function checkArguments
has a Cognitive Complexity of 116 (exceeds 5 allowed). Consider refactoring. Open
public checkArguments (msg: Eris.Message, given: string[], args: ICommandArg[]): Promise<{ [key: string]: any }> {
const newArgs: { [key: string]: any } = {};
for (const arg of args) {
const i: number = args.indexOf(arg);
- 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 checkArguments
has 177 lines of code (exceeds 25 allowed). Consider refactoring. Open
public checkArguments (msg: Eris.Message, given: string[], args: ICommandArg[]): Promise<{ [key: string]: any }> {
const newArgs: { [key: string]: any } = {};
for (const arg of args) {
const i: number = args.indexOf(arg);
- Create a ticketCreate a ticket
File CommandHandler.ts
has 360 lines of code (exceeds 250 allowed). Consider refactoring. Open
// CommandHandler.ts - Command handler (noud02)
import * as Eris from "eris";
import * as minimist from "minimist";
import * as pg from "pg";
- Create a ticketCreate a ticket
Function executeCommand
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
public async executeCommand (msg: Eris.Message, command: string, args: minimist.ParsedArgs, prefix: string): Promise<any> {
let subcommand: string | undefined = undefined; // tslint:disable-line:no-unnecessary-initializer
if (command.indexOf(".") > -1) {
subcommand = command.split(".")[1];
- 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 executeCommand
has 84 lines of code (exceeds 25 allowed). Consider refactoring. Open
public async executeCommand (msg: Eris.Message, command: string, args: minimist.ParsedArgs, prefix: string): Promise<any> {
let subcommand: string | undefined = undefined; // tslint:disable-line:no-unnecessary-initializer
if (command.indexOf(".") > -1) {
subcommand = command.split(".")[1];
- Create a ticketCreate a ticket
Function checkMessage
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public async checkMessage (msg: Eris.Message): Promise<void> {
let guildPrefixes: string[] = [];
let usedPrefix: string = "";
let command: string = "";
let args: minimist.ParsedArgs;
- 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 checkMessage
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
public async checkMessage (msg: Eris.Message): Promise<void> {
let guildPrefixes: string[] = [];
let usedPrefix: string = "";
let command: string = "";
let args: minimist.ParsedArgs;
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
if (!(msg.channel instanceof Eris.GuildChannel)) {
return Promise.reject(this.shard.lm.t("commands.guild_only", { username: msg.author.username }));
}
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
} else if (id.test(given[i])) {
const user: Eris.User | undefined = this.shard.users.get(given[i]);
if (!user) {
return Promise.reject(this.shard.lm.t("search.user_not_found", { username: msg.author.username }));
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
if (!user) {
return Promise.reject(this.shard.lm.t("search.user_not_found", { username: msg.author.username }));
}
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
if (user) {
newArgs[arg.name] = user;
}
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
if (!guild) {
return Promise.reject(this.shard.lm.t("search.guild_not_found", { username: msg.author.username }));
}
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
} else if (name.test(given[i])) {
const channel: Eris.GuildChannel = msg.channel.guild.channels.filter((c: Eris.GuildChannel) => c.type === 0 && c.name.indexOf(given[i]) > -1)[0];
if (!channel) {
return Promise.reject(this.shard.lm.t("search.channel_not_found", { username: msg.author.username }));
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
if (!role) {
return Promise.reject(this.shard.lm.t("search.role_not_found", { username: msg.author.username }));
}
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
if (!channel) {
return Promise.reject(this.shard.lm.t("search.channel_not_found", { username: msg.author.username }));
}
- Create a ticketCreate a ticket
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) {
- 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 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
return Promise.resolve(newArgs);
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. Open
return msg.channel.createMessage(e);
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. Open
return Promise.resolve();
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. 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
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
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
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
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
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
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
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
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
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
return Promise.resolve(newArgs);
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. 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
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
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
return cmd.run(ctx);
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. 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
return msg.channel.createMessage(e);
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. Open
return msg.channel.createMessage(e);
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. 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
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
return Promise.reject(this.shard.lm.t("search.role_not_found", { username: msg.author.username }));
- Create a ticketCreate a ticket
Function checkBotPermissions
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public checkBotPermissions (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
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (!mention.test(given[i]) && !name.test(given[i]) && !id.test(given[i])) {
return Promise.reject(this.shard.lm.t("commands.invalid_argument_type", {
argument: arg.name,
type: arg.type,
username: msg.author.username,
- Read upRead up
- Create a ticketCreate a ticket
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 117.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (!mention.test(given[i]) && !name.test(given[i]) && !id.test(given[i])) {
return Promise.reject(this.shard.lm.t("commands.invalid_argument_type", {
argument: arg.name,
type: arg.type,
username: msg.author.username,
- Read upRead up
- Create a ticketCreate a ticket
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 117.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
} else if (id.test(given[i])) {
const user: Eris.User | undefined = this.shard.users.get(given[i]);
if (!user) {
return Promise.reject(this.shard.lm.t("search.user_not_found", { username: msg.author.username }));
- Read upRead up
- Create a ticketCreate a ticket
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 110.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (id.test(given[i])) {
const guild: Eris.Guild | undefined = this.shard.guilds.get(given[i]);
if (!guild) {
return Promise.reject(this.shard.lm.t("search.guild_not_found", { username: msg.author.username }));
- Read upRead up
- Create a ticketCreate a ticket
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 110.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (!perm.optional && !msg.channel.permissionsOf(msg.author.id).has(perm.name)) {
return Promise.reject(this.shard.lm.t("permissions.user_lack_perms", {
permission: this.shard.lm.localizedPerm(perm.name),
username: msg.author.username,
}));
- Read upRead up
- Create a ticketCreate a ticket
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 71.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (!perm.optional && !msg.channel.permissionsOf(this.shard.user.id).has(perm.name)) {
return Promise.reject(this.shard.lm.t("permissions.bot_lack_perms", {
permission: this.shard.lm.localizedPerm(perm.name),
username: msg.author.username,
}));
- Read upRead up
- Create a ticketCreate a ticket
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 71.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 4 locations. Consider refactoring. Open
if (!(msg.channel instanceof Eris.GuildChannel)) {
return Promise.reject(this.shard.lm.t("commands.guild_only", { username: msg.author.username }));
}
- Read upRead up
- Create a ticketCreate a ticket
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 63.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 4 locations. Consider refactoring. Open
if (!(msg.channel instanceof Eris.GuildChannel)) {
return Promise.reject(this.shard.lm.t("commands.guild_only", { username: msg.author.username }));
}
- Read upRead up
- Create a ticketCreate a ticket
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 63.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 4 locations. Consider refactoring. Open
if (!(msg.channel instanceof Eris.GuildChannel)) {
return Promise.reject(this.shard.lm.t("commands.guild_only", { username: msg.author.username }));
}
- Read upRead up
- Create a ticketCreate a ticket
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 63.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 4 locations. Consider refactoring. Open
if (!(msg.channel instanceof Eris.GuildChannel)) {
return Promise.reject(this.shard.lm.t("commands.guild_only", { username: msg.author.username }));
}
- Read upRead up
- Create a ticketCreate a ticket
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 63.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (!(msg.channel instanceof Eris.GuildChannel)) {
for (const perm of perms) {
newPerms[perm.name] = true;
}
- Read upRead up
- Create a ticketCreate a ticket
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 60.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (!(msg.channel instanceof Eris.GuildChannel)) {
for (const perm of perms) {
newPerms[perm.name] = true;
}
- Read upRead up
- Create a ticketCreate a ticket
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 60.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
try {
newPerms = await this.checkPermissions(msg, cmd.perms || []);
} catch (e) {
return msg.channel.createMessage(e);
}
- Read upRead up
- Create a ticketCreate a ticket
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 55.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
try {
newBotPerms = await this.checkBotPermissions(msg, cmd.botPerms || []);
} catch (e) {
return msg.channel.createMessage(e);
}
- Read upRead up
- Create a ticketCreate a ticket
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 55.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76