haraka/haraka-plugin-headers

View on GitHub

Showing 5 of 5 total issues

Function from_match has 62 lines of code (exceeds 50 allowed). Consider refactoring.
Open

exports.from_match = function (next, connection) {
  const plugin = this

  // see if the header From matches the envelope FROM. There are valid
  // cases to not match (~10% of ham) but a non-match is much more
Severity: Major
Found in index.js - About 1 hr to fix

    Function mailing_list has 57 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    exports.mailing_list = function (next, connection) {
      const plugin = this
      if (!connection.transaction) return next()
    
      const mlms = {
    Severity: Major
    Found in index.js - About 1 hr to fix

      Function invalid_date has a Cognitive Complexity of 16 (exceeds 10 allowed). Consider refactoring.
      Open

      exports.invalid_date = function (next, connection) {
        const plugin = this
      
        // Assure Date header value is [somewhat] sane
        let msg_date = connection.transaction.header.get_all('Date')
      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 register has a Cognitive Complexity of 14 (exceeds 10 allowed). Consider refactoring.
      Open

      exports.register = function () {
        this.load_headers_ini()
      
        try {
          this.addrparser = require('address-rfc2822')
      Severity: Minor
      Found in index.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 from_match has a Cognitive Complexity of 12 (exceeds 10 allowed). Consider refactoring.
      Open

      exports.from_match = function (next, connection) {
        const plugin = this
      
        // see if the header From matches the envelope FROM. There are valid
        // cases to not match (~10% of ham) but a non-match is much more
      Severity: Minor
      Found in index.js - About 35 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

      Severity
      Category
      Status
      Source
      Language