caffeinery/coffea

View on GitHub

Showing 81 of 81 total issues

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

module.exports = function () {
    return function (irc) {
        irc.sasl = {
            method: '',
            mechanism: function saslMechanism(mechanism, network, fn) {
Severity: Minor
Found in lib/plugins/cap-sasl.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 add has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

Client.prototype.add = function (info) {
    var stream, stream_id, streams = [];
    var _this = this;
    if (info instanceof Array) {
        // We've been passed multiple server information
Severity: Minor
Found in 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 parsePrefix has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

Parser.prototype._parseParams = function parsePrefix() {
    while (this.position < this.line.length) {
        this.space = this.line.indexOf(" ", this.position);

        // Trailing!
Severity: Minor
Found in lib/parser/parser.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 exports has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function () {
    return function (irc) {
        irc.identify = function (username, password, network, fn) {
            if (typeof network === 'function') {
              fn = network;
Severity: Minor
Found in lib/plugins/nickserv.js - About 1 hr to fix

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

    exports.emit = function (instance, network, event, data) {
        if (!data) {
            data = {};
        }
    
    
    Severity: Minor
    Found in lib/utils.js - About 1 hr to fix

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

      module.exports = function () {
          return function (irc) {
              /**
               * Quit the network.
               *
      Severity: Minor
      Found in lib/plugins/quit.js - About 1 hr to fix

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

        module.exports = function () {
            return function (irc) {
                irc.topic = function ircTopic(channel, topic, network, fn) {
                    var parse = utils.parseTarget(channel);
                    if (!network) { network = parse.network; }
        Severity: Minor
        Found in lib/plugins/topic.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 exports has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

        module.exports = function () {
            return function (irc) {
                // TODO: maybe we should put these into other plugins too?
                irc.pass = function ircPass(pass, network, fn) {
                    this.write('PASS ' + pass, network, fn);
        Severity: Minor
        Found in lib/plugins/core.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 exports has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

        module.exports = function () {
            return function (irc) {
                irc.nick = function ircNick(nick, network, fn) {
                    if (!network) network = '0';
                    this.networked_me[network] = this.getUser(nick, network);
        Severity: Minor
        Found in lib/plugins/nick.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 _setupSASL has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        Client.prototype._setupSASL = function (stream_id, info) {
            this.on('cap_ack', function (err, event) {
                if (event.capability === 'sasl') {
                    this.sasl.mechanism('PLAIN', stream_id);
                    if (info.sasl && info.sasl.account && info.sasl.password) {
        Severity: Minor
        Found in index.js - About 45 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

        Avoid deeply nested control flow statements.
        Open

                                        switch (mode) {
                                        case 'Y':
                                            channel.names[argument] = '!';
                                            break;
                                        case 'q':
        Severity: Major
        Found in lib/plugins/mode.js - About 45 mins to fix

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

                          if (msg.trailing.toLowerCase() === 'is using a secure connection') {
                              map[target] = map[target] || {};
                              user.secure = true;
                              map[target].secure = true;
                          }
          Severity: Minor
          Found in lib/plugins/whois.js and 1 other location - About 45 mins to fix
          lib/plugins/whois.js on lines 158..162

          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 50.

          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

                          if (msg.trailing.toLowerCase() === 'is a registered nick' || msg.trailing.toLowerCase() === 'is identified for this nick') {
                              map[target] = map[target] || {};
                              user.registered = true;
                              map[target].registered = true;
                          }
          Severity: Minor
          Found in lib/plugins/whois.js and 1 other location - About 45 mins to fix
          lib/plugins/whois.js on lines 169..173

          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 50.

          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

          Function parseTarget has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          exports.parseTarget = function (target_raw) {
              var target, network;
              if (typeof target_raw !== "string") {
                  // extract network from channel/user object
                  network = exports.extractNetwork(target_raw);
          Severity: Minor
          Found in lib/utils.js - About 45 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

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

          User.prototype.notice = function (msg) {
              this.client.notice(this.getNick(), msg, this.network);
          };
          Severity: Major
          Found in lib/plugins/user.js and 3 other locations - About 40 mins to fix
          lib/plugins/channel.js on lines 53..55
          lib/plugins/channel.js on lines 57..59
          lib/plugins/user.js on lines 96..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 49.

          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

                          utils.emit(irc, network, 'quit', {
                              "user": user,
                              "message": msg.trailing,
                              "tags": msg.tags ? msg.tags : []
                          });
          Severity: Minor
          Found in lib/plugins/quit.js and 1 other location - About 40 mins to fix
          lib/plugins/names.js on lines 78..82

          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 49.

          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 4 locations. Consider refactoring.
          Open

          User.prototype.say = function (msg) {
              this.client.send(this.getNick(), msg, this.network);
          };
          Severity: Major
          Found in lib/plugins/user.js and 3 other locations - About 40 mins to fix
          lib/plugins/channel.js on lines 53..55
          lib/plugins/channel.js on lines 57..59
          lib/plugins/user.js on lines 92..94

          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 49.

          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

                          utils.emit(irc, network, 'names', {
                              "channel": channel,
                              "names": nameReply[channelName],
                              "tags": msg.tags ? msg.tags : []
                          });
          Severity: Minor
          Found in lib/plugins/names.js and 1 other location - About 40 mins to fix
          lib/plugins/quit.js on lines 34..38

          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 49.

          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 4 locations. Consider refactoring.
          Open

          Channel.prototype.say = function (msg) {
              this.client.send(this.getName(), msg, this.network);
          };
          Severity: Major
          Found in lib/plugins/channel.js and 3 other locations - About 40 mins to fix
          lib/plugins/channel.js on lines 53..55
          lib/plugins/user.js on lines 92..94
          lib/plugins/user.js on lines 96..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 49.

          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 4 locations. Consider refactoring.
          Open

          Channel.prototype.notice = function (msg) {
              this.client.notice(this.getName(), msg, this.network);
          };
          Severity: Major
          Found in lib/plugins/channel.js and 3 other locations - About 40 mins to fix
          lib/plugins/channel.js on lines 57..59
          lib/plugins/user.js on lines 92..94
          lib/plugins/user.js on lines 96..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 49.

          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

          Severity
          Category
          Status
          Source
          Language