haraka/haraka-plugin-aliases

View on GitHub

Showing 5 of 5 total issues

Function aliases has a Cognitive Complexity of 20 (exceeds 10 allowed). Consider refactoring.
Open

exports.aliases = function (next, connection, params) {
  const cfg = this.cfg
  const rcpt = params[0].address()
  const user = params[0].user
  const host = params[0].host
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 aliases has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

exports.aliases = function (next, connection, params) {
  const cfg = this.cfg
  const rcpt = params[0].address()
  const user = params[0].user
  const host = params[0].host
Severity: Minor
Found in index.js - About 1 hr to fix

    Avoid deeply nested control flow statements.
    Open

      } else if (cfg[`@${host}`]) {
        // @domain match
        match = `@${host}`
        if (cfg[match].action) action = cfg[match].action
        onMatch(match, action, match)
    Severity: Major
    Found in index.js - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

          if (cfg[match].action) action = cfg[match].action
      Severity: Major
      Found in index.js - About 45 mins to fix

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

        function _alias(plugin, connection, key, config, host) {
        Severity: Minor
        Found in index.js - About 35 mins to fix
          Severity
          Category
          Status
          Source
          Language