Function init
has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring. Open
async init() {
logger.debug('Scroll init');
this.timeoutFunc = setTimeout(() => {
this.timeout = true;
}, 60000);
- 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 init
has 90 lines of code (exceeds 25 allowed). Consider refactoring. Open
async init() {
logger.debug('Scroll init');
this.timeoutFunc = setTimeout(() => {
this.timeout = true;
}, 60000);
Function convertDataToDownload
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
convertDataToDownload(data, type, first, more, cloneUrl) {
if (type === 'csv') {
if (data.data.length === 0) {
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 continue
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
async continue() {
if (this.resultScroll.aggregations) {
const data = Scroll.serialize(this.resultScroll, this.parsed, this.format);
this.stream.write(this.convertDataToDownload(data, this.format, true, false, this.cloneUrl), 'binary');
- 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 convertDataToDownload
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
convertDataToDownload(data, type, first, more, cloneUrl) {
if (type === 'csv') {
if (data.data.length === 0) {
return '';
}
Function continue
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
async continue() {
if (this.resultScroll.aggregations) {
const data = Scroll.serialize(this.resultScroll, this.parsed, this.format);
this.stream.write(this.convertDataToDownload(data, this.format, true, false, this.cloneUrl), 'binary');
Consider simplifying this complex logical expression. Open
if (this.resultScroll.aggregations) {
const data = Scroll.serialize(this.resultScroll, this.parsed, this.format);
this.stream.write(this.convertDataToDownload(data, this.format, true, false, this.cloneUrl), 'binary');
} else {
this.first = true;