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
*/
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';
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]);
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);
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 = [];
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);
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);
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};
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);
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;) {
- Read upRead up
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);
- Read upRead up
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) {
Function cosine
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
exports.cosine = function (collection, condition, condition2, option, field, callback) {
Avoid deeply nested control flow statements. Open
if (err) {
callback(err);
} else {
fs.unlink(ofile);
var index = 0;
Function tfiof
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
exports.tfiof = function (db, target, freq, field, callback) {
Function object_frequency
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
exports.object_frequency = function (db, info, freq, field, callback) {
Function countup
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
exports.countup = function (db, target, source, field, callback) {
Function search
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
exports.search = function (db, target, freq, field, callback) {
Function to_tfiof
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
exports.to_tfiof = function (tf_array, field, of_coll, default_value, callback) {
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]];
- Read upRead up
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"