silentrob/superscript

View on GitHub

Showing 67 of 92 total issues

Function botHandle has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const botHandle = function botHandle(err, bot) {
  const receiveData = function receiveData(socket, bot, data) {
    // Handle incoming messages.
    let message = `${data}`;

Severity: Minor
Found in clients/telnet.js - About 1 hr to fix

    Function letterLookup has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const letterLookup = function letterLookup(cb) {
      let reply = '';
    
      const lastWord = this.message.lemWords.slice(-1)[0];
      debug('--LastWord', lastWord);
    Severity: Minor
    Found in src/plugins/alpha.js - About 1 hr to fix

      Function eachGambitHandle has 36 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const eachGambitHandle = async function eachGambitHandle(gambit, message, options) {
        const plugins = options.system.plugins;
        const scope = options.system.scope;
        const topic = options.topic || 'reply';
        const chatSystem = options.system.chatSystem;
      Severity: Minor
      Found in src/bot/getReply/helpers.js - About 1 hr to fix

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

        const inlineRedirect = async function inlineRedirect(triggerTarget, options) {
          debug.verbose(`Inline redirection to: '${triggerTarget}'`);
        
          // if we have a special topic, reset it to the previous one
          // in order to preserve the context for inline redirection
        Severity: Minor
        Found in src/bot/reply/inlineRedirect.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 postParse has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const postParse = function postParse(regexp, message, user) {
          if (_.isNull(regexp)) {
            return null;
          }
        
        
        Severity: Minor
        Found in src/bot/postParse.js - About 1 hr to fix

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

          const findConversationTopics = async function findConversationTopics(pendingTopics, user, chatSystem, conversationTimeout) {
            if (user.history.length === 0) {
              return pendingTopics;
            }
          
          
          Severity: Minor
          Found in src/bot/getReply/getPendingTopics.js - About 1 hr to fix

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

            const processReplyTags = async function processReplyTags(replyObj, options) {
              debug.verbose('Depth: ', options.depth);
            
              let replyString = replyObj.reply.reply;
              debug.info(`Reply before processing reply tags: "${replyString}"`);
            Severity: Minor
            Found in src/bot/processTags.js - About 1 hr to fix

              Function processStars has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

              const processStars = function processStars(match, gambit, topic) {
                debug.verbose(`Match found: ${gambit.input} in topic: ${topic}`);
                const stars = [];
                if (match.length > 1) {
                  for (let j = 1; j < match.length; j++) {
              Severity: Minor
              Found in src/bot/getReply/helpers.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 findMatches has 30 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const findMatches = async function findMatches(pendingTopics, messageObject, options) {
                debug.verbose(`Found pending topics/conversations: ${JSON.stringify(pendingTopics)}`);
              
                const replies = [];
                let stopSearching = false;
              Severity: Minor
              Found in src/bot/getReply/index.js - About 1 hr to fix

                Function inlineRedirect has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                const inlineRedirect = async function inlineRedirect(triggerTarget, options) {
                  debug.verbose(`Inline redirection to: '${triggerTarget}'`);
                
                  // if we have a special topic, reset it to the previous one
                  // in order to preserve the context for inline redirection
                Severity: Minor
                Found in src/bot/reply/inlineRedirect.js - About 1 hr to fix

                  Function eachTopicItor has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    const eachTopicItor = function eachTopicItor(topicName, nextTopic) {
                      const topic = data.topics[topicName];
                      debug.verbose(`Find or create topic with name '${topicName}'`);
                      const topicProperties = {
                        name: topic.name,
                  Severity: Minor
                  Found in src/bot/db/import.js - About 1 hr to fix

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

                    const findConversationTopics = async function findConversationTopics(pendingTopics, user, chatSystem, conversationTimeout) {
                      if (user.history.length === 0) {
                        return pendingTopics;
                      }
                    
                    
                    Severity: Minor
                    Found in src/bot/getReply/getPendingTopics.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 doesMatch has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                    export const doesMatch = async function doesMatch(gambit, message, options) {
                      if (gambit.conditions && gambit.conditions.length > 0) {
                        const conditionsMatch = processConditions(gambit.conditions, options);
                        if (!conditionsMatch) {
                          debug.verbose('Conditions did not match');
                    Severity: Minor
                    Found in src/bot/getReply/helpers.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 matchItorHandle has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                    const matchItorHandle = async function matchItorHandle(match, message, options) {
                      const system = options.system;
                      options.message = message;
                    
                      debug.verbose('Match itor: ', match.gambit);
                    Severity: Minor
                    Found in src/bot/getReply/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 processCustomFunction has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    const processCustomFunction = async function processCustomFunction(tag, replyObj, options) {
                      if (tag.functionArgs === null) {
                        debug.verbose(`Processing custom function: ^${tag.functionName}()`);
                        return customFunction(tag.functionName, [], replyObj, options);
                      }
                    Severity: Minor
                    Found in src/bot/processTags.js - About 1 hr to fix

                      Function doesMatch has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export const doesMatch = async function doesMatch(gambit, message, options) {
                        if (gambit.conditions && gambit.conditions.length > 0) {
                          const conditionsMatch = processConditions(gambit.conditions, options);
                          if (!conditionsMatch) {
                            debug.verbose('Conditions did not match');
                      Severity: Minor
                      Found in src/bot/getReply/helpers.js - About 1 hr to fix

                        Function createReplyModel has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        const createReplyModel = function createReplyModel(db) {
                          const replySchema = new mongoose.Schema({
                            id: { type: String, index: true, default: Utils.genId() },
                            reply: { type: String, required: '{reply} is required.' },
                            keep: { type: Boolean, default: false },
                        Severity: Minor
                        Found in src/bot/db/models/reply.js - About 1 hr to fix

                          Function filterRepliesByFunction has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                          Open

                          const filterRepliesByFunction = async function filterRepliesByFunction(potentialReplies, options) {
                            const bits = await Promise.all(potentialReplies.map(async (potentialReply) => {
                              const system = options.system;
                          
                              // We support a single filter function in the reply
                          Severity: Minor
                          Found in src/bot/getReply/filterFunction.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

                          Function eachGambitHandle has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                          Open

                          const eachGambitHandle = async function eachGambitHandle(gambit, message, options) {
                            const plugins = options.system.plugins;
                            const scope = options.system.scope;
                            const topic = options.topic || 'reply';
                            const chatSystem = options.system.chatSystem;
                          Severity: Minor
                          Found in src/bot/getReply/helpers.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

                          Function wordLength has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                          Open

                          const wordLength = function wordLength(cap, cb) {
                            if (typeof cap === 'string') {
                              const parts = cap.split(' ');
                              if (parts.length === 1) {
                                cb(null, cap.length);
                          Severity: Minor
                          Found in src/plugins/alpha.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