Showing 15 of 400 total issues
Consider simplifying this complex logical expression. Open
if (
args[0] === 'h' ||
args[0] === 'help' ||
args.length > 3 ||
(year && isNaN(year)) ||
Function exec
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
async exec ({member, channel, guild}, [user]) {
let target;
if (!user) {
target = member;
} else if (Discord.MessageMentions.USERS_PATTERN.test(user)) {
- Read upRead up
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 exec
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
async exec ({channel}, args) {
const now = new Date;
let month;
let day;
let year;
Function exec
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
async exec ({channel}, args) {
const now = new Date;
let month;
let day;
let year;
- Read upRead up
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 exec
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
async exec ({member, channel, guild}, [user]) {
let target;
if (!user) {
target = member;
} else if (Discord.MessageMentions.USERS_PATTERN.test(user)) {
Function exec
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
exec ({channel}, [level = 'normal']) {
level = level.toLowerCase();
const levels = ['dumb', 'easy', 'normal', 'hard', 'extreme'];
if (!levels.includes(level)) {
Function exec
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
async exec (message, args) {
const [options, ...rest] = args;
let type = 'pics';
let command = 'category';
- Read upRead up
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 handleMessage
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
async handleMessage (message) {
// Prevent bots talk
if (message.author.bot) {
return;
}
Function check
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
check (message, args, memory) {
if (this.nsfw && !message.channel.nsfw) {
return false;
}
- Read upRead up
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 exec
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
async exec (message, args) {
const [options, ...rest] = args;
let type = 'pics';
let command = 'category';
Function exec
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
async exec ({channel}) {
const reddit = randomItem([
'cat',
'cats',
'whatswrongwithyourcat',
Function handleMessage
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
async handleMessage (message) {
// Prevent bots talk
if (message.author.bot) {
return;
}
- Read upRead up
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 constructor
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
constructor (options = {}) {
super(Object.assign({
name: 'joke',
description: 'Get some bot humor'
}, options));
- Read upRead up
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 constructor
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
constructor (options = {}) {
super(Object.assign({
name: 'fortune',
description: 'Crack open your fortune cookie!'
}, options));
- Read upRead up
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 exec
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
async exec (message, args, memory) {
const lastFortuneTime = memory.get(['fortune', message.author.id], 0);
if (lastFortuneTime + this.cooldown > Date.now()) {
await message.reply('come back later for another fortune.');
- Read upRead up
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"