Showing 5 of 5 total issues
Function aliases
has a Cognitive Complexity of 20 (exceeds 10 allowed). Consider refactoring. Open
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
- 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 aliases
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
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
Avoid deeply nested control flow statements. Open
Open
} else if (cfg[`@${host}`]) {
// @domain match
match = `@${host}`
if (cfg[match].action) action = cfg[match].action
onMatch(match, action, match)
Avoid deeply nested control flow statements. Open
Open
if (cfg[match].action) action = cfg[match].action
Function _alias
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function _alias(plugin, connection, key, config, host) {