Showing 10 of 22 total issues
Function csvParserTransform
has a Cognitive Complexity of 126 (exceeds 5 allowed). Consider refactoring. Open
Open
CSVParser.prototype._transform = function csvParserTransform(chunk, encoding, cb) {
var _self = this;
var string = chunk.toString();
var matches;
var curChar;
- 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 csvParserTransform
has 183 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
CSVParser.prototype._transform = function csvParserTransform(chunk, encoding, cb) {
var _self = this;
var string = chunk.toString();
var matches;
var curChar;
File index.js
has 393 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
var Stream = require('readable-stream');
var util = require('util');
var escapeRegExpComponent = require('escape-string-regexp');
// Predefined configuration
Function checkOptions
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
Open
function checkOptions(options) {
options = options || {};
// Separators (required)
if(options.sep && 'string' === typeof options.sep) {
options.sep = [options.sep];
- 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 checkOptions
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function checkOptions(options) {
options = options || {};
// Separators (required)
if(options.sep && 'string' === typeof options.sep) {
options.sep = [options.sep];
Avoid deeply nested control flow statements. Open
Open
if(i < 0) {
string = (_self._escState + _self._escChars).substr(0, -i) + string;
i = -1;
}
Avoid deeply nested control flow statements. Open
Open
if(_self.options.fields) {
_self.push(_self.options.fields.reduce(function(obj, field) {
obj[field] = _self._currentRow.shift();
return obj;
}, {}));
Avoid deeply nested control flow statements. Open
Open
if(i < 0) {
string = _self._startQuotState.substr(0, -i) + string;
i = -1;
}
Avoid deeply nested control flow statements. Open
Open
if(i < 0) {
string = _self._endQuotState.substr(0, -i) + string;
i = -1;
}
Avoid deeply nested control flow statements. Open
Open
if(i < 0) {
string = _self._escState.substr(0, -i) + string;
i = -1;
}