lib/logship.js
File logship.js
has 321 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
if (process.env.COVERAGE) require('blanket');
// node built-ins
var path = require('path');
var util = require('util');
Function populatePfdocsFromEs
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
PostfixToElastic.prototype.populatePfdocsFromEs = function(done) {
var p2e = this;
var pfQids = {};
// get a (likely short) list of elastic time series indexes in which these
Function saveResultsToEs
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
PostfixToElastic.prototype.saveResultsToEs = function(done) {
var p2e = this;
// create/update 'em all to ES
// logger.debug(util.inspect(this.pfDocs, {depth: null}));
var esBulk = []; // index, create, update
Function doQueue
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
PostfixToElastic.prototype.doQueue = function(done) {
var p2e = this;
if (this.queue.length === 0) {
if (this.reader && this.reader.watcher) {
Function tryLoadingRedis
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
PostfixToElastic.prototype.tryLoadingRedis = function() {
if (!this.cfg.redis) return;
if (!this.cfg.redis.module) return;
try {
var redis = require(this.cfg.redis.module);
- 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 doQueue
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
PostfixToElastic.prototype.doQueue = function(done) {
var p2e = this;
if (this.queue.length === 0) {
if (this.reader && this.reader.watcher) {
- 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"