Showing 47 of 59 total issues
Avoid too many return
statements within this function. Open
return;
Avoid too many return
statements within this function. Open
return -1;
Avoid too many return
statements within this function. Open
return null;
Avoid too many return
statements within this function. Open
return new RouteTreeResult(keyValues, this.middleware, this.composedMiddleware);
Function addRoute
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
addRoute (pattern, pathComponents, middleware, catchAll = false) {
// check if we're done
if (pathComponents.length === 0) {
_middleware.set(this, middleware);
_composedMiddleware.set(this, compose(middleware));
- 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 allowedMethods
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
allowedMethods () {
const methods = [];
if (!this[Methods.HEAD].isEmpty) methods.push('HEAD');
if (!this[Methods.GET].isEmpty) methods.push('GET');
if (!this[Methods.PATCH].isEmpty) methods.push('PATCH');
- 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 Module
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const Module = function (...args) {
if (args.length === 1 && typeof args[0] === 'string') {
return function (target, key, descriptor) {
Metadata.putClassMeta(target.prototype, '@role', 'type', 'Module');
if (typeof name === 'string') {
- 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"