Showing 4 of 6 total issues
File index.js
has 320 lines of code (exceeds 250 allowed). Consider refactoring. Open
const fs = require('fs')
const net = require('net')
const path = require('path')
const net_utils = require('haraka-net-utils')
Function get_geoip
has a Cognitive Complexity of 25 (exceeds 10 allowed). Consider refactoring. Open
exports.get_geoip = function (ip) {
switch (true) {
case (!ip):
case (!net.isIPv4(ip) && !net.isIPv6(ip)):
- 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 calculate_distance
has a Cognitive Complexity of 13 (exceeds 10 allowed). Consider refactoring. Open
exports.calculate_distance = function (connection, rll, done) {
const plugin = this
function cb (err, l_ip) {
if (err) {
- 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 add_headers
has a Cognitive Complexity of 11 (exceeds 10 allowed). Consider refactoring. Open
exports.add_headers = function (next, connection) {
const txn = connection.transaction
if (!txn) return
txn.remove_header('X-Haraka-GeoIP')
- 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"