Showing 48 of 77 total issues
Function setAliases
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
setAliases (data, limit, offset, callback) {
if (this.haveSetAliases === true || data.length === 0) {
return callback(null, 0)
}
Function initAws
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const initAws = (options) => {
AWS.config.update({
accessKeyId: options.s3AccessKeyId,
secretAccessKey: options.s3SecretAccessKey,
sslEnabled: options.s3SSLEnabled,
Function setupGet
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async setupGet (offset) {
this.bufferedData = []
this.stream = parse(this._csvConfigs || {
headers: this._headers,
delimiter: this.parent.options.csvDelimiter,
Function get
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
get (limit, offset, callback) {
const type = this.parent.options.type
this.version('input', err => {
if (err) { return callback(err) }
Function setTemplates
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
setTemplates (data, limit, offset, callback) {
if (this.haveSetTemplates === true || data.length === 0) {
return callback(null, 0)
}
Function set
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
set (data, limit, offset, callback) {
const type = this.parent.options.type
this.version('output', err => {
if (err) { return callback(err) }
Function version
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
version (prefix, callback) {
if (this.ESversion) { return callback() }
const esRequest = {
url: `${this.base.host}/`,
method: 'GET'
Function setSettings
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
setSettings (data, limit, offset, callback) {
if (this.haveSetSettings === true || data.length === 0) {
return callback(null, 0)
}
Function set
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
set (data, limit, offset, callback) {
const error = null
let lineCounter = 0
if (!this.stream) {
Function getIo
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const getIo = (elasticdump, type) => {
let EntryProto
if (elasticdump.options[type] && !elasticdump.options[`${type}Transport`]) {
if (isUrl(elasticdump.options[type])) {
elasticdump[`${type}Type`] = 'elasticsearch'
Function getTemplates
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
getTemplates (limit, offset, callback) {
if (this.gotTemplates === true) {
callback(null, [])
} else {
const esRequest = {
Function constructor
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
constructor (input, output, options) {
super()
if (arguments.length === 1 && _.isPlainObject(arguments[0])) {
options = input
output = options.output
Function setPolicies
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
setPolicies (data, limit, offset, callback) {
if (this.haveSetPolicies === true || data.length === 0) {
return callback(null, 0)
}
Function set
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
set (data, limit, offset, callback) {
const error = null
let lineCounter = 0
if (!this.stream) {
Function setScripts
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
setScripts (data, limit, offset, callback) {
if (this.haveSetScripts === true || data.length === 0) {
return callback(null, 0)
}
Function del
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
del (elem, callback) {
let thisUrl = `${this.base.host}/${encodeURIComponent(elem._index)}/${encodeURIComponent(elem._type || '_doc')}/${encodeURIComponent(elem._id)}`
if (this.parent.options['delete-with-routing']) {
const obj = {}
Function parseBaseURL
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function parseBaseURL (_url, options = {}) {
let host = _url.replace(/\/+$/, '')
const hostParts = host.split('/')
let index
const indexParts = (options.index || '').split('/').filter(Boolean)
Function dump
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
Open
dump (callback, continuing, limit, offset, totalWrites) {
if (this.validationErrors.length > 0) {
this.emit('error', { errors: this.validationErrors })
callback(new Error('There was an error starting this dump'))
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 constructor
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
Open
constructor (input, output, options) {
super()
if (arguments.length === 1 && _.isPlainObject(arguments[0])) {
options = input
output = options.output
- 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
Open
if (parentIndex > -1) {
sortedMappings.splice(parentIndex, 0, { key, index, data: mappings[key] })
} else {
const childIndex = sortedMappings.findIndex(set => (set.data._parent) && (set.data._parent.type === key)) // find child
if (childIndex > -1) {