Showing 48 of 77 total issues
Function scrollResultSet
has 116 lines of code (exceeds 25 allowed). Consider refactoring. Open
const scrollResultSet = (self, callback, loadedHits, response) => {
let body
if (loadedHits && loadedHits.length > 0) {
// are we skipping and we have hits?
Function aws4signer
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
const aws4signer = async (esRequest, parent) => {
// Consider deprecating - insecure to use on command line and credentials can be found by default at ~/.aws/credentials or as environment variables
const useAwsCredentials = ((typeof parent.options.awsAccessKeyId === 'string') && (typeof parent.options.awsSecretAccessKey === 'string'))
// Consider deprecating - can be achieved with awsChain and setting AWS_PROFILE and AWS_CONFIG_FILE environment variables as needed
const useAwsProfile = (typeof parent.options.awsIniFileProfile === 'string')
- 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 setAnalyzer
has 91 lines of code (exceeds 25 allowed). Consider refactoring. Open
setAnalyzer (data, limit, offset, callback) {
const updateAnalyzer = (err, response) => {
if (err) { return callback(err) }
try {
Function parse
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
parse (argv, defaults, parseJSONOpts = false) {
// parse passed options & use defaults otherwise
for (const i in defaults) {
this.options[i] = argv[i] || defaults[i]
- 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 setMapping
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
setMapping (data, limit, offset, callback) {
if (this.haveSetMapping === true || data.length === 0) {
callback(null, 0)
} else {
const esRequest = {
Function setData
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
setData (data, limit, offset, callback) {
if (data.length === 0) { return callback(null, 0) }
let writes = 0
Function setAnalyzer
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
setAnalyzer (data, limit, offset, callback) {
const updateAnalyzer = (err, response) => {
if (err) { return callback(err) }
try {
- 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 scrollResultSet
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
const scrollResultSet = (self, callback, loadedHits, response) => {
let body
if (loadedHits && loadedHits.length > 0) {
// are we skipping and we have hits?
- 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 set
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
set (data, limit, offset, callback) {
const error = null
let lineCounter = 0
if (!this.stream) {
- 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 updateAnalyzer
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
const updateAnalyzer = (err, response) => {
if (err) { return callback(err) }
try {
data = jsonParser.parse(data[0])
Function anonymize
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
function anonymize (thing, options = {}) {
if (
thing === null ||
thing instanceof Date
) {
Function getData
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
async getData (limit, offset, callback) {
let searchRequest, uri
let searchBodyTmp
if (this.parent.options.searchWithTemplate) {
Function getData
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
async getData (limit, offset, callback) {
let searchRequest, uri
let searchBodyTmp
if (this.parent.options.searchWithTemplate) {
- 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 set
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
set (data, limit, offset, callback) {
const error = null
let lineCounter = 0
if (!this._reading) {
Function aws4signer
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
const aws4signer = async (esRequest, parent) => {
// Consider deprecating - insecure to use on command line and credentials can be found by default at ~/.aws/credentials or as environment variables
const useAwsCredentials = ((typeof parent.options.awsAccessKeyId === 'string') && (typeof parent.options.awsSecretAccessKey === 'string'))
// Consider deprecating - can be achieved with awsChain and setting AWS_PROFILE and AWS_CONFIG_FILE environment variables as needed
const useAwsProfile = (typeof parent.options.awsIniFileProfile === 'string')
Function constructor
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor (parent, url, options) {
super()
this.base = parseBaseURL(url, options)
this.options = options
this.parent = parent
Function set
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
set (data, limit, offset, callback) {
const error = null
let lineCounter = 0
if (!this.stream) {
- 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 getIo
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
const getIo = (elasticdump, type) => {
let EntryProto
if (elasticdump.options[type] && !elasticdump.options[`${type}Transport`]) {
if (isUrl(elasticdump.options[type])) {
elasticdump[`${type}Type`] = 'elasticsearch'
- 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 set
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
set (data, limit, offset, callback) {
const error = null
let lineCounter = 0
if (!this._reading) {
- 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 __looper
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
async __looper (limit, offset, totalWrites, queue) {
const ignoreErrors = this.options['ignore-errors'] === true
return new Promise((resolve, reject) => {
this.input.get(limit, offset, (err, data) => {