Showing 12 of 17 total issues
Function constructor
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor() {
// Properties
this.headers = {};
this.headersSent = false;
this.locals = {};
Request
has 23 functions (exceeds 20 allowed). Consider refactoring. Open
export class Request {
// Properties
public baseUrl: string;
public body: any;
Function constructor
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor() {
this.request = new Request(null, { app: this });
this.response = new Response();
this.next = next;
// Properties
Function constructor
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor() {
const handler = (path: any, ...callbacks: any): void => {
const flattened = [].concat(...callbacks); // flatten array
if (typeof path === 'string' && flattened.every((cb: any) => typeof cb === 'function')) {
flattened.forEach((cb: any) => cb(this.request, this.response, this.next));
Function constructor
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
constructor() {
this.request = new Request(null, { app: this });
this.response = new Response();
this.next = next;
// Properties
- 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 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor(url?: string | null, options?: IRequestOptions) {
// Properties
this.baseUrl = '';
this.body = '';
this.cookies = {};
Function constructor
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
constructor() {
// Properties
this.headers = {};
this.headersSent = false;
this.locals = {};
- 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 setUrl
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public setUrl(url: string, options?: IRequestOptions) {
const parsedUrl = parse(url, true);
this.path = parsedUrl.pathname || '/';
this.hostname = parsedUrl.hostname || '';
- 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 resetMocked
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public resetMocked() {
// Properties
this.baseUrl = '';
this.body = '';
this.cookies = {};
Function resetMocked
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public resetMocked() {
// Properties
this.locals = {};
this.error = {};
this.mountpath = '';
Function resetMocked
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public resetMocked() {
// Properties
this.headers = {};
this.headersSent = false;
this.locals = {};
Function setUrl
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public setUrl(url: string, options?: IRequestOptions) {
const parsedUrl = parse(url, true);
this.path = parsedUrl.pathname || '/';
this.hostname = parsedUrl.hostname || '';