msimerson/Haraka

View on GitHub

Showing 655 of 655 total issues

Function load_acls has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

exports.load_acls = function () {
    const file_name = 'relay_acl_allow';

    // load with a self-referential callback
    this.acl_allow = this.config.get(file_name, 'list', () => {
Severity: Minor
Found in plugins/relay.js - About 25 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 hook_unrecognized_command has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

exports.hook_unrecognized_command = function (next, connection, params) {
    if (params[0] !== 'STATUS') return next();
    if (!connection.remote.is_local) return next(DENY, 'STATUS not allowed remotely');

    this.run(params[1], (err, result) => {
Severity: Minor
Found in plugins/status.js - About 25 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 load_helo_checks_ini has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

exports.load_helo_checks_ini = function () {

    const booleans = [
        '+skip.private_ip',
        '+skip.whitelist',
Severity: Minor
Found in plugins/helo.checks.js - About 25 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 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;

Severity: Minor
Found in plugins/bounce.js - About 25 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 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();

Severity: Minor
Found in plugins/bounce.js - About 25 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 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];
Severity: Minor
Found in plugins/bounce.js - About 25 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 endpoint has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

module.exports = function endpoint (addr, defaultPort) {
    try {
        if ('string' === typeof addr || 'number' === typeof addr) {
            addr = sockaddr(addr, {defaultPort});
            const match = /^(.*):([0-7]{3})$/.exec(addr.path || '');
Severity: Minor
Found in endpoint.js - About 25 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 loadHAProxyHosts has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function loadHAProxyHosts () {
    const hosts = config.get('haproxy_hosts', 'list', loadHAProxyHosts);
    const new_ipv4_hosts = [];
    const new_ipv6_hosts = [];
    for (let i=0; i<hosts.length; i++) {
Severity: Minor
Found in connection.js - About 25 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 stringify has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function stringify (obj) {
    let str = '';
    let key;
    for (key in obj) {
        let v = obj[key];
Severity: Minor
Found in logger.js - About 25 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 setupClient has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    static setupClient (self) {
        const ip = self.client.remoteAddress;
        if (!ip) {
            self.logdebug('setupClient got no IP address for this connection!');
            self.client.destroy();
Severity: Minor
Found in connection.js - About 25 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 constructor has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    constructor (addr) {
        if (addr.path) {
            this.path = addr.path;
            if (addr.mode) this.mode = addr.mode;
        }
Severity: Minor
Found in endpoint.js - About 25 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 cmd_internalcmd has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    cmd_internalcmd (line) {
        if (!this.remote.is_local) {
            return this.respond(501, "INTERNALCMD not allowed remotely");
        }
        const results = (String(line)).split(/ +/);
Severity: Minor
Found in connection.js - About 25 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 cmd_data has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    cmd_data (args) {
        // RFC 5321 Section 4.3.2
        // DATA does not accept arguments
        if (args) {
            this.errors++;
Severity: Minor
Found in connection.js - About 25 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 sort_mx has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function sort_mx (mx_list) {
    const sorted = mx_list.sort((a,b) => a.priority - b.priority);

    // This isn't a very good shuffle but it'll do for now.
    for (let i=0,l=sorted.length-1; i<l; i++) {
Severity: Minor
Found in outbound/hmail.js - About 25 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 _get_code has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    _get_code (pp) {

        if (this.hasPackageJson) {
            let packageDir = path.dirname(pp);
            if (/^win(32|64)/.test(process.platform)) {
Severity: Minor
Found in plugins.js - About 25 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