haraka/haraka-plugin-qmail-deliverable

View on GitHub

Showing 6 of 6 total issues

Function do_qmd_response has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

exports.do_qmd_response = function (qmd_res, connection, rcpt, next) {
  const txn = connection.transaction

  const [r_code, dst_type] = qmd_res

Severity: Minor
Found in index.js - About 2 hrs 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 decode_qmd_response has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

exports.decode_qmd_response = function (connection, hexnum) {
  connection.logprotocol(this, `HEXRV: ${hexnum}`)

  switch (hexnum) {
    case '11':
Severity: Minor
Found in index.js - About 1 hr to fix

    Function do_qmd_response has 41 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    exports.do_qmd_response = function (qmd_res, connection, rcpt, next) {
      const txn = connection.transaction
    
      const [r_code, dst_type] = qmd_res
    
    
    Severity: Minor
    Found in index.js - About 1 hr to fix

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

      exports.hook_get_mx = function (next, hmail, domain) {
        if (hmail.todo.notes.get('queue.wants') !== 'lmtp') return next()
      
        const mx = {
          using_lmtp: true,
      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 too many return statements within this function.
      Open

            if (connection.relaying) return do_relaying(this, txn, next)
      Severity: Major
      Found in index.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

              return next(DENYSOFT, 'Split transaction, retry soon')
        Severity: Major
        Found in index.js - About 30 mins to fix
          Severity
          Category
          Status
          Source
          Language