Showing 49 of 55 total issues
Function compileRoute
has a Cognitive Complexity of 115 (exceeds 5 allowed). Consider refactoring. Open
export default function compileRoute(fn, params) {
const content = babelCompilerManipulationNormalize(fn.toString().trim());
const preparedParams = convertParams(params);
// Don't parse dummy functions
- 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 _prepareMethod
has 338 lines of code (exceeds 25 allowed). Consider refactoring. Open
_prepareMethod(method, { originalUrl, path }, ...middlewares) {
const { _config, _baseUrl, _middlewares, _ajv, _console } = this;
const fetchMethod = method === 'ANY';
const isWebSocket = method === 'WS';
Function swaggerDocsGenerator
has a Cognitive Complexity of 75 (exceeds 5 allowed). Consider refactoring. Open
export default function swaggerDocsGenerator(
swaggerDef,
path,
method,
{ schema, contentType = '*', ...routeConfigs } = {}
- 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 _prepareMethod
has a Cognitive Complexity of 63 (exceeds 5 allowed). Consider refactoring. Open
_prepareMethod(method, { originalUrl, path }, ...middlewares) {
const { _config, _baseUrl, _middlewares, _ajv, _console } = this;
const fetchMethod = method === 'ANY';
const isWebSocket = method === 'WS';
- 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
File Route.js
has 535 lines of code (exceeds 250 allowed). Consider refactoring. Open
import Events from '@dalisoft/events';
import fastQueryParse from 'fast-query-parse';
import { Route as RouteCompiler } from './compilers/index.js';
import {
httpMethods,
Function compileRoute
has 183 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function compileRoute(fn, params) {
const content = babelCompilerManipulationNormalize(fn.toString().trim());
const preparedParams = convertParams(params);
// Don't parse dummy functions
Function send
has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring. Open
export default function send(result) {
if (!result) {
result = '';
} else if (typeof result === 'object') {
this.setHeader('Content-Type', 'application/json; charset=utf-8');
- 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 wsExpose
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
Route.prototype.ws = function wsExpose(path, handler, options = {}) {
const { _baseUrl, _module, _ajv, _app } = this;
const { isRaw, isStrictRaw, schema } = options;
if (typeof handler === 'object') {
- 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 use
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
use(path, ...middlewares) {
let { _middlewares } = this;
if (!_middlewares) {
_middlewares = [];
- 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 webRTCServer
has 94 lines of code (exceeds 25 allowed). Consider refactoring. Open
app.webRTCServer = (path = '/webrtc', options = {}, ajv = null) => {
const connections = {};
app.ws(
path,
Function wsExpose
has 86 lines of code (exceeds 25 allowed). Consider refactoring. Open
Route.prototype.ws = function wsExpose(path, handler, options = {}) {
const { _baseUrl, _module, _ajv, _app } = this;
const { isRaw, isStrictRaw, schema } = options;
if (typeof handler === 'object') {
Function pipe
has 80 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function pipe(stream, size, compressed = false) {
const { __request: req } = this;
const { onAborted, headers, responseHeaders } = req;
let isAborted = false;
Function listen
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
listen(port, host) {
const {
_config: config,
_app: app,
_routeCalled,
Function prepareProxy
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
const prepareProxy = (
path,
{
url,
method,
- 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 modifyEnd
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
export default function modifyEnd() {
if (!this._modifiedEnd) {
const _oldEnd = this.end;
this.end = function modifiedEnd(chunk, encoding) {
- 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 use
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
use(path, ...middlewares) {
let { _middlewares } = this;
if (!_middlewares) {
_middlewares = [];
Function normalizeLocation
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
export const normalizeLocation = (path, config, host) => {
if (path.indexOf('http') === -1) {
if (path.indexOf('/') === -1) {
path = `/${path}`;
}
- 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 sendFile
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
export default function sendFile(
path,
lastModified = true,
compressed = 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 sendFile
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function sendFile(
path,
lastModified = true,
compressed = false
) {
Function http
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
prepared.http = async (res, req) => {
// Allow waiting for request finishing
let isAborted = false;
res.onAborted(() => {
isAborted = true;