Showing 27 of 41 total issues
File index.js
has 429 lines of code (exceeds 250 allowed). Consider refactoring. Open
const {
IgnoredError,
InputError
} = require('../errors/')
Function buildHelp
has a Cognitive Complexity of 32 (exceeds 10 allowed). Consider refactoring. Open
buildHelp (data, page = 1) {
if (data && !this.app) throw Error('Could not get OAuth app info. Please start the bot with `Agent.connect()`')
let embed
let reactInterface
- 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 buildHelp
has 95 lines of code (exceeds 25 allowed). Consider refactoring. Open
buildHelp (data, page = 1) {
if (data && !this.app) throw Error('Could not get OAuth app info. Please start the bot with `Agent.connect()`')
let embed
let reactInterface
Function handle
has a Cognitive Complexity of 30 (exceeds 10 allowed). Consider refactoring. Open
async handle (msg) {
// Normalize message content (replacers, prefix, custom prefix, bot mention)
const normalized = this._normalize(msg)
// Get Await class if awaited
- 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
Agent
has 28 functions (exceeds 20 allowed). Consider refactoring. Open
class Agent {
/**
* Create an Agent
* @class
* @param {Object} data The agent data
Function constructor
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor ({ Eris, token, handlerData = {}, options = {} }) {
const {
commands,
reactCommands,
replacers,
Function handle
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
async handle (msg) {
// Normalize message content (replacers, prefix, custom prefix, bot mention)
const normalized = this._normalize(msg)
// Get Await class if awaited
File index.js
has 264 lines of code (exceeds 250 allowed). Consider refactoring. Open
const BaseHandler = require('../base-handler/')
const {
InputError
} = require('../../errors/')
Function handle
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
async handle (msg, emoji, user) {
if (!msg.content && !msg.embeds) return /* Uncached */
// Get command
const command = await this._getInterfaceButton(msg, emoji) || this.getReactCommand(emoji.name)
Function _parseArgs
has a Cognitive Complexity of 21 (exceeds 10 allowed). Consider refactoring. Open
_parseArgs (guild, command, chars) {
const parsed = []
let startingIndex = 0
for (let arg = 0; arg < command.options.args.length; arg++) {
- 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 handle
has a Cognitive Complexity of 20 (exceeds 10 allowed). Consider refactoring. Open
async handle (msg, emoji, user) {
if (!msg.content && !msg.embeds) return /* Uncached */
// Get command
const command = await this._getInterfaceButton(msg, emoji) || this.getReactCommand(emoji.name)
- 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 resultPromises
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
const resultPromises = commandResults.map(async (commandResult) => {
if (!commandResult) return
const {
content,
Function resultPromises
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
const resultPromises = commandResults.map(async (commandResult) => {
if (!commandResult) return
const {
content,
Function constructor
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor ({ name, desc, options = {}, action }) {
const {
args = [],
aliases = [],
guide = {},
Function constructor
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor ({ agent, client, commands, replacers, options = {} }) {
super({ agent, client, options })
/**
* Various regular expressions used internally
Function _parseArgs
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
_parseArgs (guild, command, chars) {
const parsed = []
let startingIndex = 0
for (let arg = 0; arg < command.options.args.length; arg++) {
Function buildCommandGuide
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
buildCommandGuide (name) {
const command = this._handlerData.commands.find((c) => c.name === name.toLowerCase() || c.options.aliases.includes(name.toLowerCase()))
if (!command) throw Error(`Could not find a command named \`${name}\``)
Function _initHandlers
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
_initHandlers () {
if (this._handlerData.commands) {
console.log('Initializing Command Handler')
/**
Function constructor
has a Cognitive Complexity of 15 (exceeds 10 allowed). Consider refactoring. Open
constructor ({ buttons, options = {} }) {
if (!Array.isArray(buttons)) buttons = [buttons]
const {
designatedUsers,
- 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 addAwaits
has a Cognitive Complexity of 14 (exceeds 10 allowed). Consider refactoring. Open
addAwaits (awaits, { _fallBackChannel, _fallBackUser, _triggerResponse } = {}) {
if (!Array.isArray(awaits)) awaits = [awaits]
for (const wait of awaits) {
if (!(wait instanceof Await)) throw TypeError('Supplied await is not an Await instance:\n' + wait)
- 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"