caffeinery/coffea

View on GitHub

Showing 81 of 81 total issues

Function ircSend has 44 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        irc.send = function ircSend(target, msg, network, fn) {
            // if network is the callback, then it wasn't defined either
            // we usually don't need this in every function because client.write does it
            // in this case it's needed because we check for !network later
            if (typeof network === 'function') {
Severity: Minor
Found in lib/plugins/privmsg.js - About 1 hr to fix

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

    module.exports = function () {
        return function (irc) {
            irc.capLs = function capLs(network, fn) {
                irc.write("CAP LS", network, fn);
            };
    Severity: Minor
    Found in lib/plugins/cap.js - About 1 hr to fix

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

      module.exports = function () {
          return function (irc) {
              /**
               * 005 RPL_ISUPPORT Support for coffea.
               *
      Severity: Minor
      Found in lib/plugins/005.js - About 1 hr to fix

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

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

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

          module.exports = function () {
              return function (irc) {
                  irc.whoisCallbacks = {};
          
                  /**
          Severity: Minor
          Found in lib/plugins/whois.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 39 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          module.exports = function () {
              var channelCache = {},
                  channelList = {};
              return function (irc) {
          
          
          Severity: Minor
          Found in lib/plugins/channel.js - About 1 hr to fix

            Function exports has 37 lines of code (exceeds 25 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 1 hr to fix

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

              module.exports = function () {
                  return function (irc) {
                      irc.on('data', function (err, msg) {
                          var network = msg.network;
                          if (msg.command === 'JOIN' && irc.capabilities.indexOf('extended-join') > -1) {
              Severity: Minor
              Found in lib/plugins/cap-extended-join.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 a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

              module.exports = function () {
                  return function (irc) {
                      irc.part = function ircPart(channels, msg, network, fn) {
                          if (typeof msg === 'function') {
                              fn = msg;
              Severity: Minor
              Found in lib/plugins/part.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 write has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

              Client.prototype.write = function (str, network, fn) {
                  // if network is the callback, then it wasn't defined either
                  if (typeof(network) === 'function') {
                      fn = network;
                      network = undefined;
              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 exports has 35 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

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

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

                module.exports = function () {
                    var serverInfo = {};
                    return function (irc) {
                
                        irc.getServerInfo = function (network) {
                Severity: Minor
                Found in lib/plugins/server.js - About 1 hr to fix

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

                  module.exports = function () {
                      return function (irc) {
                          irc.kick = function ircKick(channels, nicks, msg, network, fn) {
                              if (typeof msg === 'function') {
                                  fn = msg;
                  Severity: Minor
                  Found in lib/plugins/kick.js - About 1 hr to fix

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

                    module.exports = function () {
                        return function (irc) {
                            function emitCommand(event, text) {
                                var message = irc.splitString(text);
                                debug("message: %s", JSON.stringify(message));
                    Severity: Minor
                    Found in lib/plugins/command.js - About 1 hr to fix

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

                                  var user = _.find(userCache, function (usr) {
                                      if (network) {
                                          return (usr.getNick() === nick) && (usr.getNetwork() === network);
                                      } else {
                                          return usr.getNick() === nick;
                      Severity: Major
                      Found in lib/plugins/user.js and 1 other location - About 1 hr to fix
                      lib/plugins/channel.js on lines 102..105

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

                      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

                                  var channel = _.find(channelCache[network], function (chan) {
                                      if (network) { return (chan.getName() === name) && (chan.getNetwork() === network); }
                                      else { return chan.getName() === name; }
                                  });
                      Severity: Major
                      Found in lib/plugins/channel.js and 1 other location - About 1 hr to fix
                      lib/plugins/user.js on lines 116..122

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

                      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 exports has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                      Open

                      module.exports = function () {
                          return function (irc) {
                              irc.kick = function ircKick(channels, nicks, msg, network, fn) {
                                  if (typeof msg === 'function') {
                                      fn = msg;
                      Severity: Minor
                      Found in lib/plugins/kick.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

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

                                              utils.emit(irc, network, 'mode', {
                                                  "channel": channel,
                                                  "by": by,
                                                  "argument": argument,
                                                  "adding": adding,
                      Severity: Major
                      Found in lib/plugins/mode.js and 1 other location - About 1 hr to fix
                      lib/plugins/mode.js on lines 157..164

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

                      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, 'mode', {
                                                  "channel": channel,
                                                  "by": by,
                                                  "argument": modeArg,
                                                  "adding": adding,
                      Severity: Major
                      Found in lib/plugins/mode.js and 1 other location - About 1 hr to fix
                      lib/plugins/mode.js on lines 141..148

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

                      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 exports has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                      Open

                      module.exports = function () {
                          return function (irc) {
                              irc.on('data', function (err, msg) {
                                  var network = msg.network;
                                  if (msg.command === 'RPL_AWAY') {
                      Severity: Minor
                      Found in lib/plugins/away.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

                      Severity
                      Category
                      Status
                      Source
                      Language