asdqwex/discobot

View on GitHub

Showing 37 of 112 total issues

Function onMessage has 72 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    onMessage: function (bot, user, userID, channelID, message, rawEvent) {
      const imgParts = message.split('"')
      const memeType = imgParts[0].split(' ')[1]
      const memeList = {
        '10guy': 101440,
Severity: Major
Found in src/modules/meme.js - About 2 hrs to fix

    Function setupBot has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

    const setupBot = function () {
      bot.on('ready', function (data) {
        // First wins if none is defined
        if (!bot.DISCORD_GUILD) bot.DISCORD_GUILD = data.d.guilds[0].id
        // Allow usage of text name or id
    Severity: Minor
    Found in src/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 onMessage has 49 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      onMessage: function (bot, user, userID, channelID, message, rawEvent) {
        var parts = message.split(' ')
        parts.splice(0, 2)
        var verb = parts.splice(0, 1).join()
        if (verb === 'at') {
    Severity: Minor
    Found in src/modules/reminder.js - About 1 hr to fix

      Function initialize has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

      const initialize = function () {
        glob('_build/modules/*.js', function (err, files) {
          // Bail out if the modules directory doesn't exist. Your install is fucked?
          if (err) throw new Error(err)
          for (let i = 0; i < files.length; i++) {
      Severity: Minor
      Found in src/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 onMessage has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

        onMessage: function (bot, user, userID, channelID, message, rawEvent) {
          var parts = message.split(' ')
          parts.splice(0, 2)
          var verb = parts.splice(0, 1).join()
          if (verb === 'at') {
      Severity: Minor
      Found in src/modules/reminder.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 onMessage has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

        onMessage: function (bot, user, userID, channelID, message, rawEvent, {random}) {
          const rollMatches = search => {
            return regex`
            (
              (?<numDice> \d{0,4})
      Severity: Minor
      Found in src/modules/dice.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 onMessage has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const onMessage = function (user, userID, channelID, message, rawEvent) {
        if (message.indexOf('!bots?') > -1 && message.indexOf('Force all bots to identify themselves') === -1) {
          return bot.sendMessage({
            to: channelID,
            message: 'Hello I am a robot and my name is ' + bot.BOT_NAME
      Severity: Minor
      Found in src/index.js - About 1 hr to fix

        Function setupBot has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const setupBot = function () {
          bot.on('ready', function (data) {
            // First wins if none is defined
            if (!bot.DISCORD_GUILD) bot.DISCORD_GUILD = data.d.guilds[0].id
            // Allow usage of text name or id
        Severity: Minor
        Found in src/index.js - About 1 hr to fix

          Function onMessage has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

          const onMessage = function (user, userID, channelID, message, rawEvent) {
            if (message.indexOf('!bots?') > -1 && message.indexOf('Force all bots to identify themselves') === -1) {
              return bot.sendMessage({
                to: channelID,
                message: 'Hello I am a robot and my name is ' + bot.BOT_NAME
          Severity: Minor
          Found in src/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 onReady has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const onReady = function () {
          // Cron Jobby bit
            schedule.scheduleJob('announceGuard', '*/5 * * * *', function () {
              announceGuard = 0
            })
          Severity: Minor
          Found in src/index.js - About 1 hr to fix

            Function onMessage has 7 arguments (exceeds 4 allowed). Consider refactoring.
            Open

              onMessage: function (bot, user, userID, channelID, message, rawEvent, {random}) {
            Severity: Major
            Found in src/modules/scrub.js - About 50 mins to fix

              Function onMessage has 7 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                onMessage: function (bot, user, userID, channelID, message, rawEvent, {random}) {
              Severity: Major
              Found in src/modules/say.js - About 50 mins to fix

                Function onMessage has 7 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                  onMessage: function (bot, user, userID, channelID, message, rawEvent, {random}) {
                Severity: Major
                Found in src/modules/dice.js - About 50 mins to fix

                  Function onMessage has 7 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                    onMessage: function (bot, user, userID, channelID, message, rawEvent, {random}) {
                  Severity: Major
                  Found in src/modules/8ball.js - About 50 mins to fix

                    Function onMessage has 6 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                      onMessage: function (bot, user, userID, channelID, message, rawEvent) {
                    Severity: Minor
                    Found in src/modules/comics.js - About 45 mins to fix

                      Function onMessage has 6 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                        onMessage: function (bot, user, userID, channelID, message, rawEvent) {
                      Severity: Minor
                      Found in src/modules/giphy.js - About 45 mins to fix

                        Function onMessage has 6 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                          onMessage: function (bot, user, userID, channelID, message, rawEvent) {
                        Severity: Minor
                        Found in src/modules/reminder.js - About 45 mins to fix

                          Function onMessage has 6 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                            onMessage: function (bot, user, userID, channelID, message, rawEvent) {
                          Severity: Minor
                          Found in src/modules/wiki.js - About 45 mins to fix

                            Function onMessage has 6 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                              onMessage: function (bot, user, userID, channelID, message, rawEvent) {
                            Severity: Minor
                            Found in src/modules/urban.js - About 45 mins to fix

                              Function onMessage has 6 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                                onMessage: function (bot, user, userID, channelID, message, rawEvent) {
                              Severity: Minor
                              Found in src/modules/table_flip.js - About 45 mins to fix
                                Severity
                                Category
                                Status
                                Source
                                Language