lib/text/frequency.js
File frequency.js
has 310 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/*
* Frequency Collection
* @author exabugs@gmail.com
*/
Function cmdscale
has 84 lines of code (exceeds 25 allowed). Consider refactoring. Open
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 mutualize
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
exports.mutualize = function (db, source, field, callback) {
var condition = source.option.condition || {};
var collection = db.collection(source.collection);
Function countup
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
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
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
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};
Avoid deeply nested control flow statements. Open
Open
if (err) {
callback(err);
} else {
fs.unlink(ofile);
var index = 0;
Function countup
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
exports.countup = function (db, target, source, field, callback) {
Function tfiof
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
exports.tfiof = function (db, target, freq, field, callback) {
Function to_tfiof
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
exports.to_tfiof = function (tf_array, field, of_coll, default_value, callback) {
Function object_frequency
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
exports.object_frequency = function (db, info, freq, field, callback) {
Function merge
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
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"