progdisc/AwesomeBot

View on GitHub

Showing 21 of 21 total issues

Function run has 63 lines of code (exceeds 25 allowed). Consider refactoring.
Open

run: (bot, message, cmdArgs) => {
if (!cmdArgs) {
const langList = availableLanguages.reduce((prev, x) => {
let langEntry = `${prev}${prev ? '\n' : ''}- ${x}`;
const aliases = Object.keys(langAliases)
Severity: Major
Found in commands/eval/eval.js - About 2 hrs to fix

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    init: () => {
    console.log('Loading help topics...');
    getFileList(path.join(__dirname, 'topics')).forEach((fn) => {
    knownTopics[path.basename(fn, '.txt')] = loadHelpText(path.join(__dirname, 'topics', fn));
    });
    Severity: Major
    Found in commands/help/help.js and 1 other location - About 2 hrs to fix
    commands/quickref/quickref.js on lines 39..44

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    init: () => {
    console.log('Loading quickrefs...');
    getFileList(path.join(__dirname, 'references')).forEach((fn) => {
    references[path.basename(fn, '.txt')] = loadReferences(path.join(__dirname, 'references', fn));
    });
    Severity: Major
    Found in commands/quickref/quickref.js and 1 other location - About 2 hrs to fix
    commands/help/help.js on lines 28..33

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    embed.setColor('#4286f4')
    .setFooter(`Local Time: ${data.dateString}`)
    .setTitle(`Weather in ${data.location}`)
    .addField('Summary', data.summary)
    .addField('Temperature °C', `${data.temperatureC} °C`, true)
    Severity: Major
    Found in commands/weather/weather.js and 1 other location - About 1 hr to fix
    commands/weather/weather.js on lines 105..109

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    embed.setColor('#4286f4')
    .setFooter(`Local Time: ${data.dateString}`)
    .setTitle(`Weather in ${data.address}`)
    .addField('Summary', data.summary)
    .addField('Temperature', `${data.temperatureC} °C / ${data.temperatureF} °F`, true)
    Severity: Major
    Found in commands/weather/weather.js and 1 other location - About 1 hr to fix
    commands/weather/weather.js on lines 93..97

    Function getWeatherData has 41 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function getWeatherData(location) {
    const requestURL = darkskyEndpoint
    .replace('key', tokens.darksky)
    .replace('lat', location.coordinate.lat)
    .replace('lng', location.coordinate.lng);
    Severity: Minor
    Found in commands/weather/weather.js - About 1 hr to fix

      Function run has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

      run: (bot, message, cmdArgs) => {
      if (!cmdArgs) {
      const langList = availableLanguages.reduce((prev, x) => {
      let langEntry = `${prev}${prev ? '\n' : ''}- ${x}`;
      const aliases = Object.keys(langAliases)
      Severity: Minor
      Found in commands/eval/eval.js - About 1 hr to fix

      Function run has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      run(bot, message, cmdArgs) {
      if (!cmdArgs) {
      return true;
      }
       
       
      Severity: Minor
      Found in commands/pro/pro.js - About 1 hr to fix

        Function run has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        run: (bot, message, cmdArgs) => {
        let pbfLink = false;
         
        if (cmdArgs === 'random') {
        pbfLink = 'http://pbfcomics.com/random';
        Severity: Minor
        Found in commands/pbf/pbf.js - About 1 hr to fix

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

          onMessage() {
          return (message) => {
          // don't respond to own messages
          if (this.client.user.username === message.author.username) {
          return;
          Severity: Minor
          Found in TheAwesomeBot.js - About 1 hr to fix

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

            function processVote(type, bot, message, guild, member) {
            let voting = currentVotes[type][member.user.username];
             
            if (!voting) {
            // sets a timeout for this voting
            Severity: Minor
            Found in commands/vote/vote.js - About 1 hr to fix

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

              create: function handleCreateStream(bot, message, args) {
              let [, topic, link, user] = args.split(' '); // eslint-disable-line prefer-const
               
              if (!topic || !link) {
              return message.channel.sendMessage('err, please provide topic and link!');
              Severity: Minor
              Found in commands/stream/stream.js - About 1 hr to fix

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

                run(bot, message, cmdArgs) {
                if (!cmdArgs) {
                return true;
                }
                 
                 
                Severity: Minor
                Found in commands/pro/pro.js - About 1 hr to fix

                Function processVote has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                function processVote(type, bot, message, guild, member) {
                Severity: Minor
                Found in commands/vote/vote.js - About 35 mins to fix

                  Function createChannel has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  function createChannel(title, bot, message, topic, user) {
                  Severity: Minor
                  Found in commands/stream/stream.js - About 35 mins to fix

                    Function setTopicToLink has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                    function setTopicToLink(channel, link, bot, topic, user) {
                    Severity: Minor
                    Found in commands/stream/stream.js - About 35 mins to fix

                      Function handleCreateStream has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                      create: function handleCreateStream(bot, message, args) {
                      let [, topic, link, user] = args.split(' '); // eslint-disable-line prefer-const
                       
                      if (!topic || !link) {
                      return message.channel.sendMessage('err, please provide topic and link!');
                      Severity: Minor
                      Found in commands/stream/stream.js - About 35 mins to fix

                      Avoid too many return statements within this function.
                      Open

                      return false;
                      Severity: Major
                      Found in commands/vote/vote.js - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                        return false;
                        Severity: Major
                        Found in commands/vote/vote.js - About 30 mins to fix

                          Function infoRun has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                          function infoRun(bot, message, cmdArgs) {
                          if (cmdArgs) {
                          if (cmdArgs === 'contributors') {
                          const contributorsEmbed = new discord.RichEmbed();
                          contributorsEmbed.setColor('#4286f4')
                          Severity: Minor
                          Found in commands/info/info.js - About 25 mins to fix
                          Severity
                          Category
                          Status
                          Source
                          Language