Showing 13 of 13 total issues
Function routeMatcher
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
export function routeMatcher(request, route) {
// check if http method are equals
if (route.method && route.method !== request.method) {
return 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 routeMatcher
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function routeMatcher(request, route) {
// check if http method are equals
if (route.method && route.method !== request.method) {
return false;
}
Function fetch
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
fetch(request, resolve, reject) {
const {method, uri, headers=[], data} = request;
const fail = ({status, statusText, errorThrown}) => {
reject(
Function _callMiddlewareMethod
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
_callMiddlewareMethod(meth, currentRoutes, request, response) {
if (meth === 'exited') {
// currentRoutes, request, response params not needed
this.routers.forEach((router) => {
router.visited().forEach((route) => {
Function listen
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
listen(callback=DEFAULT.callback) {
const request = {method: 'GET', uri: window.location.pathname + window.location.search};
const response = {status: 200, statusText: 'OK'};
const currentRoutes = this._routes(request);
Function fetch
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
fetch(request, resolve, reject) {
const {method, uri, headers=[], data} = request;
const fail = ({status, statusText, errorThrown}) => {
reject(
- 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 uri
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
get uri() {
if (!this.uriPart && !this.method) {
return undefined;
}
- 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 baseUri;
Avoid too many return
statements within this function. Open
return true;
Avoid too many return
statements within this function. Open
return this.uriPart;
Avoid too many return
statements within this function. Open
return route.uri === baseUriToCheck;
Function use
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
use(...args) {
let {baseUri, router, middleware, plugin} = toParameters(args);
if (plugin) {
this.plugins.push(plugin);
} else {
- 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 toParameters
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export function toParameters(args) {
let baseUri, middleware, router, plugin, which;
args.length === 1 ? [which,] = args : [baseUri, which,] = args;
- 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"