Showing 51 of 68 total issues
Function mech_ip
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
Open
async mech_ip(qualifier, args) {
const cidr = args.substr(1)
const match = /^([^/ ]+)(?:\/(\d+))?$/.exec(cidr)
if (!match) return this.SPF_NONE
- 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 mech_include
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async mech_include(qualifier, args) {
const domain = args.substr(1)
// Avoid circular references
if (this.been_there[domain]) {
this.log_debug(`circular reference detected: ${domain}`)
Function helo_spf
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
Open
exports.helo_spf = async function (next, connection, helo) {
const plugin = this
// bypass auth'ed or relay'ing hosts if told to
const skip_reason = this.skip_hosts(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 return_results
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
next,
connection,
spf,
scope,
result,
Function log_result
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
exports.log_result = function (connection, scope, host, mfrom, result, ip) {
Avoid deeply nested control flow statements. Open
Open
if (this.ipaddr.match(range, cidr)) {
this.log_debug(
`mech_mx: ${this.ip} => ${address}/${cidr}: MATCH!`,
)
return this.return_const(qualifier)
Avoid too many return
statements within this function. Open
Open
return next(DENY, text)
Avoid too many return
statements within this function. Open
Open
if (result && result !== this.SPF_NONE) return result
Avoid too many return
statements within this function. Open
Open
return this.SPF_PERMERROR
Avoid too many return
statements within this function. Open
Open
return this.return_const(qualifier)
Avoid too many return
statements within this function. Open
Open
return next()
Avoid too many return
statements within this function. Open
Open
if (pending === 0) return this.SPF_NONE
Avoid too many return
statements within this function. Open
Open
return this.SPF_PERMERROR
Avoid too many return
statements within this function. Open
Open
return this.SPF_PERMERROR
Avoid too many return
statements within this function. Open
Open
if (plugin.cfg.relay.context === 'sender') return ch_cb(null, result)
Avoid too many return
statements within this function. Open
Open
return this.SPF_NONE
Avoid too many return
statements within this function. Open
Open
if (timeout) return
Avoid too many return
statements within this function. Open
Open
return next()
Avoid too many return
statements within this function. Open
Open
return next(DENY, `${msgpre} SPF Permanent Error`)
Avoid too many return
statements within this function. Open
Open
return next()