exabugs/node-searcher

View on GitHub

Showing 20 of 26 total issues

File frequency.js has 310 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*
 * Frequency Collection
 * @author exabugs@gmail.com
 */

Severity: Minor
Found in lib/text/frequency.js - About 3 hrs to fix

    Function cmdscale has 84 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    exports.cmdscale = function (db, target, source, callback) {
    
      var field = target.option.field || ['x', 'y'];
      var target_collection = db.collection(target.collection);
      var score = target.attribute + '.score';
    Severity: Major
    Found in lib/text/frequency.js - About 3 hrs to fix

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

      exports.cosine = function (collection, condition, condition2, option, field, callback) {
      
        // 検索条件
        condition2.forEach(function (item) {
          var words = _.pluck(item.keyword, field[0]);
      Severity: Major
      Found in lib/vector/index.js - About 2 hrs to fix

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

        exports.mutualize = function (db, source, field, callback) {
        
          var condition = source.option.condition || {};
          var collection = db.collection(source.collection);
        
        
        Severity: Minor
        Found in lib/text/frequency.js - About 1 hr to fix

          Function search has 37 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          exports.search = function (db, target, freq, field, callback) {
          
            var tasks = [];
            tasks.push(function (done) {
              var condition2 = [];
          Severity: Minor
          Found in lib/text/index.js - About 1 hr to fix

            Function countup has 34 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            exports.countup = function (db, target, source, field, callback) {
            
              var condition = target.option.condition || {};
              var collection = db.collection(target.collection);
            
            
            Severity: Minor
            Found in lib/text/frequency.js - About 1 hr to fix

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

              exports.object_frequency = function (db, info, freq, field, callback) {
              
                // 検索条件
                var condition = info.option.condition || {};
                var collection = db.collection(info.collection);
              Severity: Minor
              Found in lib/text/frequency.js - About 1 hr to fix

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

                exports.tfiof = function (db, target, freq, field, callback) {
                  // 検索条件
                  var condition = target.option.condition || {};
                  var collection = db.collection(target.collection);
                  condition[target.attribute] = {$exists: 1};
                Severity: Minor
                Found in lib/text/frequency.js - About 1 hr to fix

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

                  Searcher.prototype.indexing = function (target, source, callback) {
                    var freq = this.freq;
                    var field = this.field;
                    this.check(target);
                    this.check(source);
                  Severity: Minor
                  Found in index.js - About 1 hr to fix

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

                    Util.prototype.sum = function (a, b) {
                      var k = this.prop[0];
                      var c = this.prop[1];
                      var result = [];
                      for (var i = 0, j = 0; i < a.length || j < b.length;) {
                    Severity: Minor
                    Found in lib/vector/util.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

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

                    Util.prototype.search = function (array, value, head) {
                      head = head || 0;
                      var tail = array.length - 1;
                      while (head <= tail) {
                        var where = head + Math.floor((tail - head) / 2);
                    Severity: Minor
                    Found in lib/vector/util.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

                    Function patch has 7 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                    exports.patch = function (db, info, item, out, attribute, field, callback) {
                    Severity: Major
                    Found in lib/text/index.js - About 50 mins to fix

                      Function cosine has 6 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                      exports.cosine = function (collection, condition, condition2, option, field, callback) {
                      Severity: Minor
                      Found in lib/vector/index.js - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                            if (err) {
                                              callback(err);
                                            } else {
                                              fs.unlink(ofile);
                                              var index = 0;
                        Severity: Major
                        Found in lib/text/frequency.js - About 45 mins to fix

                          Function tfiof has 5 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                          exports.tfiof = function (db, target, freq, field, callback) {
                          Severity: Minor
                          Found in lib/text/frequency.js - About 35 mins to fix

                            Function object_frequency has 5 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                            exports.object_frequency = function (db, info, freq, field, callback) {
                            Severity: Minor
                            Found in lib/text/frequency.js - About 35 mins to fix

                              Function countup has 5 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                              exports.countup = function (db, target, source, field, callback) {
                              Severity: Minor
                              Found in lib/text/frequency.js - About 35 mins to fix

                                Function search has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                exports.search = function (db, target, freq, field, callback) {
                                Severity: Minor
                                Found in lib/text/index.js - About 35 mins to fix

                                  Function to_tfiof has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                  Open

                                  exports.to_tfiof = function (tf_array, field, of_coll, default_value, callback) {
                                  Severity: Minor
                                  Found in lib/text/frequency.js - About 35 mins to fix

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

                                    function merge(a, af, b, bf) {
                                      var ia = 0, ib = 0;
                                      while (ia < a.length && ib < b.length) {
                                        var ka = a[ia][af[0]];
                                        var kb = b[ib][bf[0]];
                                    Severity: Minor
                                    Found in lib/text/frequency.js - About 25 mins to fix

                                    Cognitive Complexity

                                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                    A method's cognitive complexity is based on a few simple rules:

                                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                    • Code is considered more complex for each "break in the linear flow of the code"
                                    • Code is considered more complex when "flow breaking structures are nested"

                                    Further reading

                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language