Showing 7 of 65 total issues
File XMLHttpRequest.ts
has 333 lines of code (exceeds 250 allowed). Consider refactoring. Open
import http from 'http';
import {
InvalidStateDOMException,
SyntaxErrDOMException,
SecurityErrDOMException,
Function send
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
public send(data?: Document | BodyInit | null) {
if (this.readyState !== this.OPENED) {
throw new InvalidStateDOMException('state is not opened');
}
if (this.sendFlag) {
XMLHttpRequest
has 23 functions (exceeds 20 allowed). Consider refactoring. Open
export class XMLHttpRequest {
private request: http.ClientRequest | undefined | null;
private response: request.Response | undefined;
Function send
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public send(data?: Document | BodyInit | null) {
if (this.readyState !== this.OPENED) {
throw new InvalidStateDOMException('state is not opened');
}
if (this.sendFlag) {
- 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
Consider simplifying this complex logical expression. Open
if (
typeof header === 'string' &&
this.readyState > this.OPENED &&
this.response &&
this.response.headers &&
Function getAllResponseHeaders
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public getAllResponseHeaders() {
if (this.readyState < this.HEADERS_RECEIVED || this.errorFlag) {
return '';
}
let result = '';
- 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 setState
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private setState(state: number): void {
if (state == this.LOADING || this.readyState !== state) {
this._readyState = state;
if (
this.settings.async ||
- 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"