mysociety/popit-api

View on GitHub
src/mongoose/merge.js

Summary

Maintainability
B
4 hrs
Test Coverage

Function mergePlugin has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = exports = function mergePlugin(schema) {
  schema.methods.merge = function merge(other, callback) {
    var self = this;
    var conflicts = [];
    var pathsToMerge = Object.keys(other.toObject());
Severity: Minor
Found in src/mongoose/merge.js - About 1 hr to fix

    Function merge has 40 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      schema.methods.merge = function merge(other, callback) {
        var self = this;
        var conflicts = [];
        var pathsToMerge = Object.keys(other.toObject());
        _.each(pathsToMerge, function(path) {
    Severity: Minor
    Found in src/mongoose/merge.js - About 1 hr to fix

      Avoid too many return statements within this function.
      Open

              return;
      Severity: Major
      Found in src/mongoose/merge.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                return;
        Severity: Major
        Found in src/mongoose/merge.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                  return;
          Severity: Major
          Found in src/mongoose/merge.js - About 30 mins to fix

            There are no issues that match your filters.

            Category
            Status