exabugs/node-searcher

View on GitHub
lib/text/frequency.js

Summary

Maintainability
D
2 days
Test Coverage

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

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

                        There are no issues that match your filters.

                        Category
                        Status