Function constructor
has 140 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor (opts = {}) {
super();
this.uuid = utils.uuid();
this.connect_timeout = parseInt(opts.connect_timeout) || 30;
this.socket = opts.socket || line_socket.connect(opts.port, opts.host);
File smtp_client.js
has 373 lines of code (exceeds 250 allowed). Consider refactoring. Open
'use strict';
// SMTP client object and class. This allows every part of the client
// protocol to be hooked for different levels of control, such as
// smtp_forward and smtp_proxy queue plugins.
// It can use HostPool to get a connection to a pool of
Function get_client_plugin
has 97 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.get_client_plugin = (plugin, connection, c, callback) => {
// c = config
// Merge in authentication settings from smtp_forward/proxy.ini if present
// FIXME: config.auth could be changed when API isn't frozen
if (c.auth_type || c.auth_user || c.auth_pass) {
Function onCapabilitiesOutbound
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
exports.onCapabilitiesOutbound = (smtp_client, secured, connection, config, on_secured) => {
for (const line in smtp_client.response) {
if (/^XCLIENT/.test(smtp_client.response[line])) {
if (!smtp_client.xclient) {
smtp_client.send_command('XCLIENT', `ADDR=${connection.remote.ip}`);
- 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 get_client_plugin
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
exports.get_client_plugin = (plugin, connection, c, callback) => {
// c = config
// Merge in authentication settings from smtp_forward/proxy.ini if present
// FIXME: config.auth could be changed when API isn't frozen
if (c.auth_type || c.auth_user || c.auth_pass) {
- 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 onCapabilitiesOutbound
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.onCapabilitiesOutbound = (smtp_client, secured, connection, config, on_secured) => {
for (const line in smtp_client.response) {
if (/^XCLIENT/.test(smtp_client.response[line])) {
if (!smtp_client.xclient) {
smtp_client.send_command('XCLIENT', `ADDR=${connection.remote.ip}`);
Function get_hostport
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function get_hostport (connection, server, cfg) {
if (cfg.forwarding_host_pool) {
if (! server.notes.host_pool) {
connection.logwarn(`creating host_pool from ${cfg.forwarding_host_pool}`);
- 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
Avoid too many return
statements within this function. Open
return;
Avoid too many return
statements within this function. Open
return;
Avoid too many return
statements within this function. Open
return;
Avoid too many return
statements within this function. Open
return;