Showing 49 of 55 total issues
Consider simplifying this complex logical expression. Open
if (
!isRaw &&
!res._modifiedEnd &&
(!res.writeHead.notModified ||
(res.statusCode && res.statusCode !== 200) ||
Function writeHeaders
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export default function writeHeaders(headers) {
for (const header in headers) {
const value = headers[header];
if (value) {
if (value.splice) {
- 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
export default function pipe(stream, size, compressed = false) {
const { __request: req } = this;
const { onAborted, headers, responseHeaders } = req;
let isAborted = false;
- 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 setHeaders
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export default function setHeaders(headers) {
for (const header in headers) {
if (this._headers) {
const currentHeader = this._headers[header];
if (currentHeader !== undefined || currentHeader !== null) {
- 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 null;
Avoid too many return
statements within this function. Open
return routeFunction(req, res);
Avoid too many return
statements within this function. Open
return compiled;
Avoid too many return
statements within this function. Open
return null;
Function address
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
get address() {
const { _config: config } = this;
let address = '';
if (config.host) {
address += config.https ? 'https://' : 'http://';
- 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"