Showing 9 of 11 total issues
Function populate_conn_properties
has a Cognitive Complexity of 23 (exceeds 6 allowed). Consider refactoring. Open
exports.populate_conn_properties = function (conn, res) {
const plugin = this;
let conn_res = res;
if (plugin.cfg.top_level_names && plugin.cfg.top_level_names.connection) {
- 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 prune_empty
has a Cognitive Complexity of 17 (exceeds 6 allowed). Consider refactoring. Open
exports.prune_empty = function (pi) {
// remove undefined keys and empty strings, arrays, or objects
for (const e in pi) {
const val = pi[e];
- 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 populate_conn_properties
has 58 lines of code (exceeds 45 allowed). Consider refactoring. Open
exports.populate_conn_properties = function (conn, res) {
const plugin = this;
let conn_res = res;
if (plugin.cfg.top_level_names && plugin.cfg.top_level_names.connection) {
Function get_plugin_results
has a Cognitive Complexity of 10 (exceeds 6 allowed). Consider refactoring. Open
exports.get_plugin_results = function (connection) {
let name;
// make a copy of the result store, so subsequent changes don't alter the original (by reference)
const pir = JSON.parse(JSON.stringify(connection.results.get_all()));
- 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
Avoid deeply nested control flow statements. Open
if (Object.keys(val).length === 0) delete pi[e];
Function prune_noisy
has a Cognitive Complexity of 8 (exceeds 6 allowed). Consider refactoring. Open
exports.prune_noisy = function (res, pi) {
const plugin = this;
if (res[pi].human) delete res[pi].human;
if (res[pi].human_html) delete res[pi].human_html;
- 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 load_es_ini
has a Cognitive Complexity of 8 (exceeds 6 allowed). Consider refactoring. Open
exports.load_es_ini = function () {
this.cfg = this.config.get('elasticsearch.ini', {
booleans: [
'+main.log_connections',
- 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 get_es_hosts
has a Cognitive Complexity of 7 (exceeds 6 allowed). Consider refactoring. Open
exports.get_es_hosts = function () {
const plugin = this;
plugin.cfg.es_hosts = []; // default: http://localhost:9200
if (!plugin.cfg.hosts) return; // no [hosts] config
- 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 prune_redundant_txn
has a Cognitive Complexity of 7 (exceeds 6 allowed). Consider refactoring. Open
exports.prune_redundant_txn = function (res, name) {
switch (name) {
case 'spamassassin':
if (!res.spamassassin) break;
delete res.spamassassin.hits;
- 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"