Function populate_conn_properties
has a Cognitive Complexity of 24 (exceeds 6 allowed). Consider refactoring.
exports.populate_conn_properties = function (conn, res) {
let conn_res = res
if (this.cfg.top_level_names?.connection) {
if (!res[this.cfg.top_level_names.connection]) {
Identical blocks of code found in 3 locations. Consider refactoring.
this.es
.create({
index: this.getIndexName('transaction'),
id: utils.uuid(),
document: doc,
Identical blocks of code found in 3 locations. Consider refactoring.
this.es
.create({
index: this.getIndexName('transaction'),
id: utils.uuid(),
document: doc,
Identical blocks of code found in 3 locations. Consider refactoring.
this.es
.create({
index: this.getIndexName('transaction'),
id: utils.uuid(),
document: doc,
Function prune_empty
has a Cognitive Complexity of 17 (exceeds 6 allowed). Consider refactoring.
exports.prune_empty = function (pi) {
for (const e in pi) {
const val = pi[e]
if (val === undefined || val === null) {
Function prune_noisy
has 67 lines of code (exceeds 45 allowed). Consider refactoring.
exports.prune_noisy = function (res, pi) {
if (res[pi].human) delete res[pi].human
if (res[pi].human_html) delete res[pi].human_html
if (res[pi]._watch_saw) delete res[pi]._watch_saw
Function populate_conn_properties
has 60 lines of code (exceeds 45 allowed). Consider refactoring.
exports.populate_conn_properties = function (conn, res) {
let conn_res = res
if (this.cfg.top_level_names?.connection) {
if (!res[this.cfg.top_level_names.connection]) {
Function load_es_ini
has a Cognitive Complexity of 14 (exceeds 6 allowed). Consider refactoring.
exports.load_es_ini = function () {
this.cfg = this.config.get(
'elasticsearch.ini',
{
booleans: [
Function prune_noisy
has a Cognitive Complexity of 12 (exceeds 6 allowed). Consider refactoring.
exports.prune_noisy = function (res, pi) {
if (res[pi].human) delete res[pi].human
if (res[pi].human_html) delete res[pi].human_html
if (res[pi]._watch_saw) delete res[pi]._watch_saw
Function populate_message
has a Cognitive Complexity of 11 (exceeds 6 allowed). Consider refactoring.
exports.populate_message = function (pir, connection) {
pir.message = {
bytes: connection.transaction.data_bytes,
envelope: {
sender: '',
Function get_plugin_results
has a Cognitive Complexity of 10 (exceeds 6 allowed). Consider refactoring.
exports.get_plugin_results = function (connection) {
let name
const pir = JSON.parse(JSON.stringify(connection.results.get_all()))
Avoid deeply nested control flow statements.
if (Object.keys(val).length === 0) delete pi[e]
Identical blocks of code found in 2 locations. Consider refactoring.
if (this.cfg.ignore_hosts) {
if (this.cfg.ignore_hosts[connection.remote.host]) return next()
}
Identical blocks of code found in 2 locations. Consider refactoring.
if (this.cfg.ignore_hosts) {
if (this.cfg.ignore_hosts[connection.remote.host]) return next()
}
Function prune_redundant_txn
has a Cognitive Complexity of 7 (exceeds 6 allowed). Consider refactoring.
exports.prune_redundant_txn = function (res, name) {
switch (name) {
case 'local':
case 'remote':
case 'reset':