acharkizakaria/haraka-plugin-accounting-files

View on GitHub

Showing 7 of 30 total issues

File index.js has 372 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// accounting_files
//------------
// documentation via: `haraka -h accounting_files`

//var outbound     = require("./outbound");
Severity: Minor
Found in index.js - About 4 hrs to fix

    Function init_plugin has 63 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    exports.init_plugin = function (next)  {
        var context                 = this;
        var acct_path               = cfg.main.path || path.join(process.env.HARAKA, "accounting_files");
        var separator               = cfg.main.separator || "    ";
        var files_extension         = cfg.main.extension || "tsv";
    Severity: Major
    Found in index.js - About 2 hrs to fix

      Function bounce has 63 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      exports.bounce  = function (next, hmail, error) {
          var plugin  = this;
          var todo    = hmail.todo;
          var header  = hmail.notes.header;
          var rcpt_to = todo.rcpt_to[0];
      Severity: Major
      Found in index.js - About 2 hrs to fix

        Function deferred has 58 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        exports.deferred = function (next, hmail, params) {
            var plugin   = this;
            var todo     = hmail.todo;
            var header   = hmail.notes.header;
            var rcpt_to  = todo.rcpt_to[0];
        Severity: Major
        Found in index.js - About 2 hrs to fix

          Function delivered has 55 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          exports.delivered = function (next, hmail, params) {
              var plugin    = this;
              var todo      = hmail.todo;
              var header    = hmail.notes.header;
              var rcpt_to   = todo.rcpt_to[0];
          Severity: Major
          Found in index.js - About 2 hrs to fix

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

            exports.init_plugin = function (next)  {
                var context                 = this;
                var acct_path               = cfg.main.path || path.join(process.env.HARAKA, "accounting_files");
                var separator               = cfg.main.separator || "    ";
                var files_extension         = cfg.main.extension || "tsv";
            Severity: Minor
            Found in index.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 addRecord has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            var addRecord = function (filename, fields, fields_values, type, context) {
            Severity: Minor
            Found in index.js - About 35 mins to fix
              Severity
              Category
              Status
              Source
              Language