botwillacceptanything/botwillacceptanything

View on GitHub
lib/conversation.js

Summary

Maintainability
F
4 days
Test Coverage

File conversation.js has 685 lines of code (exceeds 250 allowed). Consider refactoring.
Open

(function() {
  'use strict';

    if(!String.prototype.endsWith) {
        String.prototype.endsWith = function(searchString, position) {
Severity: Major
Found in lib/conversation.js - About 1 day to fix

    Function react has 123 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        Conversation.prototype.react = function(word) {
            if(this.muted) {
                word = word.toLowerCase();
                if(word === this.nick + '!' || (
                    word.indexOf(this.nick) !== -1 && (
    Severity: Major
    Found in lib/conversation.js - About 4 hrs to fix

      Function positiveReaction has 98 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          Conversation.prototype.positiveReaction = function(string) {
          var sentences;
              var words = {
                  description : [
                      'cool',                'great',        'marvelous',
      Severity: Major
      Found in lib/conversation.js - About 3 hrs to fix

        Function negativeReaction has 94 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            Conversation.prototype.negativeReaction = function(string) {
            var sentences;
                var words = {
                    jabbering : [
                        'jabbering',         'spiel',        'stories',
        Severity: Major
        Found in lib/conversation.js - About 3 hrs to fix

          Function hornyReaction has 59 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              Conversation.prototype.hornyReaction = function(word) {
                  if(isNo(word)) {
                      this.horny = false;
                      this.postGreet(word);
                      this.emit('say', 'okay :(');
          Severity: Major
          Found in lib/conversation.js - About 2 hrs to fix

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

                Conversation.prototype.shutup = function(word) {
                var self = this;
                    word = word.toLowerCase();
                    var regexSec = /([0-9]+[\.,]?[0-9]*?)\s?se?c?o?n?d?s?/;
                    var regexMin = /([0-9]+[\.,]?[0-9]*?)\s?mi?n?u?t?e?s?/;
            Severity: Minor
            Found in lib/conversation.js - About 1 hr to fix

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

                  Conversation.prototype.greet = function() {
                      var words = {
                          botActions : [
                              'like',             'love',         'appreciate'
                          ],
              Severity: Minor
              Found in lib/conversation.js - About 1 hr to fix

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

                    function instrument(strings, words, person) {
                        var regex = /\{\{(.*?)\}\}/;
                        var res;
                        var string = rd(strings);
                        while((res = regex.exec(string)) !== null) {
                Severity: Minor
                Found in lib/conversation.js - About 1 hr to fix

                  Consider simplifying this complex logical expression.
                  Open

                              if(word === this.nick + '!' || (
                                  word.indexOf(this.nick) !== -1 && (
                                      word.indexOf('wake up') !== -1 ||
                                      word.indexOf('wakeup') !== -1 ||
                                      word.indexOf('unmute') !== -1 ||
                  Severity: Major
                  Found in lib/conversation.js - About 1 hr to fix

                    Avoid deeply nested control flow statements.
                    Open

                                    if(res.length >= 2) {
                                        self.sleepFor(parseFloat(res)*60*60);
                                    }
                                    else {
                                        self.didntUnderstand();
                    Severity: Major
                    Found in lib/conversation.js - About 45 mins to fix

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

                              else if(isStatement(string)) {
                                  if(Math.random() < STATEMENT_COMMENT_THRESHOLD) {
                                      sentences = [
                                          '{{sadSmiley}}',
                                          '{{sadSmiley}} {{sadSmiley}}',
                      Severity: Major
                      Found in lib/conversation.js and 1 other location - About 1 hr to fix
                      lib/conversation.js on lines 613..634

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 56.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

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

                              else if(isStatement(string)) {
                                  if(Math.random() < STATEMENT_COMMENT_THRESHOLD) {
                                      sentences = [
                                          '{{happySmiley}}',
                                          'That\'s {{description}}',
                      Severity: Major
                      Found in lib/conversation.js and 1 other location - About 1 hr to fix
                      lib/conversation.js on lines 708..732

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 56.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

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

                                          word.indexOf('wake up') !== -1 ||
                                          word.indexOf('wakeup') !== -1 ||
                                          word.indexOf('unmute') !== -1 ||
                                          word.indexOf('say') !== -1 ||
                      Severity: Minor
                      Found in lib/conversation.js and 1 other location - About 50 mins to fix
                      lib/conversation.js on lines 95..98

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 52.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

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

                              return string.indexOf('horny') !== -1 ||
                                  string.indexOf('sex') !== -1 ||
                                  string.indexOf('fuck') !== -1 ||
                                  string.match(/.*?dirty.*?talk.*?/) !== null ||
                      Severity: Minor
                      Found in lib/conversation.js and 1 other location - About 50 mins to fix
                      lib/conversation.js on lines 261..264

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 52.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

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

                                      string = string.substr(0, index) + val +
                                string.substr(index + group.length, string.length);
                      Severity: Minor
                      Found in lib/conversation.js and 1 other location - About 30 mins to fix
                      lib/conversation.js on lines 136..137

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 45.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

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

                                      string = string.substr(0, index) + person +
                                string.substr(index + group.length, string.length);
                      Severity: Minor
                      Found in lib/conversation.js and 1 other location - About 30 mins to fix
                      lib/conversation.js on lines 146..147

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 45.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      There are no issues that match your filters.

                      Category
                      Status