Showing 11 of 13 total issues
File index.js
has 274 lines of code (exceeds 250 allowed). Consider refactoring. Open
'use strict';
var logger = require('./lib/logger');
var envEmailAddr = '<?([^>,]*)>?';
Function smtpAsObject
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
function smtpAsObject (line) {
var match = line.match(regex.smtp);
if (match) return matchAsObject(match);
match = line.match(regex['smtp-conn-err']);
Function exports
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-eslint');
grunt.loadNpmTasks('grunt-mocha-test');
grunt.loadNpmTasks('grunt-version-check');
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) {
var 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 {
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] };
Avoid too many return
statements within this function. Open
return {
action: 'defer',
qid: match[1],
host: match[2],
msg: match[3],
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();
var obj = {};
var 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"