exoRift/cyclone-engine

View on GitHub

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/')

Severity: Minor
Found in lib/agent/index.js - About 6 hrs to fix

    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
    Severity: Minor
    Found in lib/agent/index.js - About 3 hrs 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 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
    Severity: Major
    Found in lib/agent/index.js - About 3 hrs to fix

      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
      Severity: Minor
      Found in lib/modules/command-handler/index.js - About 3 hrs 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

      Agent has 28 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class Agent {
        /**
         * Create an Agent
         * @class
         * @param {Object}                       data                                               The agent data
      Severity: Minor
      Found in lib/agent/index.js - About 3 hrs to fix

        Function constructor has 73 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          constructor ({ Eris, token, handlerData = {}, options = {} }) {
            const {
              commands,
              reactCommands,
              replacers,
        Severity: Major
        Found in lib/agent/index.js - About 2 hrs to fix

          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
          Severity: Major
          Found in lib/modules/command-handler/index.js - About 2 hrs to fix

            File index.js has 264 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            const BaseHandler = require('../base-handler/')
            
            const {
              InputError
            } = require('../../errors/')
            Severity: Minor
            Found in lib/modules/command-handler/index.js - About 2 hrs to fix

              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)
              Severity: Major
              Found in lib/modules/reaction-handler/index.js - About 2 hrs to fix

                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++) {
                Severity: Minor
                Found in lib/modules/command-handler/index.js - About 2 hrs 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 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)
                Severity: Minor
                Found in lib/modules/reaction-handler/index.js - About 1 hr 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 resultPromises has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    const resultPromises = commandResults.map(async (commandResult) => {
                      if (!commandResult) return
                
                      const {
                        content,
                Severity: Minor
                Found in lib/modules/command-handler/index.js - About 1 hr to fix

                  Function resultPromises has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      const resultPromises = commandResults.map(async (commandResult) => {
                        if (!commandResult) return
                  
                        const {
                          content,
                  Severity: Minor
                  Found in lib/modules/reaction-handler/index.js - About 1 hr to fix

                    Function constructor has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      constructor ({ name, desc, options = {}, action }) {
                        const {
                          args = [],
                          aliases = [],
                          guide = {},
                    Severity: Minor
                    Found in lib/structures/command/index.js - About 1 hr to fix

                      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
                      Severity: Minor
                      Found in lib/modules/command-handler/index.js - About 1 hr to fix

                        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++) {
                        Severity: Minor
                        Found in lib/modules/command-handler/index.js - About 1 hr to fix

                          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}\``)
                          
                          
                          Severity: Minor
                          Found in lib/agent/index.js - About 1 hr to fix

                            Function _initHandlers has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              _initHandlers () {
                                if (this._handlerData.commands) {
                                  console.log('Initializing Command Handler')
                            
                                  /**
                            Severity: Minor
                            Found in lib/agent/index.js - About 1 hr to fix

                              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,
                              Severity: Minor
                              Found in lib/structures/react-interface/index.js - About 1 hr 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 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)
                              Severity: Minor
                              Found in lib/modules/command-handler/index.js - About 55 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

                              Severity
                              Category
                              Status
                              Source
                              Language