msimerson/Haraka

View on GitHub
connection.js

Summary

Maintainability
F
3 wks
Test Coverage

File connection.js has 1689 lines of code (exceeds 250 allowed). Consider refactoring.
Open

'use strict';
// a single connection

// node.js built-in libs
const dns         = require('dns');
Severity: Major
Found in connection.js - About 4 days to fix

    Connection has 64 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Connection {
        constructor (client, server, cfg) {
            this.client = client;
            this.server = server;
            this.cfg = cfg;
    Severity: Major
    Found in connection.js - About 1 day to fix

      Function _process_data has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
      Open

          _process_data () {
              // We *must* detect disconnected connections here as the state
              // only transitions to states.CMD in the respond function below.
              // Otherwise if multiple commands are pipelined and then the
              // connection is dropped; we'll end up in the function forever.
      Severity: Minor
      Found in connection.js - About 6 hrs 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 process_line has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
      Open

          process_line (line) {
      
              if (this.state >= states.DISCONNECTING) {
                  if (logger.would_log(logger.LOGPROTOCOL)) {
                      this.logprotocol(`C: (after-disconnect): ${this.current_line}`, {'state': this.state});
      Severity: Minor
      Found in connection.js - About 4 hrs 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 _process_data has 87 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          _process_data () {
              // We *must* detect disconnected connections here as the state
              // only transitions to states.CMD in the respond function below.
              // Otherwise if multiple commands are pipelined and then the
              // connection is dropped; we'll end up in the function forever.
      Severity: Major
      Found in connection.js - About 3 hrs to fix

        Function constructor has 83 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            constructor (client, server, cfg) {
                this.client = client;
                this.server = server;
                this.cfg = cfg;
        
        
        Severity: Major
        Found in connection.js - About 3 hrs to fix

          Function process_line has 74 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              process_line (line) {
          
                  if (this.state >= states.DISCONNECTING) {
                      if (logger.would_log(logger.LOGPROTOCOL)) {
                          this.logprotocol(`C: (after-disconnect): ${this.current_line}`, {'state': this.state});
          Severity: Major
          Found in connection.js - About 2 hrs to fix

            Function queue_outbound_respond has 74 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                queue_outbound_respond (retval, msg) {
                    if (!msg) msg = this.queue_msg(retval, msg) || 'Message Queued';
                    this.store_queue_result(retval, msg);
                    msg = `${msg} (${this.transaction.uuid})`;
                    if (retval !== constants.ok) {
            Severity: Major
            Found in connection.js - About 2 hrs to fix

              Function respond has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
              Open

                  respond (code, msg, func) {
                      let uuid = '';
                      let messages;
              
                      if (this.state === states.DISCONNECTED) {
              Severity: Minor
              Found in connection.js - About 2 hrs 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 set has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
              Open

                  set (prop_str, val) {
                      if (arguments.length === 3) {
                          prop_str = `${arguments[0]}.${arguments[1]}`;
                          val = arguments[2];
                      }
              Severity: Minor
              Found in connection.js - About 2 hrs 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 67 lines of code (exceeds 25 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: Major
              Found in connection.js - About 2 hrs to fix

                Function rcpt_respond has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    rcpt_respond (retval, msg) {
                        if (retval === constants.cont && this.relaying) {
                            retval = constants.ok;
                        }
                
                
                Severity: Major
                Found in connection.js - About 2 hrs to fix

                  Function cmd_mail has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      cmd_mail (line) {
                          if (!this.hello.host) {
                              this.errors++;
                              return this.respond(503, 'Use EHLO/HELO before MAIL');
                          }
                  Severity: Major
                  Found in connection.js - About 2 hrs to fix

                    Function cmd_proxy has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        cmd_proxy (line) {
                    
                            if (!this.proxy.allowed) {
                                this.respond(421, `PROXY not allowed from ${this.remote.ip}`);
                                return this.disconnect();
                    Severity: Major
                    Found in connection.js - About 2 hrs to fix

                      Function data_post_respond has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          data_post_respond (retval, msg) {
                              if (!this.transaction) return;
                              this.transaction.data_post_delay = (Date.now() - this.transaction.data_post_start)/1000;
                              const mid = this.transaction.header.get('Message-ID') || '';
                              this.lognotice(
                      Severity: Major
                      Found in connection.js - About 2 hrs to fix

                        Function mail_respond has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            mail_respond (retval, msg) {
                                const self = this;
                                if (!this.transaction) {
                                    this.logerror("mail_respond found no transaction!");
                                    return;
                        Severity: Major
                        Found in connection.js - About 2 hrs to fix

                          Function queue_respond has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              queue_respond (retval, msg) {
                                  if (!msg) msg = this.queue_msg(retval, msg);
                                  this.store_queue_result(retval, msg);
                                  msg = `${msg} (${this.transaction.uuid})`;
                          
                          
                          Severity: Major
                          Found in connection.js - About 2 hrs to fix

                            Function respond has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                respond (code, msg, func) {
                                    let uuid = '';
                                    let messages;
                            
                                    if (this.state === states.DISCONNECTED) {
                            Severity: Major
                            Found in connection.js - About 2 hrs to fix

                              Function rcpt_ok_respond has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  rcpt_ok_respond (retval, msg) {
                                      if (!this.transaction) {
                                          this.results.add(this, {err: 'rcpt_ok_respond found no transaction'});
                                          return;
                                      }
                              Severity: Minor
                              Found in connection.js - About 1 hr to fix

                                Function cmd_mail has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    cmd_mail (line) {
                                        if (!this.hello.host) {
                                            this.errors++;
                                            return this.respond(503, 'Use EHLO/HELO before MAIL');
                                        }
                                Severity: Minor
                                Found in connection.js - About 1 hr 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_rcpt has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    cmd_rcpt (line) {
                                        if (!this.transaction || !this.transaction.mail_from) {
                                            this.errors++;
                                            return this.respond(503, "Use MAIL before RCPT");
                                        }
                                Severity: Minor
                                Found in connection.js - About 1 hr to fix

                                  Function ehlo_respond has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      ehlo_respond (retval, msg) {
                                  
                                          switch (retval) {
                                              case constants.deny:
                                                  this.respond(550, msg || "EHLO denied", () => {
                                  Severity: Minor
                                  Found in connection.js - About 1 hr to fix

                                    Function set has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        set (prop_str, val) {
                                            if (arguments.length === 3) {
                                                prop_str = `${arguments[0]}.${arguments[1]}`;
                                                val = arguments[2];
                                            }
                                    Severity: Minor
                                    Found in connection.js - About 1 hr to fix

                                      Function cmd_rcpt has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                          cmd_rcpt (line) {
                                              if (!this.transaction || !this.transaction.mail_from) {
                                                  this.errors++;
                                                  return this.respond(503, "Use MAIL before RCPT");
                                              }
                                      Severity: Minor
                                      Found in connection.js - About 1 hr 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 connect_respond has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                          connect_respond (retval, msg) {
                                              // RFC 5321 Section 4.3.2 states that the only valid SMTP codes here are:
                                              // 220 = Service ready
                                              // 554 = Transaction failed (no SMTP service here)
                                              // 421 = Service shutting down and closing transmission channel
                                      Severity: Minor
                                      Found in connection.js - About 1 hr to fix

                                        Function lookup_rdns_respond has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                                        Open

                                            lookup_rdns_respond (retval, msg) {
                                                switch (retval) {
                                                    case constants.ok:
                                                        this.set('remote', 'host', (msg || 'Unknown'));
                                                        this.set('remote', 'info', (this.remote.info || this.remote.host));
                                        Severity: Minor
                                        Found in connection.js - About 1 hr to fix

                                          Function data_respond has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                                          Open

                                              data_respond (retval, msg) {
                                                  let cont = 0;
                                                  switch (retval) {
                                                      case constants.deny:
                                                          this.respond(554, msg || "Message denied", () => {
                                          Severity: Minor
                                          Found in connection.js - About 1 hr to fix

                                            Function data_done has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                            Open

                                                data_done () {
                                                    this.pause();
                                                    this.totalbytes += this.transaction.data_bytes;
                                            
                                                    // Check message size limit
                                            Severity: Minor
                                            Found in connection.js - About 1 hr to fix

                                              Function accumulate_data has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                              Open

                                                  accumulate_data (line) {
                                              
                                                      this.transaction.data_bytes += line.length;
                                              
                                                      // Look for .\r\n
                                              Severity: Minor
                                              Found in connection.js - About 1 hr to fix

                                                Function connect_respond has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                                Open

                                                    connect_respond (retval, msg) {
                                                        // RFC 5321 Section 4.3.2 states that the only valid SMTP codes here are:
                                                        // 220 = Service ready
                                                        // 554 = Transaction failed (no SMTP service here)
                                                        // 421 = Service shutting down and closing transmission channel
                                                Severity: Minor
                                                Found in connection.js - About 1 hr 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 rcpt_respond has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                                Open

                                                    rcpt_respond (retval, msg) {
                                                        if (retval === constants.cont && this.relaying) {
                                                            retval = constants.ok;
                                                        }
                                                
                                                
                                                Severity: Minor
                                                Found in connection.js - About 1 hr 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 vrfy_respond has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                                Open

                                                    vrfy_respond (retval, msg) {
                                                        switch (retval) {
                                                            case constants.deny:
                                                                this.respond(550, msg || "Access Denied", () => {
                                                                    this.reset_transaction();
                                                Severity: Minor
                                                Found in connection.js - About 1 hr to fix

                                                  Function helo_respond has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                                                  Open

                                                      helo_respond (retval, msg) {
                                                          switch (retval) {
                                                              case constants.deny:
                                                                  this.respond(550, msg || "HELO denied", () => {
                                                                      this.set('hello', 'verb', null);
                                                  Severity: Minor
                                                  Found in connection.js - About 1 hr to fix

                                                    Function auth_results has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                                    Open

                                                        auth_results (message) {
                                                            // http://tools.ietf.org/search/rfc7001
                                                            const has_tran = !!((this.transaction?.notes));
                                                    
                                                            // initialize connection note
                                                    Severity: Minor
                                                    Found in connection.js - About 55 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

                                                    Avoid deeply nested control flow statements.
                                                    Open

                                                                    if (valid) {
                                                                        // Valid PIPELINING
                                                                        // We *don't want to process this yet otherwise the
                                                                        // current_data buffer will be lost.  The respond()
                                                                        // function will call this function again once it
                                                    Severity: Major
                                                    Found in connection.js - About 45 mins to fix

                                                      Function disconnect_respond has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                                      Open

                                                          disconnect_respond () {
                                                              const logdetail = {
                                                                  'ip': this.remote.ip,
                                                                  'rdns': ((this.remote.host) ? this.remote.host : ''),
                                                                  'helo': ((this.hello.host) ? this.hello.host : ''),
                                                      Severity: Minor
                                                      Found in connection.js - About 45 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

                                                      Avoid deeply nested control flow statements.
                                                      Open

                                                                      switch (cmd) {
                                                                          case 'RSET':
                                                                          case 'MAIL':
                                                                          case 'SEND':
                                                                          case 'SOML':
                                                      Severity: Major
                                                      Found in connection.js - About 45 mins to fix

                                                        Function cmd_proxy has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                                        Open

                                                            cmd_proxy (line) {
                                                        
                                                                if (!this.proxy.allowed) {
                                                                    this.respond(421, `PROXY not allowed from ${this.remote.ip}`);
                                                                    return this.disconnect();
                                                        Severity: Minor
                                                        Found in connection.js - About 45 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 received_line has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                        Open

                                                            received_line () {
                                                                let smtp = this.hello.verb === 'EHLO' ? 'ESMTP' : 'SMTP';
                                                                // Implement RFC3848
                                                                if (this.tls.enabled) smtp += 'S';
                                                                if (this.authheader) smtp += 'A';
                                                        Severity: Minor
                                                        Found in connection.js - About 35 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 data_post_respond has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                        Open

                                                            data_post_respond (retval, msg) {
                                                                if (!this.transaction) return;
                                                                this.transaction.data_post_delay = (Date.now() - this.transaction.data_post_start)/1000;
                                                                const mid = this.transaction.header.get('Message-ID') || '';
                                                                this.lognotice(
                                                        Severity: Minor
                                                        Found in connection.js - About 35 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

                                                        Avoid too many return statements within this function.
                                                        Open

                                                                return this.respond(250, "Command sent for execution. Check Haraka logs for results.");
                                                        Severity: Major
                                                        Found in connection.js - About 30 mins to fix

                                                          Avoid too many return statements within this function.
                                                          Open

                                                                          return this._process_data();
                                                          Severity: Major
                                                          Found in connection.js - About 30 mins to fix

                                                            Avoid too many return statements within this function.
                                                            Open

                                                                            return this.respond(550, 'Message too big!');
                                                            Severity: Major
                                                            Found in connection.js - About 30 mins to fix

                                                              Avoid too many return statements within this function.
                                                              Open

                                                                              return plugins.run_hooks('unrecognized_command',
                                                                                  this, [this.current_line]);
                                                              Severity: Major
                                                              Found in connection.js - About 30 mins to fix

                                                                Avoid too many return statements within this function.
                                                                Open

                                                                            return this.respond(501, `Invalid MAIL FROM address`);
                                                                Severity: Major
                                                                Found in connection.js - About 30 mins to fix

                                                                  Avoid too many return statements within this function.
                                                                  Open

                                                                              return this.respond(555, 'Invalid command parameters');
                                                                  Severity: Major
                                                                  Found in connection.js - About 30 mins to fix

                                                                    Avoid too many return statements within this function.
                                                                    Open

                                                                                return this.respond(555, 'Invalid command parameters');
                                                                    Severity: Major
                                                                    Found in connection.js - About 30 mins to fix

                                                                      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 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 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

                                                                      Similar blocks of code found in 2 locations. Consider refactoring.
                                                                      Open

                                                                              try {
                                                                                  results = rfc1869.parse('mail', line, this.cfg.main.strict_rfc1869 && !this.relaying);
                                                                              }
                                                                              catch (err) {
                                                                                  this.errors++;
                                                                      Severity: Major
                                                                      Found in connection.js and 1 other location - About 6 hrs to fix
                                                                      connection.js on lines 1400..1418

                                                                      Duplicated Code

                                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                      Tuning

                                                                      This issue has a mass of 165.

                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                      Refactorings

                                                                      Further Reading

                                                                      Similar blocks of code found in 2 locations. Consider refactoring.
                                                                      Open

                                                                              try {
                                                                                  results = rfc1869.parse('rcpt', line, this.cfg.main.strict_rfc1869 && !this.relaying);
                                                                              }
                                                                              catch (err) {
                                                                                  this.errors++;
                                                                      Severity: Major
                                                                      Found in connection.js and 1 other location - About 6 hrs to fix
                                                                      connection.js on lines 1336..1354

                                                                      Duplicated Code

                                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                      Tuning

                                                                      This issue has a mass of 165.

                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                      Refactorings

                                                                      Further Reading

                                                                      Similar blocks of code found in 2 locations. Consider refactoring.
                                                                      Open

                                                                          cmd_ehlo (line) {
                                                                              const results = (String(line)).split(/ +/);
                                                                              const host = results[0];
                                                                              if (!host) {
                                                                                  return this.respond(501, "EHLO requires domain/address - see RFC-2821 4.1.1.1");
                                                                      Severity: Major
                                                                      Found in connection.js and 1 other location - About 5 hrs to fix
                                                                      connection.js on lines 1270..1283

                                                                      Duplicated Code

                                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                      Tuning

                                                                      This issue has a mass of 141.

                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                      Refactorings

                                                                      Further Reading

                                                                      Similar blocks of code found in 2 locations. Consider refactoring.
                                                                      Open

                                                                          cmd_helo (line) {
                                                                              const results = (String(line)).split(/ +/);
                                                                              const host = results[0];
                                                                              if (!host) {
                                                                                  return this.respond(501, "HELO requires domain/address - see RFC-2821 4.1.1.1");
                                                                      Severity: Major
                                                                      Found in connection.js and 1 other location - About 5 hrs to fix
                                                                      connection.js on lines 1284..1297

                                                                      Duplicated Code

                                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                      Tuning

                                                                      This issue has a mass of 141.

                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                      Refactorings

                                                                      Further Reading

                                                                      Similar blocks of code found in 2 locations. Consider refactoring.
                                                                      Open

                                                                      for (const key in logger) {
                                                                          if (!/^log\w/.test(key)) continue;
                                                                          Connection.prototype[key] = (function (level) {
                                                                              return function () {
                                                                                  // pass the connection instance to logger
                                                                      Severity: Major
                                                                      Found in connection.js and 1 other location - About 4 hrs to fix
                                                                      outbound/hmail.js on lines 1460..1472

                                                                      Duplicated Code

                                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                      Tuning

                                                                      This issue has a mass of 126.

                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                      Refactorings

                                                                      Further Reading

                                                                      Similar blocks of code found in 2 locations. Consider refactoring.
                                                                      Open

                                                                                  case constants.deny:
                                                                                      this.respond(550, msg || "Message denied", () => {
                                                                                          this.msg_count.reject++;
                                                                                          this.transaction.msg_status = 'rejected';
                                                                                          this.reset_transaction(() => this.resume());
                                                                      Severity: Major
                                                                      Found in connection.js and 1 other location - About 2 hrs to fix
                                                                      connection.js on lines 1692..1698

                                                                      Duplicated Code

                                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                      Tuning

                                                                      This issue has a mass of 80.

                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                      Refactorings

                                                                      Further Reading

                                                                      Similar blocks of code found in 2 locations. Consider refactoring.
                                                                      Open

                                                                                  case constants.denysoft:
                                                                                      this.respond(450, msg || "Message denied temporarily", () =>  {
                                                                                          this.msg_count.tempfail++;
                                                                                          this.transaction.msg_status = 'deferred';
                                                                                          this.reset_transaction(() => this.resume());
                                                                      Severity: Major
                                                                      Found in connection.js and 1 other location - About 2 hrs to fix
                                                                      connection.js on lines 1678..1684

                                                                      Duplicated Code

                                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                      Tuning

                                                                      This issue has a mass of 80.

                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                      Refactorings

                                                                      Further Reading

                                                                      Similar blocks of code found in 4 locations. Consider refactoring.
                                                                      Open

                                                                                  case constants.denysoft:
                                                                                      this.respond(450, msg, () => {
                                                                                          this.msg_count.tempfail++;
                                                                                          this.transaction.msg_status = 'deferred';
                                                                                          this.reset_transaction(() => this.resume());
                                                                      Severity: Major
                                                                      Found in connection.js and 3 other locations - About 2 hrs to fix
                                                                      connection.js on lines 1773..1779
                                                                      connection.js on lines 1850..1856
                                                                      connection.js on lines 1864..1870

                                                                      Duplicated Code

                                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                      Tuning

                                                                      This issue has a mass of 76.

                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                      Refactorings

                                                                      Further Reading

                                                                      Similar blocks of code found in 4 locations. Consider refactoring.
                                                                      Open

                                                                                  case constants.deny:
                                                                                      this.respond(550, msg, () => {
                                                                                          this.msg_count.reject++;
                                                                                          this.transaction.msg_status = 'rejected';
                                                                                          this.reset_transaction(() =>  this.resume());
                                                                      Severity: Major
                                                                      Found in connection.js and 3 other locations - About 2 hrs to fix
                                                                      connection.js on lines 1773..1779
                                                                      connection.js on lines 1787..1793
                                                                      connection.js on lines 1864..1870

                                                                      Duplicated Code

                                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                      Tuning

                                                                      This issue has a mass of 76.

                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                      Refactorings

                                                                      Further Reading

                                                                      Similar blocks of code found in 4 locations. Consider refactoring.
                                                                      Open

                                                                                  case constants.deny:
                                                                                      this.respond(550, msg, () => {
                                                                                          this.msg_count.reject++;
                                                                                          this.transaction.msg_status = 'rejected';
                                                                                          this.reset_transaction(() => this.resume());
                                                                      Severity: Major
                                                                      Found in connection.js and 3 other locations - About 2 hrs to fix
                                                                      connection.js on lines 1787..1793
                                                                      connection.js on lines 1850..1856
                                                                      connection.js on lines 1864..1870

                                                                      Duplicated Code

                                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                      Tuning

                                                                      This issue has a mass of 76.

                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                      Refactorings

                                                                      Further Reading

                                                                      Similar blocks of code found in 4 locations. Consider refactoring.
                                                                      Open

                                                                                  case constants.denysoft:
                                                                                      this.respond(450, msg, () => {
                                                                                          this.msg_count.tempfail++;
                                                                                          this.transaction.msg_status = 'deferred';
                                                                                          this.reset_transaction(() => this.resume());
                                                                      Severity: Major
                                                                      Found in connection.js and 3 other locations - About 2 hrs to fix
                                                                      connection.js on lines 1773..1779
                                                                      connection.js on lines 1787..1793
                                                                      connection.js on lines 1850..1856

                                                                      Duplicated Code

                                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                      Tuning

                                                                      This issue has a mass of 76.

                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                      Refactorings

                                                                      Further Reading

                                                                      Similar blocks of code found in 4 locations. Consider refactoring.
                                                                      Open

                                                                                  case constants.deny:
                                                                                      this.respond(550, msg || `${dmsg} denied`, () => {
                                                                                          this.rcpt_incr(rcpt, 'reject', msg, retval);
                                                                                          this.transaction.rcpt_to.pop();
                                                                                      });
                                                                      Severity: Major
                                                                      Found in connection.js and 3 other locations - About 1 hr to fix
                                                                      connection.js on lines 1090..1095
                                                                      connection.js on lines 1130..1135
                                                                      connection.js on lines 1142..1147

                                                                      Duplicated Code

                                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                      Tuning

                                                                      This issue has a mass of 72.

                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                      Refactorings

                                                                      Further Reading

                                                                      Similar blocks of code found in 4 locations. Consider refactoring.
                                                                      Open

                                                                                  case constants.denysoft:
                                                                                      this.respond(450, msg || `${dmsg} denied`, () => {
                                                                                          this.rcpt_incr(rcpt, 'tempfail', msg, retval);
                                                                                          this.transaction.rcpt_to.pop();
                                                                                      });
                                                                      Severity: Major
                                                                      Found in connection.js and 3 other locations - About 1 hr to fix
                                                                      connection.js on lines 1078..1083
                                                                      connection.js on lines 1130..1135
                                                                      connection.js on lines 1142..1147

                                                                      Duplicated Code

                                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                      Tuning

                                                                      This issue has a mass of 72.

                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                      Refactorings

                                                                      Further Reading

                                                                      Similar blocks of code found in 4 locations. Consider refactoring.
                                                                      Open

                                                                                  case constants.denysoft:
                                                                                      this.respond(450, msg || `${dmsg} denied`, () => {
                                                                                          this.rcpt_incr(rcpt, 'tempfail', msg, retval);
                                                                                          this.transaction.rcpt_to.pop();
                                                                                      });
                                                                      Severity: Major
                                                                      Found in connection.js and 3 other locations - About 1 hr to fix
                                                                      connection.js on lines 1078..1083
                                                                      connection.js on lines 1090..1095
                                                                      connection.js on lines 1130..1135

                                                                      Duplicated Code

                                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                      Tuning

                                                                      This issue has a mass of 72.

                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                      Refactorings

                                                                      Further Reading

                                                                      Similar blocks of code found in 2 locations. Consider refactoring.
                                                                      Open

                                                                                  this.lognotice(
                                                                                      dmsg,
                                                                                      {
                                                                                          'code': constants.translate((retval === constants.cont ? constants.ok : retval)),
                                                                                          'msg': (msg || ''),
                                                                      Severity: Major
                                                                      Found in connection.js and 1 other location - About 1 hr to fix
                                                                      connection.js on lines 1069..1076

                                                                      Duplicated Code

                                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                      Tuning

                                                                      This issue has a mass of 72.

                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                      Refactorings

                                                                      Further Reading

                                                                      Similar blocks of code found in 2 locations. Consider refactoring.
                                                                      Open

                                                                              this.lognotice(
                                                                                  dmsg,
                                                                                  {
                                                                                      'code': constants.translate((retval === constants.cont ? constants.ok : retval)),
                                                                                      'msg': (msg || ''),
                                                                      Severity: Major
                                                                      Found in connection.js and 1 other location - About 1 hr to fix
                                                                      connection.js on lines 1120..1127

                                                                      Duplicated Code

                                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                      Tuning

                                                                      This issue has a mass of 72.

                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                      Refactorings

                                                                      Further Reading

                                                                      Similar blocks of code found in 4 locations. Consider refactoring.
                                                                      Open

                                                                                  case constants.deny:
                                                                                      this.respond(550, msg || `${dmsg} denied`, () => {
                                                                                          this.rcpt_incr(rcpt, 'reject', msg, retval);
                                                                                          this.transaction.rcpt_to.pop();
                                                                                      });
                                                                      Severity: Major
                                                                      Found in connection.js and 3 other locations - About 1 hr to fix
                                                                      connection.js on lines 1078..1083
                                                                      connection.js on lines 1090..1095
                                                                      connection.js on lines 1142..1147

                                                                      Duplicated Code

                                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                      Tuning

                                                                      This issue has a mass of 72.

                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                      Refactorings

                                                                      Further Reading

                                                                      Similar blocks of code found in 2 locations. Consider refactoring.
                                                                      Open

                                                                                  case constants.denydisconnect:
                                                                                      this.respond(550, msg || "Message denied",() => {
                                                                                          this.msg_count.reject++;
                                                                                          this.transaction.msg_status = 'rejected';
                                                                                          this.disconnect();
                                                                      Severity: Major
                                                                      Found in connection.js and 1 other location - About 1 hr to fix
                                                                      connection.js on lines 1699..1705

                                                                      Duplicated Code

                                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                      Tuning

                                                                      This issue has a mass of 69.

                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                      Refactorings

                                                                      Further Reading

                                                                      Similar blocks of code found in 2 locations. Consider refactoring.
                                                                      Open

                                                                                  case constants.denysoftdisconnect:
                                                                                      this.respond(450, msg || "Message denied temporarily",() => {
                                                                                          this.msg_count.tempfail++;
                                                                                          this.transaction.msg_status = 'deferred';
                                                                                          this.disconnect();
                                                                      Severity: Major
                                                                      Found in connection.js and 1 other location - About 1 hr to fix
                                                                      connection.js on lines 1685..1691

                                                                      Duplicated Code

                                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                      Tuning

                                                                      This issue has a mass of 69.

                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                      Refactorings

                                                                      Further Reading

                                                                      Identical blocks of code found in 2 locations. Consider refactoring.
                                                                      Open

                                                                              results.forEach(param => {
                                                                                  const kv = param.match(/^([^=]+)(?:=(.+))?$/);
                                                                                  if (kv)
                                                                                      params[kv[1].toUpperCase()] = kv[2] || null;
                                                                              });
                                                                      Severity: Major
                                                                      Found in connection.js and 1 other location - About 1 hr to fix
                                                                      connection.js on lines 1430..1434

                                                                      Duplicated Code

                                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                      Tuning

                                                                      This issue has a mass of 68.

                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                      Refactorings

                                                                      Further Reading

                                                                      Identical blocks of code found in 2 locations. Consider refactoring.
                                                                      Open

                                                                              results.forEach((param) => {
                                                                                  const kv = param.match(/^([^=]+)(?:=(.+))?$/);
                                                                                  if (kv)
                                                                                      params[kv[1].toUpperCase()] = kv[2] || null;
                                                                              });
                                                                      Severity: Major
                                                                      Found in connection.js and 1 other location - About 1 hr to fix
                                                                      connection.js on lines 1366..1370

                                                                      Duplicated Code

                                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                      Tuning

                                                                      This issue has a mass of 68.

                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                      Refactorings

                                                                      Further Reading

                                                                      Similar blocks of code found in 4 locations. Consider refactoring.
                                                                      Open

                                                                                  case constants.denysoftdisconnect:
                                                                                      this.respond(450, msg, () => {
                                                                                          this.msg_count.tempfail++;
                                                                                          this.transaction.msg_status = 'deferred';
                                                                                          this.disconnect();
                                                                      Severity: Major
                                                                      Found in connection.js and 3 other locations - About 1 hr to fix
                                                                      connection.js on lines 1780..1786
                                                                      connection.js on lines 1794..1800
                                                                      connection.js on lines 1857..1863

                                                                      Duplicated Code

                                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                      Tuning

                                                                      This issue has a mass of 65.

                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                      Refactorings

                                                                      Further Reading

                                                                      Similar blocks of code found in 4 locations. Consider refactoring.
                                                                      Open

                                                                                  case constants.denysoftdisconnect:
                                                                                      this.respond(450, msg, () => {
                                                                                          this.msg_count.tempfail++;
                                                                                          this.transaction.msg_status = 'deferred';
                                                                                          this.disconnect();
                                                                      Severity: Major
                                                                      Found in connection.js and 3 other locations - About 1 hr to fix
                                                                      connection.js on lines 1780..1786
                                                                      connection.js on lines 1857..1863
                                                                      connection.js on lines 1871..1877

                                                                      Duplicated Code

                                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                      Tuning

                                                                      This issue has a mass of 65.

                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                      Refactorings

                                                                      Further Reading

                                                                      Similar blocks of code found in 4 locations. Consider refactoring.
                                                                      Open

                                                                                  case constants.denydisconnect:
                                                                                      this.respond(550, msg, () => {
                                                                                          this.msg_count.reject++;
                                                                                          this.transaction.msg_status = 'rejected';
                                                                                          this.disconnect();
                                                                      Severity: Major
                                                                      Found in connection.js and 3 other locations - About 1 hr to fix
                                                                      connection.js on lines 1794..1800
                                                                      connection.js on lines 1857..1863
                                                                      connection.js on lines 1871..1877

                                                                      Duplicated Code

                                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                      Tuning

                                                                      This issue has a mass of 65.

                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                      Refactorings

                                                                      Further Reading

                                                                      Similar blocks of code found in 4 locations. Consider refactoring.
                                                                      Open

                                                                                  case constants.denydisconnect:
                                                                                      this.respond(550, msg, () => {
                                                                                          this.msg_count.reject++;
                                                                                          this.transaction.msg_status = 'rejected';
                                                                                          this.disconnect();
                                                                      Severity: Major
                                                                      Found in connection.js and 3 other locations - About 1 hr to fix
                                                                      connection.js on lines 1780..1786
                                                                      connection.js on lines 1794..1800
                                                                      connection.js on lines 1871..1877

                                                                      Duplicated Code

                                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                      Tuning

                                                                      This issue has a mass of 65.

                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                      Refactorings

                                                                      Further Reading

                                                                      Similar blocks of code found in 4 locations. Consider refactoring.
                                                                      Open

                                                                                  case constants.denydisconnect:
                                                                                      this.respond(550, msg || `${dmsg} denied`, () => {
                                                                                          this.rcpt_incr(rcpt, 'reject', msg, retval);
                                                                                          this.disconnect();
                                                                                      });
                                                                      Severity: Major
                                                                      Found in connection.js and 3 other locations - About 1 hr to fix
                                                                      connection.js on lines 1096..1101
                                                                      connection.js on lines 1136..1141
                                                                      connection.js on lines 1148..1153

                                                                      Duplicated Code

                                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                      Tuning

                                                                      This issue has a mass of 64.

                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                      Refactorings

                                                                      Further Reading

                                                                      Similar blocks of code found in 4 locations. Consider refactoring.
                                                                      Open

                                                                                  case constants.denysoftdisconnect:
                                                                                      this.respond(450, msg || `${dmsg} denied`, () => {
                                                                                          this.rcpt_incr(rcpt, 'tempfail', msg, retval);
                                                                                          this.disconnect();
                                                                                      });
                                                                      Severity: Major
                                                                      Found in connection.js and 3 other locations - About 1 hr to fix
                                                                      connection.js on lines 1084..1089
                                                                      connection.js on lines 1136..1141
                                                                      connection.js on lines 1148..1153

                                                                      Duplicated Code

                                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                      Tuning

                                                                      This issue has a mass of 64.

                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                      Refactorings

                                                                      Further Reading

                                                                      Similar blocks of code found in 4 locations. Consider refactoring.
                                                                      Open

                                                                                  case constants.denydisconnect:
                                                                                      this.respond(550, msg || `${dmsg} denied`, () => {
                                                                                          this.rcpt_incr(rcpt, 'reject', msg, retval);
                                                                                          this.disconnect();
                                                                                      });
                                                                      Severity: Major
                                                                      Found in connection.js and 3 other locations - About 1 hr to fix
                                                                      connection.js on lines 1084..1089
                                                                      connection.js on lines 1096..1101
                                                                      connection.js on lines 1148..1153

                                                                      Duplicated Code

                                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                      Tuning

                                                                      This issue has a mass of 64.

                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                      Refactorings

                                                                      Further Reading

                                                                      Similar blocks of code found in 4 locations. Consider refactoring.
                                                                      Open

                                                                                  case constants.denysoftdisconnect:
                                                                                      this.respond(450, msg || `${dmsg} denied`, () => {
                                                                                          this.rcpt_incr(rcpt, 'tempfail', msg, retval);
                                                                                          this.disconnect();
                                                                                      });
                                                                      Severity: Major
                                                                      Found in connection.js and 3 other locations - About 1 hr to fix
                                                                      connection.js on lines 1084..1089
                                                                      connection.js on lines 1096..1101
                                                                      connection.js on lines 1136..1141

                                                                      Duplicated Code

                                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                      Tuning

                                                                      This issue has a mass of 64.

                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                      Refactorings

                                                                      Further Reading

                                                                      Identical blocks of code found in 2 locations. Consider refactoring.
                                                                      Open

                                                                                                  this.respond(550, msg2, () => {
                                                                                                      this.msg_count.reject++;
                                                                                                      this.transaction.msg_status = 'rejected';
                                                                                                      this.reset_transaction(() => {
                                                                                                          this.resume();
                                                                      Severity: Major
                                                                      Found in connection.js and 1 other location - About 1 hr to fix
                                                                      connection.js on lines 1821..1827

                                                                      Duplicated Code

                                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                      Tuning

                                                                      This issue has a mass of 60.

                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                      Refactorings

                                                                      Further Reading

                                                                      Identical blocks of code found in 2 locations. Consider refactoring.
                                                                      Open

                                                                                                  this.respond(550, msg2 || "Internal Server Error", () => {
                                                                                                      this.msg_count.reject++;
                                                                                                      this.transaction.msg_status = 'rejected';
                                                                                                      this.reset_transaction(() => {
                                                                                                          this.resume();
                                                                      Severity: Major
                                                                      Found in connection.js and 1 other location - About 1 hr to fix
                                                                      connection.js on lines 1811..1817

                                                                      Duplicated Code

                                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                      Tuning

                                                                      This issue has a mass of 60.

                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                      Refactorings

                                                                      Further Reading

                                                                      Similar blocks of code found in 2 locations. Consider refactoring.
                                                                      Open

                                                                              self.client.on('close', has_error => {
                                                                                  if (self.state >= states.DISCONNECTING) return;
                                                                                  self.remote.closed = true;
                                                                                  self.loginfo('client dropped connection', log_data);
                                                                                  self.fail();
                                                                      Severity: Major
                                                                      Found in connection.js and 1 other location - About 1 hr to fix
                                                                      connection.js on lines 169..174

                                                                      Duplicated Code

                                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                      Tuning

                                                                      This issue has a mass of 58.

                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                      Refactorings

                                                                      Further Reading

                                                                      Similar blocks of code found in 2 locations. Consider refactoring.
                                                                      Open

                                                                              self.client.on('end', () => {
                                                                                  if (self.state >= states.DISCONNECTING) return;
                                                                                  self.remote.closed = true;
                                                                                  self.loginfo('client half closed connection', log_data);
                                                                                  self.fail();
                                                                      Severity: Major
                                                                      Found in connection.js and 1 other location - About 1 hr to fix
                                                                      connection.js on lines 176..181

                                                                      Duplicated Code

                                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                      Tuning

                                                                      This issue has a mass of 58.

                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                      Refactorings

                                                                      Further Reading

                                                                      Similar blocks of code found in 4 locations. Consider refactoring.
                                                                      Open

                                                                                  case constants.deny:
                                                                                      this.respond(550, msg || "EHLO denied", () => {
                                                                                          this.set('hello', 'verb', null);
                                                                                          this.set('hello', 'host', null);
                                                                                      });
                                                                      Severity: Major
                                                                      Found in connection.js and 3 other locations - About 1 hr to fix
                                                                      connection.js on lines 847..852
                                                                      connection.js on lines 858..863
                                                                      connection.js on lines 889..894

                                                                      Duplicated Code

                                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                      Tuning

                                                                      This issue has a mass of 57.

                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                      Refactorings

                                                                      Further Reading

                                                                      Similar blocks of code found in 4 locations. Consider refactoring.
                                                                      Open

                                                                                  case constants.denysoft:
                                                                                      this.respond(450, msg || "EHLO denied", () => {
                                                                                          this.set('hello', 'verb', null);
                                                                                          this.set('hello', 'host', null);
                                                                                      });
                                                                      Severity: Major
                                                                      Found in connection.js and 3 other locations - About 1 hr to fix
                                                                      connection.js on lines 847..852
                                                                      connection.js on lines 858..863
                                                                      connection.js on lines 878..883

                                                                      Duplicated Code

                                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                      Tuning

                                                                      This issue has a mass of 57.

                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                      Refactorings

                                                                      Further Reading

                                                                      Similar blocks of code found in 4 locations. Consider refactoring.
                                                                      Open

                                                                                  case constants.deny:
                                                                                      this.respond(550, msg || `${dmsg} denied`, () => {
                                                                                          store_results('reject');
                                                                                          self.reset_transaction();
                                                                                      });
                                                                      Severity: Major
                                                                      Found in connection.js and 3 other locations - About 1 hr to fix
                                                                      connection.js on lines 1014..1019
                                                                      connection.js on lines 1020..1025
                                                                      connection.js on lines 1026..1031

                                                                      Duplicated Code

                                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                      Tuning

                                                                      This issue has a mass of 57.

                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                      Refactorings

                                                                      Further Reading

                                                                      Similar blocks of code found in 4 locations. Consider refactoring.
                                                                      Open

                                                                                  case constants.denysoft:
                                                                                      this.respond(450, msg || "HELO denied", () => {
                                                                                          this.set('hello', 'verb', null);
                                                                                          this.set('hello', 'host', null);
                                                                                      });
                                                                      Severity: Major
                                                                      Found in connection.js and 3 other locations - About 1 hr to fix
                                                                      connection.js on lines 847..852
                                                                      connection.js on lines 878..883
                                                                      connection.js on lines 889..894

                                                                      Duplicated Code

                                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                      Tuning

                                                                      This issue has a mass of 57.

                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                      Refactorings

                                                                      Further Reading

                                                                      Similar blocks of code found in 4 locations. Consider refactoring.
                                                                      Open

                                                                                  case constants.denysoftdisconnect:
                                                                                      this.respond(450, msg || `${dmsg} denied`, () => {
                                                                                          store_results('tempfail');
                                                                                          self.disconnect();
                                                                                      });
                                                                      Severity: Major
                                                                      Found in connection.js and 3 other locations - About 1 hr to fix
                                                                      connection.js on lines 1008..1013
                                                                      connection.js on lines 1014..1019
                                                                      connection.js on lines 1020..1025

                                                                      Duplicated Code

                                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                      Tuning

                                                                      This issue has a mass of 57.

                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                      Refactorings

                                                                      Further Reading

                                                                      Similar blocks of code found in 4 locations. Consider refactoring.
                                                                      Open

                                                                                  case constants.denysoft:
                                                                                      this.respond(450, msg || `${dmsg} denied`, () => {
                                                                                          store_results('tempfail');
                                                                                          self.reset_transaction();
                                                                                      });
                                                                      Severity: Major
                                                                      Found in connection.js and 3 other locations - About 1 hr to fix
                                                                      connection.js on lines 1008..1013
                                                                      connection.js on lines 1014..1019
                                                                      connection.js on lines 1026..1031

                                                                      Duplicated Code

                                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                      Tuning

                                                                      This issue has a mass of 57.

                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                      Refactorings

                                                                      Further Reading

                                                                      Similar blocks of code found in 4 locations. Consider refactoring.
                                                                      Open

                                                                                  case constants.deny:
                                                                                      this.respond(550, msg || "HELO denied", () => {
                                                                                          this.set('hello', 'verb', null);
                                                                                          this.set('hello', 'host', null);
                                                                                      });
                                                                      Severity: Major
                                                                      Found in connection.js and 3 other locations - About 1 hr to fix
                                                                      connection.js on lines 858..863
                                                                      connection.js on lines 878..883
                                                                      connection.js on lines 889..894

                                                                      Duplicated Code

                                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                      Tuning

                                                                      This issue has a mass of 57.

                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                      Refactorings

                                                                      Further Reading

                                                                      Similar blocks of code found in 4 locations. Consider refactoring.
                                                                      Open

                                                                                  case constants.denydisconnect:
                                                                                      this.respond(550, msg ||  `${dmsg} denied`, () => {
                                                                                          store_results('reject');
                                                                                          self.disconnect();
                                                                                      });
                                                                      Severity: Major
                                                                      Found in connection.js and 3 other locations - About 1 hr to fix
                                                                      connection.js on lines 1008..1013
                                                                      connection.js on lines 1020..1025
                                                                      connection.js on lines 1026..1031

                                                                      Duplicated Code

                                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                      Tuning

                                                                      This issue has a mass of 57.

                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                      Refactorings

                                                                      Further Reading

                                                                      Similar blocks of code found in 2 locations. Consider refactoring.
                                                                      Open

                                                                              try {
                                                                                  from = new Address(results.shift());
                                                                              }
                                                                              catch (err) {
                                                                                  return this.respond(501, `Invalid MAIL FROM address`);
                                                                      Severity: Minor
                                                                      Found in connection.js and 1 other location - About 50 mins to fix
                                                                      connection.js on lines 1421..1426

                                                                      Duplicated Code

                                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                      Tuning

                                                                      This issue has a mass of 51.

                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                      Refactorings

                                                                      Further Reading

                                                                      Similar blocks of code found in 2 locations. Consider refactoring.
                                                                      Open

                                                                              try {
                                                                                  recip = new Address(results.shift());
                                                                              }
                                                                              catch (err) {
                                                                                  return this.respond(501, `Invalid RCPT TO address`);
                                                                      Severity: Minor
                                                                      Found in connection.js and 1 other location - About 50 mins to fix
                                                                      connection.js on lines 1357..1362

                                                                      Duplicated Code

                                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                      Tuning

                                                                      This issue has a mass of 51.

                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                      Refactorings

                                                                      Further Reading

                                                                      Similar blocks of code found in 2 locations. Consider refactoring.
                                                                      Open

                                                                              this.results.add({name: 'disconnect'}, {
                                                                                  duration: (Date.now() - this.start_time)/1000,
                                                                              });
                                                                      Severity: Minor
                                                                      Found in connection.js and 1 other location - About 35 mins to fix
                                                                      connection.js on lines 646..648

                                                                      Duplicated Code

                                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                      Tuning

                                                                      This issue has a mass of 47.

                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                      Refactorings

                                                                      Further Reading

                                                                      Similar blocks of code found in 2 locations. Consider refactoring.
                                                                      Open

                                                                              this.results.add({name: 'reset'}, {
                                                                                  duration: (Date.now() - this.start_time)/1000,
                                                                              });
                                                                      Severity: Minor
                                                                      Found in connection.js and 1 other location - About 35 mins to fix
                                                                      connection.js on lines 630..632

                                                                      Duplicated Code

                                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                      Tuning

                                                                      This issue has a mass of 47.

                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                      Refactorings

                                                                      Further Reading

                                                                      Similar blocks of code found in 2 locations. Consider refactoring.
                                                                      Open

                                                                                  'rcpts': `${this.rcpt_count.accept}/${this.rcpt_count.tempfail}/${this.rcpt_count.reject}`,
                                                                      Severity: Minor
                                                                      Found in connection.js and 1 other location - About 35 mins to fix
                                                                      connection.js on lines 624..624

                                                                      Duplicated Code

                                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                      Tuning

                                                                      This issue has a mass of 46.

                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                      Refactorings

                                                                      Further Reading

                                                                      Identical blocks of code found in 2 locations. Consider refactoring.
                                                                      Open

                                                                              if (retval !== constants.ok) {
                                                                                  this.lognotice(
                                                                                      'queue',
                                                                                      {
                                                                                          code: constants.translate(retval),
                                                                      Severity: Minor
                                                                      Found in connection.js and 1 other location - About 35 mins to fix
                                                                      connection.js on lines 1760..1768

                                                                      Duplicated Code

                                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                      Tuning

                                                                      This issue has a mass of 46.

                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                      Refactorings

                                                                      Further Reading

                                                                      Identical blocks of code found in 2 locations. Consider refactoring.
                                                                      Open

                                                                              if (retval !== constants.ok) {
                                                                                  this.lognotice(
                                                                                      'queue',
                                                                                      {
                                                                                          code: constants.translate(retval),
                                                                      Severity: Minor
                                                                      Found in connection.js and 1 other location - About 35 mins to fix
                                                                      connection.js on lines 1837..1845

                                                                      Duplicated Code

                                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                      Tuning

                                                                      This issue has a mass of 46.

                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                      Refactorings

                                                                      Further Reading

                                                                      Similar blocks of code found in 2 locations. Consider refactoring.
                                                                      Open

                                                                                  'msgs': `${this.msg_count.accept}/${this.msg_count.tempfail}/${this.msg_count.reject}`,
                                                                      Severity: Minor
                                                                      Found in connection.js and 1 other location - About 35 mins to fix
                                                                      connection.js on lines 623..623

                                                                      Duplicated Code

                                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                      Tuning

                                                                      This issue has a mass of 46.

                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                      Refactorings

                                                                      Further Reading

                                                                      Similar blocks of code found in 2 locations. Consider refactoring.
                                                                      Open

                                                                              else {
                                                                                  new_ipv4_hosts[i] = [ipaddr.IPv4.parse(host[0]), parseInt(host[1] || 32)];
                                                                              }
                                                                      Severity: Minor
                                                                      Found in connection.js and 1 other location - About 30 mins to fix
                                                                      connection.js on lines 40..42

                                                                      Duplicated Code

                                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                      Tuning

                                                                      This issue has a mass of 45.

                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                      Refactorings

                                                                      Further Reading

                                                                      Similar blocks of code found in 2 locations. Consider refactoring.
                                                                      Open

                                                                              if (net.isIPv6(host[0])) {
                                                                                  new_ipv6_hosts[i] = [ipaddr.IPv6.parse(host[0]), parseInt(host[1] || 64)];
                                                                              }
                                                                      Severity: Minor
                                                                      Found in connection.js and 1 other location - About 30 mins to fix
                                                                      connection.js on lines 43..45

                                                                      Duplicated Code

                                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                      Tuning

                                                                      This issue has a mass of 45.

                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                      Refactorings

                                                                      Further Reading

                                                                      There are no issues that match your filters.

                                                                      Category
                                                                      Status