Showing 10 of 12 total issues
File index.js
has 277 lines of code (exceeds 250 allowed). Consider refactoring. Open
const logger = require('./lib/logger')
const envEmailAddr = '<?([^>,]*)>?'
const postfixQid = '[0-9A-F]{10,11}' // default queue ids
Function smtpAsObject
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
function smtpAsObject (line) {
let match = line.match(regex.smtp)
if (match) return matchAsObject(match)
match = line.match(regex['smtp-conn-err'])
Function asObjectType
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.asObjectType = function (type, line) {
if (!type || !line) {
logger.error('missing required arg')
return
}
Function smtpAsObject
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function smtpAsObject (line) {
let match = line.match(regex.smtp)
if (match) return matchAsObject(match)
match = line.match(regex['smtp-conn-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
Avoid too many return
statements within this function. Open
return {
action: 'defer',
qid : match[1],
host : match[2],
msg : match[3],
Avoid too many return
statements within this function. Open
return {
qid: match[1],
msg: match[2],
}
Avoid too many return
statements within this function. Open
if (!match) return
Avoid too many return
statements within this function. Open
return { msg: match[0] }
Function asObjectType
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
exports.asObjectType = function (type, line) {
if (!type || !line) {
logger.error('missing required arg')
return
}
- 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 matchAsObject
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function matchAsObject (match) {
match.shift()
const obj = {}
const qid = match.shift()
if (qid) obj.qid = qid
- 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"