Showing 18 of 21 total issues
File index.js
has 417 lines of code (exceeds 250 allowed). Consider refactoring. Open
'use strict';
const EventEmitter = require('events').EventEmitter;
const fs = require('fs');
const Stream = require('stream').Stream;
Function _write
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
_write (data) {
const self = this;
if (data) {
this.buffered += data.length;
this.total_buffered += data.length;
- 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 add_line
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
add_line (line) {
const self = this;
if (typeof line === 'string') {
line = Buffer.from(line);
- 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 _write
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
_write (data) {
const self = this;
if (data) {
this.buffered += data.length;
this.total_buffered += data.length;
Function _read
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
_read () {
const self = this;
if (!this.end_called) {
throw new Error('end not called!');
}
- 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 pipe
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
pipe (destination, options = {}) {
const self = this;
if (this.in_pipe) {
throw new Error('Cannot pipe while currently piping');
}
Function process_buf
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
process_buf (buf) {
let offset = 0;
while ((offset = indexOfLF(buf)) !== -1) {
let line = buf.slice(0, offset+1);
buf = buf.slice(line.length);
- 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 _read
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
_read () {
const self = this;
if (!this.end_called) {
throw new Error('end not called!');
}
Function constructor
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor (cfg = {}, id, headers) {
super();
if (!id) throw new Error('id required');
this.uuid = id;
this.write_ce = null;
Function add_line
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
add_line (line) {
const self = this;
if (typeof line === 'string') {
line = Buffer.from(line);
Function process_buf
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
process_buf (buf) {
let offset = 0;
while ((offset = indexOfLF(buf)) !== -1) {
let line = buf.slice(0, offset+1);
buf = buf.slice(line.length);
Function fill
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
fill (input) {
if (typeof input === 'string') {
input = Buffer.from(input);
}
Function fill
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
fill (input) {
if (typeof input === 'string') {
input = Buffer.from(input);
}
- 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 pipe
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
pipe (destination, options = {}) {
const self = this;
if (this.in_pipe) {
throw new Error('Cannot pipe while currently piping');
}
- 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 true;
Avoid too many return
statements within this function. Open
return self._write();
Avoid too many return
statements within this function. Open
if (!this.fd) return false;
Avoid too many return
statements within this function. Open
return false;