Showing 20 of 26 total issues
Function getFramework
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function getFramework(app) {
if (app instanceof http.Server) {
return request => {
const response = new Response(request);
app.emit('request', request, response)
Function constructor
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
constructor({ method }) {
super({ method });
this[BODY] = [];
this[HEADERS] = {};
- 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 exports
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
module.exports = (event, response, options) => {
const eventType = getEventType(event);
const { statusCode } = response;
const { headers, multiValueHeaders } = sanitizeHeaders(Response.headers(response));
- 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 finish
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
module.exports = async function finish(item, transform, ...details) {
await new Promise((resolve, reject) => {
if (item.finished || item.complete) {
resolve();
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 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor({ method }) {
super({ method });
this[BODY] = [];
this[HEADERS] = {};
Function getFramework
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function getFramework(app) {
if (app instanceof http.Server) {
return request => {
const response = new Response(request);
app.emit('request', request, response)
- 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 exports
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = (event, response, options) => {
const eventType = getEventType(event);
const { statusCode } = response;
const { headers, multiValueHeaders } = sanitizeHeaders(Response.headers(response));
Function finish
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = async function finish(item, transform, ...details) {
await new Promise((resolve, reject) => {
if (item.finished || item.complete) {
resolve();
return;
Function sanitizeHeaders
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function sanitizeHeaders(headers) {
return Object.keys(headers).reduce((memo, key) => {
const value = headers[key];
if (Array.isArray(value)) {
- 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 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor({ method, url, headers, body, remoteAddress }) {
super({
encrypted: true,
readable: false,
remoteAddress,
Consider simplifying this complex logical expression. Open
if (event.version === '2.0') {
event.requestContext.authorizer = event.requestContext.authorizer || {};
event.requestContext.http.method = event.requestContext.http.method || 'GET';
event.rawPath = removeBasePath(event.requestPath || event.rawPath, options.basePath);
} else {
Function recursiveURLDecode
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function recursiveURLDecode(value) {
if (isString(value)) {
return specialDecodeURIComponent(value);
} else if (Array.isArray(value)) {
- 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 sanitizeHeaders
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function sanitizeHeaders(headers) {
return Object.keys(headers).reduce((memo, key) => {
const value = headers[key];
if (Array.isArray(value)) {
- 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 cleanupEvent
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function cleanupEvent(evt, options) {
const event = evt || {};
event.requestContext = event.requestContext || {};
event.body = event.body || '';
- 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 common(app._core._dispatch({
app
}));
Avoid too many return
statements within this function. Open
return common(app.main);
Avoid too many return
statements within this function. Open
return common((req, res) => {
const { url, method, headers, body } = req;
app.router.route({ url, method, headers, body }, res);
});
Avoid too many return
statements within this function. Open
return common((request, response) => {
app._onRequest(request, response);
});
Avoid too many return
statements within this function. Open
return common(app);
Avoid too many return
statements within this function. Open
return async request => {
const { method, url, headers, body } = request;
const res = await app.inject({ method, url, headers, payload: body })