Showing 18 of 22 total issues
Function bounce_spf
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.bounce_spf = function (next, connection) {
if (!this.cfg.check.bounce_spf) return next()
if (!this.has_null_sender(connection)) return next()
const txn = connection?.transaction
File index.js
has 286 lines of code (exceeds 250 allowed). Consider refactoring. Open
// bounce tests
const tlds = require('haraka-tld')
const { SPF } = require('haraka-plugin-spf')
const net_utils = require('haraka-net-utils')
Function non_local_msgid
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
exports.non_local_msgid = function (next, connection) {
if (!this.cfg.check.non_local_msgid) return next()
if (!this.has_null_sender(connection)) return next()
const transaction = connection?.transaction
- Read upRead up
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 non_local_msgid
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.non_local_msgid = function (next, connection) {
if (!this.cfg.check.non_local_msgid) return next()
if (!this.has_null_sender(connection)) return next()
const transaction = connection?.transaction
Function bounce_spf
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
exports.bounce_spf = function (next, connection) {
if (!this.cfg.check.bounce_spf) return next()
if (!this.has_null_sender(connection)) return next()
const txn = connection?.transaction
- Read upRead up
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 single_recipient
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.single_recipient = function (next, connection) {
if (!this?.cfg?.check?.single_recipient) return next()
if (!this.has_null_sender(connection)) return next()
const { transaction, relaying, remote } = connection
Avoid too many return
statements within this function. Open
if (!this.cfg.reject.non_local_msgid) return next()
Avoid too many return
statements within this function. Open
return next()
Avoid too many return
statements within this function. Open
if (!this.cfg.reject.single_recipient) return next()
Avoid too many return
statements within this function. Open
return next(DENY, 'bounce with non-empty Return-Path (RFC 3834)')
Avoid too many return
statements within this function. Open
if (!this.cfg.reject.non_local_msgid) return next()
Avoid too many return
statements within this function. Open
if (!this.cfg.reject.bounce_spf) return run_cb()
Avoid too many return
statements within this function. Open
return next(DENY, `bounce with invalid Message-ID, I didn't send it.`)
Avoid too many return
statements within this function. Open
return next(
DENY,
`bounce Message-ID without valid domain, I didn't send it.`,
)
Avoid too many return
statements within this function. Open
return next(
DENY,
`bounce without Message-ID in headers, unable to verify that I sent it`,
)
Function single_recipient
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
exports.single_recipient = function (next, connection) {
if (!this?.cfg?.check?.single_recipient) return next()
if (!this.has_null_sender(connection)) return next()
const { transaction, relaying, remote } = connection
- Read upRead up
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 bad_rcpt
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
exports.bad_rcpt = function (next, connection) {
if (!this.cfg.check.bad_rcpt) return next()
if (!this.has_null_sender(connection)) return next()
if (!this.cfg.invalid_addrs) return next()
- Read upRead up
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 find_received_headers
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function find_received_headers(ips, body, connection, self) {
if (!body) return
let match
while ((match = received_re.exec(body.bodytext))) {
const ip = match[1]
- Read upRead up
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"